Market Endpoints
Test Connectivity
- ping(self)
Test Connectivity Test connectivity to the Rest API.
GET /api/v3/ping
Check Server Time
- time(self)
Check Server Time Test connectivity to the Rest API and get the current server time.
GET /api/v3/time
Exchange Information
- exchange_info(self, symbol: str | None = None, symbols: list | None = None, permissions: list | None = None)
Exchange Information Current exchange trading rules and symbol information
GET /api/v3/exchangeinfo
- Args:
symbol (str, optional): the trading pair symbols (list, optional): list of trading pairs permissions (list, optional): display all symbols with the permissions matching the parameter provided (eg.SPOT, MARGIN, LEVERAGED) showPermissionSets (bool, optional): Controls whether the content of the permissionSets field is populated or not. Defaults to true symbolStatus (str, optional): Filters symbols that have this tradingStatus. Valid values: TRADING, HALT, BREAK. Cannot be used in combination with symbols or symbol.
Get orderbook
- depth(self, symbol: str, **kwargs)
Get orderbook.
GET /api/v3/depth
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#order-book
- Parameters:
symbol (str) – the trading pair
- Keyword Arguments:
limit (int, optional) – limit the results. Default 100; max 5000. If limit > 5000, then the response will truncate to 5000.
Recent Trades List
- trades(self, symbol: str, **kwargs)
Recent Trades List Get recent trades (up to last 500).
GET /api/v3/trades
- Parameters:
symbol (str) – the trading pair
- Keyword Arguments:
limit (int, optional) – limit the results. Default 500; max 1000.
Old Trade Lookup
- historical_trades(self, symbol: str, **kwargs)
Old Trade Lookup Get older market trades.
GET /api/v3/historicalTrades
- Parameters:
symbol (str) – the trading pair
- Keyword Arguments:
limit (int, optional) – limit the results. Default 500; max 1000.
formId (int, optional) – trade id to fetch from. Default gets most recent trades.
Compressed/Aggregate Trades List
- agg_trades(self, symbol: str, **kwargs)
Compressed/Aggregate Trades List
GET /api/v3/aggTrades
- Parameters:
symbol (str) – the trading pair
- Keyword Arguments:
limit (int, optional) – limit the results. Default 500; max 1000.
formId (int, optional) – id to get aggregate trades from INCLUSIVE.
startTime (int, optional) – Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime (int, optional) – Timestamp in ms to get aggregate trades until INCLUSIVE.
Kline/Candlestick Data
- klines(self, symbol: str, interval: str, **kwargs)
Kline/Candlestick Data
GET /api/v3/klines
- Parameters:
symbol (str) – the trading pair
interval (str) – the interval of kline, e.g 1s, 1m, 5m, 1h, 1d, etc.
- Keyword Arguments:
limit (int, optional) – limit the results. Default 500; max 1000.
startTime (int, optional) – Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime (int, optional) – Timestamp in ms to get aggregate trades until INCLUSIVE.
timeZone (str, optional) – Default: 0 (UTC)
UIKlines
- ui_klines(self, symbol: str, interval: str, **kwargs)
Kline/Candlestick Data
GET /api/v3/uiKlines
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#uiklines
- Parameters:
symbol (str) – the trading pair
interval (str) – the interval of kline, e.g 1s, 1m, 5m, 1h, 1d, etc.
- Keyword Arguments:
limit (int, optional) – limit the results. Default 500; max 1000.
startTime (int, optional) – Timestamp in ms to get aggregate trades from INCLUSIVE.
endTime (int, optional) – Timestamp in ms to get aggregate trades until INCLUSIVE.
timeZone (str, optional) – Default: 0 (UTC)
Current Average Price
- avg_price(self, symbol: str)
Current Average Price
GET /api/v3/avgPrice
- Parameters:
symbol (str) – the trading pair
24hr Ticker Price Change Statistics
- ticker_24hr(self, symbol: str | None = None, symbols: list | None = None, **kwargs)
24hr Ticker Price Change Statistics
GET /api/v3/ticker/24hr
- Parameters:
symbol (str, optional) – the trading pair
symbols (list, optional) – list of trading pairs
Trading Day Ticker
- trading_day_ticker(self, symbol: str | None = None, symbols: list | None = None)
Trading Day Ticker
GET /api/v3/ticker/tradingDay
- Parameters:
symbol (str, optional) – Either symbol or symbols must be provided
symbols (list, optional) – list of trading pairs
- Keyword Arguments:
timeZone (str, optional) – Default: 0 (UTC)
type (str, optional) – Supported values: FULL or MINI. If none provided, the default is FULL.
Symbol Price Ticker
- ticker_price(self, symbol: str | None = None, symbols: list | None = None)
Symbol Price Ticker
GET /api/v3/ticker/price
- Parameters:
symbol (str, optional) – the trading pair
symbols (list, optional) – list of trading pairs
Symbol Order Book Ticker
- book_ticker(self, symbol: str | None = None, symbols: list | None = None)
Symbol Order Book Ticker
GET /api/v3/ticker/bookTicker
- Parameters:
symbol (str, optional) – the trading pair
symbols (list, optional) – list of trading pairs
Rolling window price change statistics
- rolling_window_ticker(self, symbol: str | None = None, symbols: list | None = None, **kwargs)
Rolling window price change statistics
The window used to compute statistics is typically slightly wider than requested windowSize.
openTime for /api/v3/ticker always starts on a minute, while the closeTime is the current time of the request. As such, the effective window might be up to 1 minute wider than requested.
E.g. If the closeTime is 1641287867099 (January 04, 2022 09:17:47:099 UTC) , and the windowSize is 1d. the openTime will be: 1641201420000 (January 3, 2022, 09:17:00 UTC)
Weight(IP): 2 for each requested symbol regardless of windowSize.
The weight for this request will cap at 100 once the number of symbols in the request is more than 50.
GET /api/v3/ticker
- Parameters:
symbol (str, optional) – the trading pair
symbols (str, optional) – : list of trading pairs. The maximum number of symbols allowed in a request is 100.
- Keyword Arguments:
windowSize (str, optional) – Defaults to 1d if no parameter provided.