<p>I don't believe you can"t use the $() syntax to concatanate strings in node.</p>

<pre><code>var message = `https://api.bitforex.com/api/v1/trade/placeOrder?accessKey=   ${accessKey} &lt;--  &amp;amount=  ${amount} &lt;-- &amp;nonce=${nonce} and beyond[...]`
</code></pre>

<p>you can simply do 
<code>message = "/api/blahblah" + accessKey</code></p>

<p>You obviously did this multiple times.  If the issue is something different I will return to the question but this seems simple.</p>

CC BY-SA 4.0
2019-04-04T14:46:16.913Z
unfortunately, that is not it. ES6 syntax allows template literals. If you console log message, you'll see it is a proper string, I created following the documentation.

My main concern is, is what I'm doing correct based on the documentation.
adbarads
CC BY-SA 4.0
2019-04-04T07:41:55.113Z
2019-04-04T07:41:55.113Z
Mike Danger Borghi
<p>I have read the documentation for BitForex on placing a buy order here:
<a href="https://github.com/bitforexapi/API_Doc_en/wiki/Order" rel="nofollow noreferrer">https://github.com/bitforexapi/API_Doc_en/wiki/Order</a></p>

<p>Then after understanding that, I read the API Call Description documentation:
<a href="https://github.com/bitforexapi/API_Doc_en/wiki/API-Call-Description" rel="nofollow noreferrer">https://github.com/bitforexapi/API_Doc_en/wiki/API-Call-Description</a></p>

<p>Here is what I have in my code:</p>

<pre><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}&amp;amount=${amount}&amp;nonce=${nonce}price=${price}&amp;symbol=${symbol}&amp;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}&amp;amount=${amount}&amp;nonce=${nonce}price=${price}&amp;symbol=${symbol}&amp;tradeType=${tradeType}`)
    .then(function (response) {
    console.log(response.data);
    })
    .catch(function (error) {
    console.log(error);
    });
</code></pre>

<p>I keep getting an error:</p>

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

<p>I am currently at a loss to why I keep receive this error.
I am passing both the <code>accessKey</code> and <code>signData</code> in.
The part that is fuzzy to me is the <code>signData</code>.</p>

<ol>
<li>Am I creating the <code>signData</code> properly based on the documentation?</li>
<li>Also, am does order matter for the parameters that are being passed</li>
<li>in? Anything else I may potentially be doing wrong?</li>
</ol>

<api><currencies><cryptography><javascript>
how to place a bitforex api buy order
adbarads
# how to place a bitforex api buy order

(Asked by: username_0 on 2019-04-04)

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`.

1. Am I creating the `signData` properly based on the documentation?
2. Also, am does order matter for the parameters that are being passed
3. in? Anything else I may potentially be doing wrong?

**Tags:** api, currencies, cryptography, javascript


---

## 1 answers

### Answer by username_1 on 2019-04-04. Score: 0

I don't believe you can"t use the $() syntax to concatanate strings in node.

```
var message = `https://api.bitforex.com/api/v1/trade/placeOrder?accessKey=   ${accessKey} <--  &amount=  ${amount} <-- &nonce=${nonce} and beyond[...]`

```

you can simply do
`message = "/api/blahblah" + accessKey`

You obviously did this multiple times. If the issue is something different I will return to the question but this seems simple.

> **Comments:**
> **username_0**: unfortunately, that is not it. ES6 syntax allows template literals. If you console log message, you'll see it is a proper string, I created following the documentation.  My main concern is, is what I'm doing correct based on the documentation.  

---

