// Elements with null values are ignored. Mantle.Fix44.HuobiSignature HuobiSignature(IEnumerable <KeyValuePair <string, string> > data) { var res = new Mantle.Fix44.HuobiSignature(); long now = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds; res.HuobiCreated.Value = now; res.HuobiAccessKey.Value = _cfg.Account; // accessKey, amount, symbol, created, method, price, secretKey var kv = data.Concat(new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("access_key", _cfg.Account), new KeyValuePair <string, string>("created", now.ToString()), new KeyValuePair <string, string>("secret_key", _cfg.SecretKey ?? _cfg.Password), }); string s = String.Join("&", kv.Where(p => p.Value != null) .OrderBy(p => p.Key) .Select(p => String.Format("{0}={1}", p.Key, p.Value))); res.HuobiSign.Value = Hex(MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(s))); return(res); }
// Elements with null values are ignored. Mantle.Fix44.HuobiSignature HuobiSignature(IEnumerable<KeyValuePair<string, string>> data) { var res = new Mantle.Fix44.HuobiSignature(); long now = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds; res.HuobiCreated.Value = now; res.HuobiAccessKey.Value = _cfg.Account; // accessKey, amount, symbol, created, method, price, secretKey var kv = data.Concat(new KeyValuePair<string, string>[] { new KeyValuePair<string, string>("access_key", _cfg.Account), new KeyValuePair<string, string>("created", now.ToString()), new KeyValuePair<string, string>("secret_key", _cfg.Password), }); string s = String.Join("&", kv.Where(p => p.Value != null) .OrderBy(p => p.Key) .Select(p => String.Format("{0}={1}", p.Key, p.Value))); res.HuobiSign.Value = Md5Hex(s); return res; }