Cryptocurrency

Response Example

{
  "code": 0,
  "message": "success",
  "timestamp": 1785528000000,
  "data": ["A", "AA", "AAL", "AAPL", "ABBV", "ABC", "ABNB"]
}

Get Cryptocurrency Bars

value QuoteClient::get_kline(const value &symbols, BarPeriod period = BarPeriod::DAY, time_t begin_time = -1, time_t end_time = -1, QuoteRight right = QuoteRight::br, int limit = 251, utility::string_t page_token = U(""))
value QuoteClient::get_kline(const value &symbols, utility::string_t period, time_t begin_time = -1, time_t end_time = -1, utility::string_t right = U("br"), int limit = 251, utility::string_t page_token = U(""))
vector<Kline> QuoteClient::get_kline(const value &symbols, utility::string_t period, time_t begin_time = -1, time_t end_time = -1, int limit = 251, utility::string_t right = U("br"), utility::string_t page_token = U(""))

Parameters

ParameterTypeRequiredDescription
symbolsconst value&YesJSON string array with complete symbols such as BTC.USD
periodBarPeriod / utility::string_tNoSDK default is daily; the server validates string values
begin_time / end_timetime_tNoTime range; SDK default -1 omits the value
rightQuoteRight / utility::string_tNoSDK default is br; adjustment does not apply to cryptocurrency
limitintNoSDK default 251; server maximum applies
page_tokenutility::string_tNoNext-page cursor; SDK default is empty
⚠️

The overloads do not share one parameter order: the two value overloads take right before limit, while the vector<Kline> overload takes limit before right. This matches the SDK header quote_client.h; when passing arguments positionally, check the signature of the specific overload above.

Return

web::json::value or vector<Kline>, containing time, open, high, low, close, and volume fields.

Example

#include "tigerapi/client_config.h"
#include "tigerapi/quote_client.h"

int main() {
    TIGER_API::ClientConfig config(false, U("your_config_directory_path"));
    TIGER_API::QuoteClient client(config);
    web::json::value symbols = web::json::value::array();
    symbols[0] = web::json::value::string(U("BTC.USD"));
    auto bars = client.get_kline(symbols, TIGER_API::BarPeriod::DAY);
    utility::ucout << bars.serialize() << std::endl;
}

Model shape (from Kline/KlineItem in model.h)

FieldTypeDescription
symbolutility::string_tSymbol
contract_codeutility::string_tContract code when applicable
periodutility::string_tBar period
itemsvector of KlineItemBar item list
expirytime_tExpiry when applicable
rightutility::string_tOption right when applicable
strikeutility::string_tStrike when applicable

Header-defined KlineItem fields are open, high, low, close (double), time, last_time (time_t), volume, open_interest (long long), and settlement (double). Source: include/tigerapi/model.h. No synthetic market values are shown.

Response Example

{
  "code": 0,
  "message": "success",
  "timestamp": 1785528000000,
  "data": [
    {
      "symbol": "AAPL",
      "period": "day",
      "nextPageToken": null,
      "items": [
        {"time": 1785355200000, "open": 310.50, "high": 315.20, "low": 308.00, "close": 312.45, "volume": 58234100, "amount": 18156789012.50},
        {"time": 1785441600000, "open": 312.00, "high": 314.80, "low": 300.00, "close": 308.91, "volume": 176739024, "amount": 53821456789.00}
      ]
    }
  ]
}

Get Cryptocurrency Timeline

value QuoteClient::get_timeline(const value &symbols, bool include_hour_trading = false, time_t begin_time = -1)

Parameters

ParameterTypeRequiredDescription
symbolsconst value&YesJSON string array
include_hour_tradingboolNoSDK default false; cryptocurrency trades continuously, so this generally does not change the session
begin_timetime_tNoStart timestamp; SDK default -1

Return

web::json::value; key fields include symbol, time, price, and volume.

Example

web::json::value symbols = web::json::value::array();
symbols[0] = web::json::value::string(U("ETH.USD"));
auto timeline = client.get_timeline(symbols);

Response provenance

This overload returns unmodeled web::json::value. The SDK repository has no verified cryptocurrency timeline fixture, so no synthetic market values are shown.

Permissions and Limits

Cryptocurrency market-data permission is required. The server controls history ranges, pagination, and request frequency. See API Rate Limits.


Did this page help you?