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
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | const value& | Yes | JSON string array with complete symbols such as BTC.USD |
| period | BarPeriod / utility::string_t | No | SDK default is daily; the server validates string values |
| begin_time / end_time | time_t | No | Time range; SDK default -1 omits the value |
| right | QuoteRight / utility::string_t | No | SDK default is br; adjustment does not apply to cryptocurrency |
| limit | int | No | SDK default 251; server maximum applies |
| page_token | utility::string_t | No | Next-page cursor; SDK default is empty |
The overloads do not share one parameter order: the two
valueoverloads takerightbeforelimit, while thevector<Kline>overload takeslimitbeforeright. This matches the SDK headerquote_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)
| Field | Type | Description |
|---|---|---|
| symbol | utility::string_t | Symbol |
| contract_code | utility::string_t | Contract code when applicable |
| period | utility::string_t | Bar period |
| items | vector of KlineItem | Bar item list |
| expiry | time_t | Expiry when applicable |
| right | utility::string_t | Option right when applicable |
| strike | utility::string_t | Strike 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | const value& | Yes | JSON string array |
| include_hour_trading | bool | No | SDK default false; cryptocurrency trades continuously, so this generally does not change the session |
| begin_time | time_t | No | Start 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.
Updated 8 days ago
