Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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!
JavaScript
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: 
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.


What I have tried:

I created new APi and I changed the restriction rules.

I modified the code multiple times based on node-binance-api

I used math.floor to remove the decimal for the quantity
Posted
Updated 30-Nov-20 21:54pm
v3
Comments
BabyYoda 30-Nov-20 15:17pm    
That looks like it is a warning, not an error, right? I believe all you need to do is follow what it says to do.

1 solution

Read what the error message say: it's pretty explicit about what is wrong and even tells you exactly what you need to do to fix it, or at least catch it and start to find out why it has occured in the first place.

So start with what it says, and use the debugger / developer console to find out what exactly is throwing an error, and start looking for why.

We can't do that for you: it needs your code running and we have no access to that!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900