Binance.Market (binance v2.0.1)
Market Data
Summary
Functions
Compressed/Aggregate Trades List
Current Average Price
Order Book
Exchange Information
Old Trade Lookup (MARKET_DATA)
Kline/Candlestick Data
Test Connectivity
Rolling window price change statistics
24hr Ticker Price Change Statistics
Symbol Order Book Ticker
Symbol Price Ticker
Check Server Time
Recent Trades List
Functions
get_agg_trades(symbol, opts \\ [])
@spec get_agg_trades(any(), limit: any(), endTime: any(), startTime: any(), fromId: any() ) :: {:ok, any()} | {:error, any()}
Compressed/Aggregate Trades List
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
- If
startTime
andendTime
are sent, time between startTime and endTime must be less than 1 hour. - If
fromId
,startTime
, andendTime
are not sent, the most recent aggregate trades will be returned.
Weight(IP): 1
Details:
- METHOD: get
- URL: /api/v3/aggTrades
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- fromId - Trade id to fetch from. Default gets most recent trades.
- startTime - UTC timestamp in ms
- endTime - UTC timestamp in ms
- limit - Default 500; max 1000.
get_avg_price(symbol, opts \\ [])
Current Average Price
Current average price for a symbol.
Weight(IP): 1
Details:
- METHOD: get
- URL: /api/v3/avgPrice
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
get_depth(symbol, opts \\ [])
Order Book
Limit | Weight(IP) |
---|---|
1-100 | 1 |
101-500 | 5 |
501-1000 | 10 |
1001-5000 | 50 |
Details:
- METHOD: get
- URL: /api/v3/depth
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- limit - If limit > 5000, then the response will truncate to 5000
get_exchange_info(opts \\ [])
@spec get_exchange_info(permissions: any(), symbols: any(), symbol: any()) :: {:ok, any()} | {:error, any()}
Exchange Information
Current exchange trading rules and symbol information
- If any symbol provided in either symbol or symbols do not exist, the endpoint will throw an error.
Weight(IP): 10
Details:
- METHOD: get
- URL: /api/v3/exchangeInfo
Mandatory params:
Optional params:
- symbol - Trading symbol, e.g. BNBUSDT
- symbols -
- permissions - Display symbols with the permissions matching provided parameter. (eg.SPOT, MARGIN, LEVERAGED)
get_historical_trades(symbol, opts \\ [])
Old Trade Lookup (MARKET_DATA)
Get older market trades.
Weight(IP): 5
Details:
- METHOD: get
- URL: /api/v3/historicalTrades
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- limit - Default 500; max 1000.
- fromId - Trade id to fetch from. Default gets most recent trades.
get_klines(symbol, interval, opts \\ [])
@spec get_klines(any(), any(), limit: any(), endTime: any(), startTime: any()) :: {:ok, any()} | {:error, any()}
Kline/Candlestick Data
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
- If
startTime
andendTime
are not sent, the most recent klines are returned.
Weight(IP): 1
Details:
- METHOD: get
- URL: /api/v3/klines
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
- interval - kline intervals
Optional params:
- startTime - UTC timestamp in ms
- endTime - UTC timestamp in ms
- limit - Default 500; max 1000.
get_ping(opts \\ [])
Test Connectivity
Test connectivity to the Rest API.
Weight(IP): 1
Details:
- METHOD: get
- URL: /api/v3/ping
Mandatory params:
Optional params:
get_ticker(opts \\ [])
@spec get_ticker(type: any(), windowSize: any(), symbols: any(), symbol: any()) :: {:ok, any()} | {:error, any()}
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.
Details:
- METHOD: get
- URL: /api/v3/ticker
Mandatory params:
Optional params:
- symbol - Trading symbol, e.g. BNBUSDT
- symbols - Either symbol or symbols must be provided Examples of accepted format for the symbols parameter: ["BTCUSDT","BNBUSDT"] or %5B%22BTCUSDT%22,%22BNBUSDT%22%5D.
The maximum number of symbols allowed in a request is 100.
- windowSize - Defaults to 1d if no parameter provided. Supported windowSize values: 1m,2m....59m for minutes 1h, 2h....23h - for hours 1d...7d - for days.
Units cannot be combined (e.g. 1d2h is not allowed)
- type - Supported values: FULL or MINI. If none provided, the default is FULL
get_ticker_24hr(opts \\ [])
24hr Ticker Price Change Statistics
24 hour rolling window price change statistics. Careful when accessing this with no symbol.
- If the symbol is not sent, tickers for all symbols will be returned in an array.
Weight(IP):
1
for a single symbol;40
when the symbol parameter is omitted;
Details:
- METHOD: get
- URL: /api/v3/ticker/24hr
Mandatory params:
Optional params:
- symbol - Trading symbol, e.g. BNBUSDT
- symbols -
- type - Supported values: FULL or MINI. If none provided, the default is FULL
get_ticker_book_ticker(opts \\ [])
Symbol Order Book Ticker
Best price/qty on the order book for a symbol or symbols.
- If the symbol is not sent, bookTickers for all symbols will be returned in an array.
Weight(IP):
1
for a single symbol;2
when the symbol parameter is omitted;
Details:
- METHOD: get
- URL: /api/v3/ticker/bookTicker
Mandatory params:
Optional params:
- symbol - Trading symbol, e.g. BNBUSDT
- symbols -
get_ticker_price(opts \\ [])
Symbol Price Ticker
Latest price for a symbol or symbols.
- If the symbol is not sent, prices for all symbols will be returned in an array.
Weight(IP):
1
for a single symbol;2
when the symbol parameter is omitted;
Details:
- METHOD: get
- URL: /api/v3/ticker/price
Mandatory params:
Optional params:
- symbol - Trading symbol, e.g. BNBUSDT
- symbols -
get_time(opts \\ [])
Check Server Time
Test connectivity to the Rest API and get the current server time.
Weight(IP): 1
Details:
- METHOD: get
- URL: /api/v3/time
Mandatory params:
Optional params:
get_trades(symbol, opts \\ [])
Recent Trades List
Get recent trades.
Weight(IP): 1
Details:
- METHOD: get
- URL: /api/v3/trades
Mandatory params:
- symbol - Trading symbol, e.g. BNBUSDT
Optional params:
- limit - Default 500; max 1000.
get_ui_klines(symbol, interval, opts \\ [])
@spec get_ui_klines(any(), any(), limit: any(), endTime: any(), startTime: any()) :: {:ok, any()} | {:error, any()}
UIKlines
The request is similar to klines having the same parameters and response.
uiKlines return modified kline data, optimized for presentation of candlestick charts.
Details:
- METHOD: get
- URL: /api/v3/uiKlines
Mandatory params:
- symbol -
- interval - kline intervals
Optional params:
- startTime -
- endTime -
- limit - Default 500; max 1000.