2
Follow
0
Followers
[FMZ 플랫폼 확장 API 문제] JS 언어는 확장 API에 접근할 때 항상 잘못된 서명을 갖습니다. 전문가의 조언을 구합니다.
Created 2019-10-10 19:31:03
6
1913
예를 들어: 현재 플랫폼에서 API를 확장하는 사례는 PY와 GO입니다. 서명에 대한 내용은 다음과 같습니다: 먼저 MD5 암호화 다음 UTF-8 코딩, 나는 PY가 라이브러리에 직접 도입되지만 JS에는 UTF-8 코딩 함수가 없습니다.
method와 accessKey의 앞에는 부여된 값이 있습니다.
var d = {
version: '1.0',
access_key: accessKey,
method: method,
args: [],
nonce: _N(UnixNano() / 1000000, 0),
}
var m = d.version + "|" + d.method + "|" + d.args + "|" + d.nonce + "|" + secretKey
d.sign = HMAC("md5", "hex", m, "pass")
var h = JSON.parse(HttpQuery("https://www.fmz.cn/api/v1?access_key="+accessKey+"&nonce="+d.nonce+"&args=[]&sign="+d.sign+"&version=1.0&method="+d.method))
Related Recommendations
Advanced Tutorial for FMZ Quant platform Strategy WritingElementary Tutorial for FMZ Quant platform Strategy WritingGet Started with FMZ Quant PlatformSECURITY BUGI keep getting error: Exchange_GetAccount: Invalid ContractTypeWe have an incredibly profitable market making algorithm for sideways markets on Bitmex - but need expert to help eliminate wait times during downward volatility in the marketError with deribitLimitations of the backtesting engineHow to install ta-lib on linux docker?5.5 Trading strategy optimization
Comment
All comments (5)
写了一个,测试可以访问通了,您参考下:
function main() {
var accessKey = ""
var secretKey = ""
var method = "GetNodeList"
var d = {
version: '1.0',
access_key: accessKey,
method: method,
args: "null",
nonce: (new Date().getTime()).toString()
}
var m = d.version + "|" + d.method + "|" + d.args + "|" + d.nonce + "|" + secretKey
d.sign = Hash("md5", "hex", m)
var ret = HttpQuery("https://www.fmz.com/api/v1?access_key=" + accessKey + "&nonce=" + d.nonce + "&args=null&sign=" + d.sign + "&version=1.0&method=" + d.method)
Log(ret)
}
accessKey , secretKey 填写自己的KEY 就可以了。
7 years ago
- 1
