Ejemplo n.º 1
0
        private static string CreateSignature(string secret)
        {
            var message        = $"GET/realtime{BitmexUtils.Expires()}";
            var signatureBytes = StorageUtils.EncryptHMACSHA256(Encoding.UTF8.GetBytes(secret), Encoding.UTF8.GetBytes(message));

            return(StorageUtils.ByteArrayToHexString(signatureBytes));
        }
Ejemplo n.º 2
0
        public static Dictionary <string, string> GetHttpAuthHeaders(string baseUrl, HttpMethod httpMethod, string requestPath, string urlQuery, string key, string secret)
        {
            var signatureMessage = $"{httpMethod.ToString()}/api/v1{requestPath}{urlQuery}{BitmexUtils.Expires()}";
            var signatureBytes   = StorageUtils.EncryptHMACSHA256(Encoding.UTF8.GetBytes(secret), Encoding.UTF8.GetBytes(signatureMessage));

            return(new Dictionary <string, string>
            {
                { "api-expires", BitmexUtils.Expires().ToString() },
                { "api-key", key },
                { "api-signature", StorageUtils.ByteArrayToHexString(signatureBytes) }
            });
        }
Ejemplo n.º 3
0
 public static string GetSocketAuthCommand(string key, string secret)
 {
     return($@"{{""op"": ""authKeyExpires"", ""args"": [""{key}"", {BitmexUtils.Expires()}, ""{CreateSignature(secret)}""]}}");
 }