Thursday, August 17, 2023
HomeBitcoincurrencies - the way to place a bitforex api purchase order

currencies – the way to place a bitforex api purchase order


<- Advertisement ->

I’ve learn the documentation for BitForex on inserting 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(operate (response) {
    console.log(response.information);
    })
    .catch(operate (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 can be being handed
  3. in? The rest I could doubtlessly be doing flawed?
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments