Market Endpoints

Test Connectivity

ping(self)

Test Connectivity Test connectivity to the Rest API.

GET /api/v3/ping

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#test-connectivity

Check Server Time

time(self)

Check Server Time Test connectivity to the Rest API and get the current server time.

GET /api/v3/time

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#check-server-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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints#exchange-information

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#recent-trades-list

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#old-trade-lookup

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#compressedaggregate-trades-list

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#klinecandlestick-data

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#current-average-price

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#24hr-ticker-price-change-statistics

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#trading-day-ticker

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#symbol-price-ticker

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#symbol-order-book-ticker

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

https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints#rolling-window-price-change-statistics

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.