Cryptocurrency
HTTP Quote Availability
HTTP cryptocurrency market data supports bars and the current-day timeline. These queries reuse get_kline() and get_timeline() with SecType::CC; use symbols such as BTC.USD. Historical cryptocurrency timelines are not supported.
For cryptocurrency streaming data, see subscribe_cc() in Market Data Streaming. HTTP symbol lists and real-time quote snapshots are outside the scope of this page.
Cryptocurrency Bars
value QuoteClient::get_kline(
const value &symbols, BarPeriod period, time_t begin_time, time_t end_time,
QuoteRight right, int limit, utility::string_t page_token, SecType sec_type)
vector<Kline> QuoteClient::get_kline(
const value &symbols, utility::string_t period, time_t begin_time, time_t end_time,
int limit, utility::string_t right, utility::string_t page_token, SecType sec_type)Pass SecType::CC to query cryptocurrency bars. Both the raw JSON and vector<Kline> overloads accept this parameter. Overloads that accept TradingSession also accept a final SecType argument. Existing overloads without SecType remain available.
The SDK sends page_token together with SecType::CC, so subsequent page requests remain cryptocurrency queries. Read nextPageToken from the response and pass it as page_token on the next call.
KlineItem.volume_decimal is a boost::optional<double> mapped from JSON volumeDecimal, preserving fractional cryptocurrency volume. It has no value when the field is absent or null; use the integer volume field in that case.
Example
value symbols = value::array();
symbols[0] = value::string(U("BTC.USD"));
vector<Kline> klines = quote_client.get_kline(
symbols, U("day"), -1, -1, 251, U("br"), U(""), SecType::CC);
for (const auto &kline : klines) {
for (const auto &item : kline.items) {
if (item.volume_decimal) {
std::cout << *item.volume_decimal << std::endl;
}
}
}Cryptocurrency Timeline
value QuoteClient::get_timeline(const value &symbols, bool include_hour_trading, time_t begin_time, SecType sec_type)
Pass SecType::CC to query the current-day cryptocurrency timeline. This method returns a raw web::json::value; fractional volume in each timeline point is available as the JSON field volumeDecimal. This support does not apply to get_history_timeline().
Example
value symbols = value::array();
symbols[0] = value::string(U("BTC.USD"));
value result = quote_client.get_timeline(symbols, false, -1, SecType::CC);
ucout << result.serialize() << std::endl;Example timeline point:
{"time": 1785441000000, "price": 118432.25, "avgPrice": 118401.72, "volume": 12, "volumeDecimal": 12.3456}Updated about 1 month ago
