|
Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
|
#include <market_api.hpp>
Public Member Functions | |
| MarketApi (std::shared_ptr< common::RestClient > client) | |
| common::RestApiResponse< std::vector< AggTradesResponseInner > > | agg_trades (const AggTradesParams ¶ms) const |
| Compressed/Aggregate trades list. | |
| template<class CompletionToken> | |
| auto | async_agg_trades (const AggTradesParams ¶ms, CompletionToken &&token) const |
| Asynchronous agg_trades(). | |
| common::RestApiResponse< AvgPriceResponse > | avg_price (const AvgPriceParams ¶ms) const |
| Current average price. | |
| template<class CompletionToken> | |
| auto | async_avg_price (const AvgPriceParams ¶ms, CompletionToken &&token) const |
| Asynchronous avg_price(). | |
| common::RestApiResponse< DepthResponse > | depth (const DepthParams ¶ms) const |
| Order book. | |
| template<class CompletionToken> | |
| auto | async_depth (const DepthParams ¶ms, CompletionToken &&token) const |
| Asynchronous depth(). | |
| common::RestApiResponse< std::vector< GetTradesResponseInner > > | get_trades (const GetTradesParams ¶ms) const |
| Recent trades list. | |
| template<class CompletionToken> | |
| auto | async_get_trades (const GetTradesParams ¶ms, CompletionToken &&token) const |
| Asynchronous get_trades(). | |
| common::RestApiResponse< std::vector< HistoricalBlockTradesResponseInner > > | historical_block_trades (const HistoricalBlockTradesParams ¶ms) const |
| Historical Block Trades (MARKET_DATA). | |
| template<class CompletionToken> | |
| auto | async_historical_block_trades (const HistoricalBlockTradesParams ¶ms, CompletionToken &&token) const |
| Asynchronous historical_block_trades(). | |
| common::RestApiResponse< std::vector< GetTradesResponseInner > > | historical_trades (const HistoricalTradesParams ¶ms) const |
| Old trade lookup. | |
| template<class CompletionToken> | |
| auto | async_historical_trades (const HistoricalTradesParams ¶ms, CompletionToken &&token) const |
| Asynchronous historical_trades(). | |
| common::RestApiResponse< std::vector< std::vector< KlinesItemInner > > > | klines (const KlinesParams ¶ms) const |
| Kline/Candlestick data. | |
| template<class CompletionToken> | |
| auto | async_klines (const KlinesParams ¶ms, CompletionToken &&token) const |
| Asynchronous klines(). | |
| common::RestApiResponse< ReferencePriceResponse > | reference_price (const ReferencePriceParams ¶ms) const |
| Query Reference Price. | |
| template<class CompletionToken> | |
| auto | async_reference_price (const ReferencePriceParams ¶ms, CompletionToken &&token) const |
| Asynchronous reference_price(). | |
| common::RestApiResponse< ReferencePriceCalculationResponse > | reference_price_calculation (const ReferencePriceCalculationParams ¶ms) const |
| Query Reference Price Calculation. | |
| template<class CompletionToken> | |
| auto | async_reference_price_calculation (const ReferencePriceCalculationParams ¶ms, CompletionToken &&token) const |
| Asynchronous reference_price_calculation(). | |
| common::RestApiResponse< TickerResponse > | ticker (const TickerParams ¶ms={}) const |
| Rolling window price change statistics. | |
| template<class CompletionToken> | |
| auto | async_ticker (const TickerParams ¶ms, CompletionToken &&token) const |
| Asynchronous ticker(). | |
| common::RestApiResponse< Ticker24hrResponse > | ticker24hr (const Ticker24hrParams ¶ms={}) const |
| 24hr ticker price change statistics | |
| template<class CompletionToken> | |
| auto | async_ticker24hr (const Ticker24hrParams ¶ms, CompletionToken &&token) const |
| Asynchronous ticker24hr(). | |
| common::RestApiResponse< TickerBookTickerResponse > | ticker_book_ticker (const TickerBookTickerParams ¶ms={}) const |
| Symbol order book ticker. | |
| template<class CompletionToken> | |
| auto | async_ticker_book_ticker (const TickerBookTickerParams ¶ms, CompletionToken &&token) const |
| Asynchronous ticker_book_ticker(). | |
| common::RestApiResponse< TickerPriceResponse > | ticker_price (const TickerPriceParams ¶ms={}) const |
| Symbol price ticker. | |
| template<class CompletionToken> | |
| auto | async_ticker_price (const TickerPriceParams ¶ms, CompletionToken &&token) const |
| Asynchronous ticker_price(). | |
| common::RestApiResponse< TickerTradingDayResponse > | ticker_trading_day (const TickerTradingDayParams ¶ms={}) const |
| Trading Day Ticker. | |
| template<class CompletionToken> | |
| auto | async_ticker_trading_day (const TickerTradingDayParams ¶ms, CompletionToken &&token) const |
| Asynchronous ticker_trading_day(). | |
| common::RestApiResponse< std::vector< std::vector< KlinesItemInner > > > | ui_klines (const UiKlinesParams ¶ms) const |
| UIKlines. | |
| template<class CompletionToken> | |
| auto | async_ui_klines (const UiKlinesParams ¶ms, CompletionToken &&token) const |
| Asynchronous ui_klines(). | |
|
explicit |
|
nodiscard |
Compressed/Aggregate trades list.
GET /api/v3/aggTrades.
Get compressed, aggregate trades. Trades that fill at the time, from the same taker order, with the same price will have the quantity aggregated.
Weight(IP): 4
Security Type: NONE
Notes: Data Source: Database
|
inline |
Asynchronous agg_trades().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<AggTradesResponseInner>>).
|
nodiscard |
Current average price.
GET /api/v3/avgPrice.
Current average price for a symbol.
Weight(IP): 2
Security Type: NONE
Notes: Data Source: Memory
|
inline |
Asynchronous avg_price().
Completes with void(std::exception_ptr, common::RestApiResponse<AvgPriceResponse>).
|
nodiscard |
Order book.
GET /api/v3/depth.
Order book
Weight: Adjusted based on the limit:
| Limit | Request Weight |
|---|---|
| 1-100 | 5 |
| 101-500 | 25 |
| 501-1000 | 50 |
| 1001-5000 | 250 |
| 5001-7500 | 500 |
Security Type: NONE
Notes: Data Source: Memory
See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#depth
|
inline |
Asynchronous depth().
Completes with void(std::exception_ptr, common::RestApiResponse<DepthResponse>).
|
nodiscard |
Recent trades list.
GET /api/v3/trades.
Get recent trades.
Weight(IP): 25
Security Type: NONE
Notes: Data Source: Memory
|
inline |
Asynchronous get_trades().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<GetTradesResponseInner>>).
|
nodiscard |
Historical Block Trades (MARKET_DATA).
GET /api/v3/historicalBlockTrades.
Get block trades.
Weight(IP): 25
Security Type: MARKET_DATA
Notes: Data Source: Database
|
inline |
Asynchronous historical_block_trades().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<HistoricalBlockTradesResponseInner>>).
|
nodiscard |
Old trade lookup.
GET /api/v3/historicalTrades.
Get older trades.
Weight(IP): 25
Security Type: NONE
Notes: Data Source: Database
|
inline |
Asynchronous historical_trades().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<GetTradesResponseInner>>).
|
nodiscard |
Kline/Candlestick data.
GET /api/v3/klines.
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
Weight(IP): 2
Security Type: NONE
Notes: Data Source: Database
Supported kline intervals (case-sensitive):
| Interval | interval value |
|---|---|
| seconds | 1s |
| minutes | 1m, 3m, 5m, 15m, 30m |
| hours | 1h, 2h, 4h, 6h, 8h, 12h |
| days | 1d, 3d |
| weeks | 1w |
| months | 1M |
Notes:
See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#klines
|
inline |
Asynchronous klines().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<std::vector<KlinesItemInner>>>).
|
nodiscard |
Query Reference Price.
GET /api/v3/referencePrice.
Query the reference price for a symbol.
Weight(IP): 2
Security Type: NONE
Notes: Data Source: Memory
If the symbol has never had a reference price set, the request is rejected with:
|
inline |
Asynchronous reference_price().
Completes with void(std::exception_ptr, common::RestApiResponse<ReferencePriceResponse>).
|
nodiscard |
Query Reference Price Calculation.
GET /api/v3/referencePrice/calculation.
Describes how reference price is calculated for a given symbol.
Weight(IP): 2
Security Type: NONE
Notes: Data Source: Memory
|
inline |
Asynchronous reference_price_calculation().
Completes with void(std::exception_ptr, common::RestApiResponse<ReferencePriceCalculationResponse>).
|
nodiscard |
Rolling window price change statistics.
GET /api/v3/ticker.
Note: This endpoint differs from GET /api/v3/ticker/24hr.
The statistical time range of this endpoint can be up to 59999ms longer than the requested windowSize.
openTime starts at the beginning of a minute, while the end time is the current time. Therefore, the actual interval can be up to 59999ms longer than the requested window.
For example, if closeTime is 1641287867099 (January 04, 2022 09:17:47:099 UTC) and windowSize is 1d, then openTime is 1641201420000 (January 3, 2022, 09:17:00 UTC).
Weight: 4 for each requested symbol regardless of windowSize.
The weight for this request will cap at 200 once the number of symbols in the request is more than 50.
Security Type: NONE
Notes: Data Source: Database
See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#ticker
|
inline |
Asynchronous ticker().
Completes with void(std::exception_ptr, common::RestApiResponse<TickerResponse>).
|
nodiscard |
24hr ticker price change statistics
GET /api/v3/ticker/24hr.
24 hour rolling window price change statistics. Careful when accessing this with no symbol.
Weight:
Security Type: NONE
Notes: Data Source: Memory
|
inline |
Asynchronous ticker24hr().
Completes with void(std::exception_ptr, common::RestApiResponse<Ticker24hrResponse>).
|
nodiscard |
Symbol order book ticker.
GET /api/v3/ticker/bookTicker.
Best price/qty on the order book for a symbol or symbols.
Weight: |Parameter|Symbols Provided|Weight| |—|—|—| |symbol| 1 |2| | |omitted| 4| |symbols| Any |4|
Security Type: NONE
Notes: Data Source: Memory
|
inline |
Asynchronous ticker_book_ticker().
Completes with void(std::exception_ptr, common::RestApiResponse<TickerBookTickerResponse>).
|
nodiscard |
Symbol price ticker.
GET /api/v3/ticker/price.
Latest price for a symbol or symbols.
Weight: |Parameter|Symbols Provided|Weight| |—|—|—| |symbol| 1 |2| | |omitted| 4| |symbols| Any |4|
Security Type: NONE
Notes: Data Source: Memory
|
inline |
Asynchronous ticker_price().
Completes with void(std::exception_ptr, common::RestApiResponse<TickerPriceResponse>).
|
nodiscard |
Trading Day Ticker.
GET /api/v3/ticker/tradingDay.
Price change statistics for a trading day.
Weight: 4 for each requested symbol. The weight for this request will cap at 200 once the number of symbols in the request is more than 50.
Security Type: NONE
Notes: Data Source: Database
Notes::
|
inline |
Asynchronous ticker_trading_day().
Completes with void(std::exception_ptr, common::RestApiResponse<TickerTradingDayResponse>).
|
nodiscard |
UIKlines.
GET /api/v3/uiKlines.
The request is similar to klines having the same parameters and response.
uiKlines return modified kline data, optimized for presentation of candlestick charts.
Weight(IP): 2
Security Type: NONE
Notes: Data Source: Database
|
inline |
Asynchronous ui_klines().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<std::vector<KlinesItemInner>>>).