我已阅读有关BitForex的文档,有关在此处下订单的信息: https://github.com/bitforexapi/API_Doc_en/wiki/Order
然后,在理解之后,我阅读了API调用描述文档: https://github.com/bitforexapi/API_Doc_en/wiki/API-Call-Description
这是我的代码中的内容:
var crypto = require('crypto')
var axios = require('axios');
var accessKey = 'xxx';
var secretKey = 'xxx';
var nonce = Date.now().toString();
var amount = "1"
var price = "0.00015393"
var symbol = "coin-eth-bf"
// tradeType 1 is buy , tradeType 2 is sell
var tradeType = "1"
var message = `/api/v1/trade/placeOrder?accessKey=${accessKey}&amount=${amount}&nonce=${nonce}price=${price}&symbol=${symbol}&tradeType=${tradeType}`;
var hash = crypto.createHmac('sha256', secretKey).update(message);
var signData = hash.digest('hex');
axios.post(`https://api.bitforex.com/api/v1/trade/placeOrder?accessKey=${accessKey}&amount=${amount}&nonce=${nonce}price=${price}&symbol=${symbol}&tradeType=${tradeType}`)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
我不断收到错误消息:
{ code: '1011',
success: false,
time: xxx,
message: 'NeedParam accessKey and signData' }
我现在不知为何继续收到此错误。
我同时传入了accessKey
和signData
。
对我而言,最模糊的部分是signData
。
signData
?