I am trying to use the binance module fot Node (node-binance-api) but I can’t.
I get this error message:
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: 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(). The promise rejected with the reason “#”.] {
code: ‘ERR_UNHANDLED_REJECTION’
}
The code I did is quity simple:
var axios = require(“axios”);
const Binance = require(‘node-binance-api’);
const binance = new Binance().options({
APIKEY: ‘xxxxxxxxxxxxxxxxxxxxxxxxxx’,
APISECRET: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxx’
});
async function process()
{
let quantity = 0.001, price = 17500;
binance.buy(“BTCUSDT”, quantity, price);
}
process()
Any suggestion to solve it?
Appreciate the help.