我一直在尽力解释bitmex 对 api 连接的指示,但这就是我得到的全部:
function balanceBitmex() {
var apiKey = '***';
var apiSecret = '***';
var verb = 'get';
var path = '/api/v1/user/wallet';
var expires = Number(new Date().getTime() +5).toFixed(0);
var expires = expires.toString();
var data = '';
var data = JSON.stringify(data);
var currency = '';
var count= '';
var concat = verb+path+expires+data;
var apiSignature = Utilities.computeHmacSha256Signature(apiSecret, concat);
apiSignature = apiSignature.map(function(e) {
var v = (e < 0 ? e + 256 : e).toString(16);
return v.length == 1 ? "0" + v : v;
}).join("");
var params = {
'method': 'get',
'headers': {'contentType': 'application/json',
'api-expires': expires,
'api-key': apiKey,
'api-signature': apiSignature},
'muteHttpExceptions': true
};
//var params = params + data;
var url = "https://www.bitmex.com/api/v1/user/wallet?currency=XBt";
var data = UrlFetchApp.fetch(url, params);
var data = JSON.parse(data.getContentText());
我的脚本有什么问题? bitmex api explorer - 用户钱包