Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Market data endpoints are public: no API key needed. Trading and account endpoints are signed and not in this entry.
- Rate limits are per IP and counted in request weight (each endpoint lists its weight); usage comes back in X-MBX-USED-WEIGHT-* headers. A 429 means back off for Retry-After seconds; ignoring 429s gets the IP banned (418), from 2 minutes up to 3 days.
- Symbols are concatenated pairs with no separator, upper case: BTCUSDT, ETHBTC.
- A ‘symbols’ parameter is a JSON array string, e.g. [“BTCUSDT”,“BNBBTC”]; at most 100 symbols. Do not combine symbol and symbols.
- Times are milliseconds since the epoch, UTC. Prices and quantities come back as strings.
Endpoints
Get latest symbol prices
- Weight 2 with symbol, 4 with symbols or none (all symbols).
Get 24-hour ticker statistics
- Weight 2 for 1-20 symbols, 40 for 21-100, 80 for more or for no symbol parameter (all symbols).
Get best bid and ask
- Weight 2 with symbol, 4 otherwise.
Get candlesticks
- Weight 2. Each candle is an array of values, not an object.
Get order book
- Weight grows with limit: 5 (1-100), 25 (101-500), 50 (501-1000), 250 (1001-5000).
Get recent trades
- Weight 25.
Get current average price
- Weight 2.
Get exchange and symbol info
- Weight 20. With no parameters the response covers every symbol and is large.