Api calls expects 3 parameters:
FXstreet will provide client's public key.
The current datetime in utc as "yyyyMMddHHmm". For example, 2012-02-15 17:14:33 should be formated ad 201202151714
FXstreet will provide client's private key (YOUR_CLIENT_PRIVATE_KEY). s will is a SHA1 hash string generated using that private key concatenated with t.
C# Sample:
public string GenerateHash(System.DateTime dt, string input) { var hasher = System.Security.Cryptography.SHA1.Create(); string res = string.Empty; byte[] data = hasher.ComputeHash(System.Text.Encoding.ASCII.GetBytes(string.Concat(input, dt.ToString("yyyyMMddHHmm")))); foreach (byte b in data) { res += string.Format("{0:x2}", b); } return res; }
Bash Sample:
#!/bin/bash t=`date --utc +%Y%m%d%H%M` puk=YOUR_CLIENT_KEY prk=YOUR_CLIENT_PRIVATE_KEY s=`echo -n ${prk}${t} | openssl dgst -sha1 | awk '{print $2}'` echo "XML day request:" echo " public key: "${puk} echo " private key: "${prk} echo " timestamp: "${t} echo " sha1(private key + timestamp): "${s} echo "" echo "http://calendar.fxstreet.com/eventdate/?view=day&f=xml&k=${puk}&s=${s}&t=${t}"
Doing TDD?