How to get the BNBUSD exchange info using Node js?

Hello,

Could you please help me how to get the BNBUSD exchange info using Node js?

I have the API url (https://api.binance.com/api/v1/ticker/24hr?symbol=BNBUSD)
I tried to use fetch function but it seem that fetch doesn’t work with node js.

Thanks,

  1. There’re plenty of information in the internet to do http GET; axios’d be a good choice
  2. You can also use some SDK to do that. For e.g. - https://github.com/jaggedsoft/node-binance-api; It’s 3rd party and you take all the risk of using it
  3. And there’s no such pair ‘BNBUSD’. What you want should be BNBUSDT

Thank you MJW, your comments are always helpful. I corrected the BNBUSDT but I still getting an error.

You mentioned to node-binance-api, that’s what I am using right now, could you explain, which function can I use to bring me exchange info?

I also 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!

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.

Pure NodeJS issue; Replied in the other thread;
And you should use binance.marketBuy() instead of buy()

Wonderful, I searched to the Pure NodeJS I couldn’t find it, Could you send me the thread link. Thanks!

You mean you didn’t find the function for calling https://api.binance.com/api/v1/ticker/24hr?
Try prevDay()