Friday, November 22, 2024

currencies – tips on how to place a bitforex api purchase order

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.put up(`https://api.bitforex.com/api/v1/commerce/placeOrder?accessKey=${accessKey}&quantity=${quantity}&nonce=${nonce}worth=${worth}&image=${image}&tradeType=${tradeType}`)
    .then(perform (response) {
    console.log(response.information);
    })
    .catch(perform (error) {
    console.log(error);
    });

I hold getting an error:

{ code: '1011',
  success: false,
  time: xxx,
  message: 'NeedParam accessKey and signData' }

I’m at the moment at a loss to why I hold obtain this error.
I’m passing each the accessKey and signData in.
The half that’s fuzzy to me is the signData.

  1. Am I creating the signData correctly based mostly on the documentation?
  2. Additionally, am does order matter for the parameters which might be being handed
  3. in? Anything I’ll doubtlessly be doing flawed?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles