I am getting node:17200 error when I am trying to place market order using node-binance-api?

I am getting mysterious error when I try to place a market order using node-binance-api by using the following function, any suggestion is greatly appreciated!

const Binance = require(’…/node-binance-api’);
const binance = new Binance().options({
APIKEY: ‘------’,
APISECRET: ‘----------’,
useServerTime: true

binance.buy(“BNBUSDT”, 0.3, 0, “MARKET”)

the error I am getting is:
(node:17200) UnhandledPromiseRejectionWarning: #
(node:17200) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

binance.buy().then(resp => console.log(resp))

And it should be binance.marketBuy(“BNBBTC”, quantity) if you want to place a market order

Thank you for your response. I tried both methods you have mentioned in your comment as showing below, I am still getting the same error. Any suggestion? Thank you so much!

let quantity = 1, price = 0.069;


//binance.buy().then(resp => console.log(resp))

//binance.marketBuy(“BNBBTC”, quantity)

I didn’t give the exact code…

Try below for a market order

binance.marketBuy(“BNBUSDT”, quantity). then(resp => console.log(resp))

And if you’re not familiar with nodeJS, don’t suggest you start real trading with its code

I tried the code you posted and now I am getting node:14868 error. I searched, I concluded that the issue should related with the code because node js error message is just indicator that there is an error in the code. I don’t have another alternative to replace node js. I have been working on this code for at least three months. I learned js and now I am comfortable using it. Do you know a group or threat might help me,

there is an example on node-binance-api to place an order. Do you have any idea how to adapt it to solve my problem ? Thank you so much

You also need to add a catch function as reject solution:

binance.marketBuy(‘BTCUSDT’,0.0006).then(resp => console.log(resp)).catch(err => console.log(err))

I suggest you get more familiar with JS regarding stuff like promise before using this SDK

I will thank you buddy!

Now after using the .catch… the one you suggested, I stop receving the node js error. However, now I started to see a response as shown in the attached pic. I snipped shot only part of the message because it too long

is this message mean anything to you?

Not sure how you got them; It should be like below if you do it right:

symbol: ‘BTCUSDT’,
orderId: XXXX,
orderListId: -1,
clientOrderId: ‘XXXX’,
transactTime: 1606829674507,
price: ‘0.00000000’,
origQty: ‘0.00060000’,
executedQty: ‘0.00060000’,
cummulativeQuoteQty: ‘11.20099200’,
status: ‘FILLED’,
timeInForce: ‘GTC’,
type: ‘MARKET’,
side: ‘BUY’,
fills: [
price: ‘18668.32000000’,
qty: ‘0.00060000’,
commission: ‘0.00028108’,
commissionAsset: ‘BNB’,
tradeId: XXXX

MJW: I really appreciate your help and time!

I am not sure how I can solve this issue. Can you help me and I will pay money for you efforts?

I think I know why you got that error msg;
Please update the code to be like this:
binance.marketBuy(<your trading pair>,<your quantity>).then(resp => console.log(resp)).catch(err => console.log(err.body))


1 Like

It works… Thank you so much!

I want to learn more about this issue, is there a specific resources I can use to learn more about this issues?

Thanks you again!

No easy way to learn it…
My suggestion is

  1. (Most important) read API doc to understand the API usage - https://binance-docs.github.io/apidocs/spot/en/#change-log
  2. Practice nodeJS skills
  3. Read source code here - https://github.com/jaggedsoft/node-binance-api/blob/master/node-binance-api.js

Great thank you so much!!!

After graduation, applying for any Katsina State Teachers Recruitment will be the first option you have before committing to your plans, and here we will teach you how to apply for any federal government job of your choice, so here we will teach you everything you need to know.
Ondo State School of Nursing Past Questions