API Key Authentication (Deprecated)
Deprecated
This authentication method has been deprecated.
note
This authentication method is supported in:
- News API
- Daily Market Analysis API
- Economic Calendar API (deprecated versions: v2 & v4)
API calls expect 3 parameters:
- k as your client key
- t as the timestamp
- s as the generated hash
All the calls must end with that keys:
&k={YOUR_CLIENT_KEY}&s={HASH}&t={TIMESTAMP}
k, s, t will be valid for 15 minutes.
Parameters
k
FXstreet will provide client's public key.
t
The current datetime in utc as yyyyMMddHHmm
. For example, 2012-02-15 17:14:33 should be formated as 201202151714
.
s
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.
Code Samples
- C#
- Bash
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;
}