Cryptocurrency

get_symbols Get All Symbol List

value QuoteClient::get_symbols(utility::string_t sec_type)

Description

Get the list of all cryptocurrency symbol codes.

Rate Limit

Please refer to: API Rate Limits

Parameters

ParameterTypeRequiredDescription
sec_typeutility::string_tYesFixed as U("CC")

Return

web::json::value JSON object

Example

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

using namespace TIGER_API;

ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);

value result = quote_client.get_symbols(U("CC"));
ucout << result.serialize() << std::endl;

Return Example

['APT.USD', 'IOTX.USD', 'USDT.USD', 'DYDX.USD', 'DOGE.USD', 'KAIA.USD', 'ATOM.USD', 'COMP.USD', 'UNI.USD', 'AAVE.USD', 'LDO.USD', 'LINK.USD', 'SNX.USD', 'OP.USD', 'DOT.USD', 'POL.USD', 'BTC.USD', 'SOL.USD', 'ARB.USD', 'TON.USD', 'AVAX.USD', 'MKR.USD', 'IMX.USD', 'ETH.USD', 'LTC.USD']

get_cc_briefs Get Real-time Quote

value QuoteClient::get_cc_briefs(const value &symbols, utility::string_t sec_type, utility::string_t lang)

Description

Get cryptocurrency real-time quotes.

Rate Limit

Please refer to: API Rate Limits

Parameters

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array, max 50, e.g., value::array({value::string(U("BTC")), value::string(U("ETH"))})
sec_typeutility::string_tYesFixed as U("CC")
langutility::string_tNoSupported language, e.g., U("zh_CN"), default English

Return

web::json::value JSON object

Structure:

ColumnTypeDescription
symbolstrSecurity code
pre_closefloatPrevious close price
latest_pricefloatLatest price
latest_timeintLatest trade time, millisecond timestamp
volume_decimalfloatVolume
openfloatOpen price
highfloatHigh price
lowfloatLow price
changedoublePrice change
changeRatedoubleChange rate

Example

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

using namespace TIGER_API;

ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);

value symbols = value::array();
symbols[0] = value::string(U("BTC"));
symbols[1] = value::string(U("ETH"));

value result = quote_client.get_cc_briefs(symbols, U("CC"));
ucout << result.serialize() << std::endl;

Return Example

  symbol      open     high       low     close  pre_close  latest_price    latest_time      \
0    BTC  71127.62  72200.0  69955.91  70932.55   71061.02      70932.55  1770608250067    \
1    ETH   2107.21   2148.9   2054.05   2089.56    2106.26       2089.56  1770608250068   \

 change  change_rate  volume_decimal
-128.47    -0.001808       135.82381
 -16.70    -0.007929      2815.58590

get_bars Get K-line Data

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)

Description

Get cryptocurrency K-line data, including 1min, 60min, day, week, and month levels. Each request returns up to 1200 records. It is recommended to use looping calls to retrieve longer time range historical data for optimal API performance and stability. The API supports querying by date range or specific date.

Minute-level K-lines: BTC supports data starting from March 27, 2024 Daily K-lines and above (day/week/month/year): BTC supports data starting from July 13, 2010

Rate Limit

Please refer to: API Rate Limits

Parameters

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array, max 50 per request, e.g., value::array({value::string(U("ETH"))})
periodBarPeriod or utility::string_tNoK-line period. Default BarPeriod::DAY, available values: day/week/month/year/1min/3min/5min/10min/15min/30min/60min
begin_timetime_tNoStart time for range query, recommend using timestamp to avoid timezone issues, default -1
end_timetime_tNoEnd time for range query, default -1
rightQuoteRight or utility::string_tNoAdjustment type, default QuoteRight::br or U("br")
limitintNoNumber of records limit. Default 251, max 1200
page_tokenutility::string_tNoPagination token, default empty

Return

web::json::value JSON object

Structure:

ParameterTypeDescription
timeintMillisecond timestamp, e.g., 1639371600000
openfloatBar open price
closefloatBar close price
highfloatBar high price
lowfloatBar low price
volume_decimalfloatBar volume

Example

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

using namespace TIGER_API;

ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);

value symbols = value::array();
symbols[0] = value::string(U("ETH"));

value result = quote_client.get_kline(symbols, BarPeriod::DAY);
ucout << result.serialize() << std::endl;

Return Example

  symbol      open    close     high      low         volume_decimal           time
0    ETH   2107.21  2082.07  2148.90  2054.05             4408.5683  1770566400000
1    ETH   2052.48  2106.26  2143.31  2007.04            11426.7385  1770480000000
2    ETH   1980.74  2049.89  2118.52  1971.49            17089.0071  1770393600000
3    ETH   1957.51  1980.75  2014.57  1747.67            26795.9965  1770307200000
4    ETH   2148.31  1957.20  2189.48  1922.60            31535.3994  1770220800000


get_timeline Get Latest Trading Day Intraday Data

value QuoteClient::get_timeline(const value &symbols, bool include_hour_trading, time_t begin_time)

Description

Get the intraday data for the latest trading day. Intraday data is similar to minute K-lines, generating one record per minute. Only supports querying the latest trading day data.

Rate Limit

Please refer to: API Rate Limits

Parameters

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array, max 10 per request
include_hour_tradingboolNoWhether to include pre/post market data, default false
begin_timetime_tNoStart time for intraday data, supports millisecond-level timestamp, e.g., 1639386000000, defaults to current day data, default -1

Return

web::json::value JSON object

Structure:

ColumnTypeDescription
symbolstrSecurity code, e.g., AAPL
timeintMillisecond-precision timestamp, e.g., 1639386000000
pricefloatClose price of the current minute
avg_pricefloatVolume-weighted average price up to current time
volume_decimalintVolume for this minute

Example

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

using namespace TIGER_API;

ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);

value symbols = value::array();
symbols[0] = value::string(U("ETH"));

value result = quote_client.get_timeline(symbols);
ucout << result.serialize() << std::endl;

Return Example

    symbol  pre_close trade_session           time    price     volume_decimal
0      ETH    2106.26       Regular  1770566400000  2106.19             0.1676
1      ETH    2106.26       Regular  1770566460000  2104.82            55.0534
2      ETH    2106.26       Regular  1770566520000  2110.71             1.7288
3      ETH    2106.26       Regular  1770566580000  2111.03             0.9551
4      ETH    2106.26       Regular  1770566640000  2112.00             1.1343
5