Economic Calendar
With the tixee Economic Calendar, you can see what is affecting the market and when. Smart traders always have a plan in place. Based on forthcoming economic releases and global market events, you’ll be able to plan your trading moves in advance.
import java.security.spec.KeySpec; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; import java.util.Base64; import java.net.URLEncoder;
public class HandShake {
private static final String UNICODE_FORMAT = "UTF8"; public static final String DESEDE_ENCRYPTION_SCHEME = "DESede"; private KeySpec myKeySpec; private SecretKeyFactory mySecretKeyFactory; private Cipher cipher; byte[] keyAsBytes; SecretKey key;
private String encryptionKey = "Up*JhZQ%_XAWU-50s%=p7!cU"; private String baseURL = "https://site.recognia.com/tixee/serve.shtml?tkn="; private String page = "economic_calendar"; /*economic_calendar (Economic Insight), eod_menu(Education on Demand),av_forex_ideas(Analyst views), featured_forex(Featured Ideas)*/ private String userID = "testUser"; /* USER ID must be that of the user logged into your website */ private String language = "en"; /*en(English),nl(Dutch),it(Italian),pl(Polish),ru(russian)*/
public HandShake() throws Exception { keyAsBytes = encryptionKey.getBytes(UNICODE_FORMAT); myKeySpec = new DESedeKeySpec(keyAsBytes); mySecretKeyFactory = SecretKeyFactory.getInstance(DESEDE_ENCRYPTION_SCHEME); cipher = Cipher.getInstance(DESEDE_ENCRYPTION_SCHEME); key = mySecretKeyFactory.generateSecret(myKeySpec); }
/** * Method To Encrypt The String */ public String encrypt(String unencryptedString) { String encryptedString = null; try { cipher.init(Cipher.ENCRYPT_MODE, key); byte[] plainText = unencryptedString.getBytes(UNICODE_FORMAT); byte[] encryptedText = cipher.doFinal(plainText);
encryptedString = URLEncoder.encode(Base64.getEncoder().encodeToString(encryptedText), UNICODE_FORMAT); } catch (Exception e) { e.printStackTrace(); } return encryptedString; }
/** * Method To Create The Handshake URL */ public String handshakeURL() { final Date currentTime = new Date(); final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
String parameters = "aci=" + sdf.format(currentTime) + "&page=" + page + "&usi=" + userID + "&lang=" + language; if (email != null) parameters += "&eml=" + email; if (userType != null) parameters += "&uty=" + userType; if (usageGroup != null) parameters += "&usg=" + usageGroup;
String hanshakeURL = baseURL + encrypt(parameters); return hanshakeURL; }
/** * Testing */ public static void main(String args []) throws Exception { HandShake handshake = new HandShake(); System.out.println(handshake.handshakeURL()); } }