I have read the documentation for BitForex on placing a buy order here:
https://github.com/bitforexapi/API_Doc_en/wiki/Order
Then after understanding that, I read the API Call Description documentation:
https://github.com/bitforexapi/API_Doc_en/wiki/API-Call-Description
Here is what I have in my code:
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);
});
I keep getting an error:
{ code: '1011',
success: false,
time: xxx,
message: 'NeedParam accessKey and signData' }
I am currently at a loss to why I keep receive this error.
I am passing both the accessKey
and signData
in.
The part that is fuzzy to me is the signData
.
- Am I creating the
signData
properly based on the documentation? - Also, am does order matter for the parameters that are being passed
- in? Anything else I may potentially be doing wrong?