I’ve learn the documentation for BitForex on putting a purchase order right here:
https://github.com/bitforexapi/API_Doc_en/wiki/Order
Then after understanding that, I learn the API Name Description documentation:
https://github.com/bitforexapi/API_Doc_en/wiki/API-Name-Description
Here’s what I’ve in my code:
var crypto = require('crypto')
var axios = require('axios');
var accessKey = 'xxx';
var secretKey = 'xxx';
var nonce = Date.now().toString();
var quantity = "1"
var value = "0.00015393"
var image = "coin-eth-bf"
// tradeType 1 is purchase , tradeType 2 is promote
var tradeType = "1"
var message = `/api/v1/commerce/placeOrder?accessKey=${accessKey}&quantity=${quantity}&nonce=${nonce}value=${value}&image=${image}&tradeType=${tradeType}`;
var hash = crypto.createHmac('sha256', secretKey).replace(message);
var signData = hash.digest('hex');
axios.publish(`https://api.bitforex.com/api/v1/commerce/placeOrder?accessKey=${accessKey}&quantity=${quantity}&nonce=${nonce}value=${value}&image=${image}&tradeType=${tradeType}`)
.then(perform (response) {
console.log(response.information);
})
.catch(perform (error) {
console.log(error);
});
I maintain getting an error:
{ code: '1011',
success: false,
time: xxx,
message: 'NeedParam accessKey and signData' }
I’m at present at a loss to why I maintain obtain this error.
I’m passing each the accessKey
and signData
in.
The half that’s fuzzy to me is the signData
.
- Am I creating the
signData
correctly primarily based on the documentation? - Additionally, am does order matter for the parameters which can be being handed
- in? The rest I’ll probably be doing unsuitable?