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 worth = "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}worth=${worth}&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}worth=${worth}&image=${image}&tradeType=${tradeType}`)
.then(operate (response) {
console.log(response.information);
})
.catch(operate (error) {
console.log(error);
});
I preserve getting an error:
{ code: '1011',
success: false,
time: xxx,
message: 'NeedParam accessKey and signData' }
I’m at present at a loss to why I preserve 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 based mostly on the documentation? - Additionally, am does order matter for the parameters which might be being handed
- in? The rest I’ll probably be doing mistaken?