Binance Websocket Examples Save

Example code in Nodejs that demonstrate how to subscribe to Binance Websocket server.

Project README

Binance Websocket Examples

Local orderbook (Spot)

# Cache local orderbook and echo best price
# btcusdt by default
npm run orderbook

# or provide the trading pair
SYMBOL=bnbusdt npm run orderbook

Spot user data stream

# get user data steam
APIKEY=xxxxxx npm run user

# Get margin account update from websocket
APIKEY=xxxxxx APISECRET=xxxxx npm run margin-user

Futures user data stream

# Get user data steam on production
APIKEY=xxxxxx APISECRET=xxxxx npm run futures-user

# On testnet
APIKEY=xxxxxx APISECRET=xxxxx WSS_BASE_URL="wss://stream.binancefuture.com/" HTTP_BASE_URL="https://testnet.binancefuture.com/" npm run futures-user

Delivery Futures user data stream

# Get user data steam - defaults to production
APIKEY=xxxxxx APISECRET=xxxxx npm run delivery-futures-user

Combined streams

# Get multi pairs stream, setting the pairs in src/multi-stream-depth
npm run multi-stream

Spot trade stream delay monitoring

npm run monitor-spot-trade

Spot depth stream delay monitoring

npm run monitor-spot-depth

Futures depth stream delay monitoring

npm run monitor-futures

How to setup


npm install

# run test
npm run test

License

MIT

Open Source Agenda is not affiliated with "Binance Websocket Examples" Project. README Source: binance/binance-websocket-examples
Stars
149
Open Issues
0
Last Commit
1 month ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating