Hello, Im trying to make a trading API for Bitforex but I am running into signData invalid problem, I see this thread https://github.com/bitforexapi/API_Doc_en/issues/10 had a similar problem and a poster recommended re-ordering the parameters, I tried alphabetizing and encodingURI like https://github.com/bitforexapi/API_Doc_en/issues/5 thread recommends and still get the same error, does anyone have ideas? Below is my code
const Crypto = require('crypto') // Standard JavaScript cryptography library const request = require('request') // "Request" HTTP req library const config = require('./config') const bitforex = https://api.bitforex.com`;
const api = "API";
const apiSecretUnencoded = "API_Secret";
let apiSecret = encodeURI(apiSecretUnencoded)
let price = 0;
let amount = 0;
let tradeType = 1; // tradeType 1 is buy , tradeType 2 is sell
let symbol = "coin-usdt-eth";
let nonce = Date.now();
let apiPath = /api/v1/trade/placeOrder?amount=${amount}&accessKey=${api}&nonce=${nonce}&price=${price}&symbol=${symbol}&tradeType=${tradeType}&signData=
const message = ${bitforex}${apiPath};
console.log("apiPath: "+ apiPath);
const signData = Crypto.createHmac('sha256', apiSecret).digest('hex');// The authentication signature is hashed using the private key
let fullData = ${bitforex}${apiPath}${signData};
console.log("signdata: " + signData);
console.log("");
console.log(${fullData});
const body = {}
const options = {
url: fullData,
headers: {
'content-type': 'application/json',
},
json: true
}
request.post(options, (error, response, body) => {
console.log(body); // Logs the response body
})`
Hello, Im trying to make a trading API for Bitforex but I am running into signData invalid problem, I see this thread https://github.com/bitforexapi/API_Doc_en/issues/10 had a similar problem and a poster recommended re-ordering the parameters, I tried alphabetizing and encodingURI like https://github.com/bitforexapi/API_Doc_en/issues/5 thread recommends and still get the same error, does anyone have ideas? Below is my code
const Crypto = require('crypto') // Standard JavaScript cryptography library const request = require('request') // "Request" HTTP req library const config = require('./config') const bitforex =https://api.bitforex.com`;const api = "API";
const apiSecretUnencoded = "API_Secret";
let apiSecret = encodeURI(apiSecretUnencoded)
let price = 0;
let amount = 0;
let tradeType = 1; // tradeType 1 is buy , tradeType 2 is sell
let symbol = "coin-usdt-eth";
let nonce = Date.now();
let apiPath =
/api/v1/trade/placeOrder?amount=${amount}&accessKey=${api}&nonce=${nonce}&price=${price}&symbol=${symbol}&tradeType=${tradeType}&signData=const message =
${bitforex}${apiPath};console.log("apiPath: "+ apiPath);
const signData = Crypto.createHmac('sha256', apiSecret).digest('hex');// The authentication signature is hashed using the private key
let fullData =
${bitforex}${apiPath}${signData};console.log("signdata: " + signData);
console.log("");
console.log(
${fullData});const body = {}
const options = {
url: fullData,
headers: {
'content-type': 'application/json',
},
json: true
}
request.post(options, (error, response, body) => {
console.log(body); // Logs the response body
})`