|
|

This project is designed to help you make your own projects that interact with the Binance API. You can stream candlestick chart data, market depth, or use other advanced features such as setting stop losses and iceberg orders. This project seeks to have complete API coverage including WebSockets.
Futures API &
Streams •
Spot Trading API &
Streams •
Margin API •
Lending API
Examples •
Troubleshooting •
Changelog •
Support

https://t.me/nodebinanceapi
This project is powered by 
Actively maintained, typed, and safe SDK for the Binance REST APIs and Websockets. Supports ESM and CJS out of the box.
Spot, Margin, Futures and Delivery API
Demo trading support
Testnet support (deprecated)
Proxy support (REST and WS)
Customizable HTTP headers
Customizable request parameters
RSA/ECDSA support
Portfolio Margin API *soon*
Websocket handling with automatic reconnection
RecvWindow and automatic timestamps generation
Ability to call any endpoint, even if not supported directly by the library
Overridable hostnames (.us, .jp, etc)
Verbose mode to debug http requests/responses
We highly advise you to update from 0.0.X but minor adjustments might be needed.
The library was fully refactored to use a modern and typed JavaScript/Typescript version, using the built-in await/async syntax and unifying some methods' signatures.
Some important changes include the removal of callbacks as parameters of REST methods, adaptation of signatures to directly receive some important request values (symbol, orderId, ...), among others.
View Example
In some specific cases using a proxy is required, for example:
Exchange is not available in your location
You need to make a large amount of requests without getting blocked
...
This package supports the following proxy types, , and
To set a real http(s) proxy for your scripts, you need to have an access to a remote http or https proxy, so calls will be made directly to the target exchange, tunneled through your proxy server:
This property prepends an url to API requests. It might be useful for simple redirection or bypassing CORS browser restriction.
Tou can also use socks proxy with the following format:
View Response
View Response
View Response
View Response
View Response
View Response
View Response
View Response
View Response
You can use the optional API parameters for getting historical candlesticks, these are useful if you want to import data from earlier back in time.
Optional parameters: limit (max/default 500), startTime, endTime.
This function pulls existing chart data before connecting to the WebSocket, and provides you realtime synchronized chart information including the most recent 500 candles.
View Response
View Response
View Response
View Response
Example Spot account transfer to USDⓈ-M Futures account , use ENUM -> "MAIN_UMFUTURE"
for more account transfers (ENUMs) see docs
Instead of use and instead of use .
For market orders use and .
For order operations, use , , , , .
Usage and callbacks are the same as the 'regular account' counterparts.
Use instead of .
View Response
View response
View response
exchangeInfo: Pull minimum order size, quantity, etc
Clamp order quantities to required amounts via minQty, minNotional, stepSize when placing orders
Show API Rate limits
Connect to all WebSockets at once
Get last order for a symbol
newOrderRespType example
Recent Trades (historicalTrades, recentTrades, aggTrades functions)
Terminate WebSocket connections
User Data: Account Balance Updates, Trade Updates, New Orders, Filled Orders, Cancelled Orders via WebSocket
Margin User Data: Account Balance Updates, Trade Updates, New Orders, Filled Orders, Cancelled Orders via WebSocket
Asynchronous Syntax Options
Verify that your system time is correct. If you have any suggestions don't hesitate to file an issue.
Having problems? Try adding to your options or setting :
Problems getting your balance? Wrap the entry point of your application in useServerTime:
You can enable verbose mode to help with debugging WebSocket streams:


Give us a star ⭐
Fork and Clone! Awesome
Select existing issues or create a new issue and give us a PR with your bugfix or improvement after. We love it ❤️


|
|