Stock Quote
get_brief Get Stock Quote Snapshot
value QuoteClient::get_brief(const value &symbols, bool include_hour_trading, bool include_ask_bid, QuoteRight right)
Description
Get real-time stock quote snapshot, including latest price, open, high, low, etc.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array, e.g., value::array({value::string(U("AAPL"))}) |
| include_hour_trading | bool | No | Whether to include pre/post market data, default false |
| include_ask_bid | bool | No | Whether to include ask/bid data, default false |
| right | QuoteRight | No | Adjustment type, QuoteRight::br (forward adjusted) or QuoteRight::nr (unadjusted), default br |
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 symbols = value::array();
symbols[0] = value::string(U("AAPL"));
symbols[1] = value::string(U("TSLA"));
value result = quote_client.get_brief(symbols);
ucout << result.serialize() << std::endl;get_stock_detail Get Stock Detail
value QuoteClient::get_stock_detail(const value &symbols, utility::string_t lang, utility::string_t sec_type)
Description
Get detailed stock information
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array |
| lang | utility::string_t | No | Language, e.g., U("zh_CN"), default empty |
| sec_type | utility::string_t | No | Security type, default empty |
Return
web::json::value JSON object
Example
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value symbols = value::array();
symbols[0] = value::string(U("AAPL"));
value result = quote_client.get_stock_detail(symbols);
ucout << result.serialize() << std::endl;get_timeline Get Intraday Data
value QuoteClient::get_timeline(const value &symbols, bool include_hour_trading, time_t begin_time)
Description
Get intraday (timeline) data for the current day
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array |
| include_hour_trading | bool | No | Whether to include pre/post market data, default false |
| begin_time | time_t | No | Start timestamp (milliseconds), default -1 |
Return
web::json::value JSON object
Example
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value symbols = value::array();
symbols[0] = value::string(U("AAPL"));
value result = quote_client.get_timeline(symbols);
ucout << result.serialize() << std::endl;get_history_timeline Get Historical Intraday Data
value QuoteClient::get_history_timeline(const value &symbols, utility::string_t date, QuoteRight right)
Description
Get historical intraday data for a specified date
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array |
| date | utility::string_t | Yes | Date, format "yyyy-MM-dd", e.g., U("2024-01-15") |
| right | QuoteRight | No | Adjustment type, default QuoteRight::br |
Return
web::json::value JSON object
get_kline 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 stock K-line data, supporting daily, weekly, monthly, and minute-level K-lines
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array |
| period | BarPeriod or utility::string_t | No | K-line period, e.g., BarPeriod::DAY or U("day"), default DAY. Available values: day/week/month/year/1min/3min/5min/10min/15min/30min/60min |
| begin_time | time_t | No | Start timestamp (milliseconds), default -1 |
| end_time | time_t | No | End timestamp (milliseconds), default -1 |
| right | QuoteRight or utility::string_t | No | Adjustment type, default QuoteRight::br or U("br") |
| limit | int | No | Maximum number of records to return, default 251 |
| page_token | utility::string_t | No | Pagination token, default empty |
Return
web::json::value JSON object, or vector<Kline> Kline object list (using the corresponding overloaded version)
Kline Object Properties
| Property | Type | Description |
|---|---|---|
| symbol | utility::string_t | Symbol code |
| period | utility::string_t | K-line period |
| items | vector<KlineItem> | K-line data list |
KlineItem Object Properties
| Property | Type | Description |
|---|---|---|
| open | double | Open price |
| high | double | High price |
| low | double | Low price |
| close | double | Close price |
| volume | long long | Volume |
| time | time_t | Timestamp |
Example
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value symbols = value::array();
symbols[0] = value::string(U("AAPL"));
// Get daily K-line (returns JSON)
value result = quote_client.get_kline(symbols, BarPeriod::DAY);
ucout << result.serialize() << std::endl;
// Get daily K-line (returns Kline object list)
vector<Kline> klines = quote_client.get_kline(symbols, U("day"));
for (auto& kline : klines) {
for (auto& item : kline.items) {
std::cout << "Time: " << item.time << " Close: " << item.close << std::endl;
}
}get_quote_real_time Get Real-time Quote
vector<RealtimeQuote> QuoteClient::get_quote_real_time(const value &symbols)
Description
Get real-time stock quote data, returns a list of RealtimeQuote objects
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array |
Return
vector<RealtimeQuote> Real-time quote object list
RealtimeQuote Object Properties
| Property | Type | Description |
|---|---|---|
| symbol | utility::string_t | Symbol code |
| open | double | Open price |
| high | double | High price |
| low | double | Low price |
| close | double | Close price |
| pre_close | double | Previous close price |
| latest_price | double | Latest price |
| latest_time | time_t | Latest trade time |
| volume | long long | Volume |
| ask_price | double | Ask price |
| ask_size | double | Ask size |
| bid_price | double | Bid price |
| bid_size | double | Bid size |
| status | utility::string_t | Market status |
Example
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value symbols = value::array();
symbols[0] = value::string(U("AAPL"));
symbols[1] = value::string(U("TSLA"));
vector<RealtimeQuote> quotes = quote_client.get_quote_real_time(symbols);
for (auto& q : quotes) {
ucout << q.symbol << U(" latest_price: ") << q.latest_price << std::endl;
}get_trade_tick Get Trade Ticks
value QuoteClient::get_trade_tick(const value &symbols, TradingSession trade_session, long begin_index, long end_index, int limit)
Description
Get tick-by-tick trade data for stocks
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array |
| trade_session | TradingSession or utility::string_t | No | Trading session, default TradingSession::Regular |
| begin_index | long | No | Start index, default -1 |
| end_index | long | No | End index, default -1 |
| limit | int | No | Maximum number of records, default 100 |
Return
web::json::value JSON object
Example
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value symbols = value::array();
symbols[0] = value::string(U("AAPL"));
value result = quote_client.get_trade_tick(symbols);
ucout << result.serialize() << std::endl;get_quote_depth Get Quote Depth
value QuoteClient::get_quote_depth(const value &symbols, Market market)
Description
Get stock depth quote (order book)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | value | Yes | Symbol code array |
| market | Market | No | Market, default Market::US |
Return
web::json::value JSON object
Example
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value symbols = value::array();
symbols[0] = value::string(U("AAPL"));
value result = quote_client.get_quote_depth(symbols, Market::US);
ucout << result.serialize() << std::endl;get_stock_broker Get Stock Broker Seats
value QuoteClient::get_stock_broker(utility::string_t symbol, int limit, utility::string_t lang, utility::string_t sec_type)
Description
Get HK stock broker trading seat data
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | utility::string_t | Yes | HK stock code, e.g., U("00700") |
| limit | int | No | Number of records to return, default 40 |
| lang | utility::string_t | No | Language, default empty |
| sec_type | utility::string_t | No | Security type, default empty |
Return
web::json::value JSON object
get_capital_distribution Get Capital Distribution
value QuoteClient::get_capital_distribution(utility::string_t symbol, Market market, utility::string_t lang)
Description
Get stock capital distribution data
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | utility::string_t | Yes | Symbol code |
| market | Market | No | Market, default Market::US |
| lang | utility::string_t | No | Language, default empty |
Return
web::json::value JSON object
get_capital_flow Get Capital Flow
value QuoteClient::get_capital_flow(utility::string_t symbol, Market market, CapitalPeriod period, time_t begin_time, time_t end_time, int limit)
Description
Get stock capital flow data
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | utility::string_t | Yes | Symbol code |
| market | Market or utility::string_t | No | Market, default Market::US |
| period | CapitalPeriod or utility::string_t | No | Period, default CapitalPeriod::DAY. Available values: intraday/day/week/month/year/quarter/6month |
| begin_time | time_t | No | Start timestamp, default -1 |
| end_time | time_t | No | End timestamp, default -1 |
| limit | int | No | Number of records, default 200 |
Return
web::json::value JSON object
Example
ClientConfig config(false, U("/path/to/your/properties/"));
QuoteClient quote_client(config);
value result = quote_client.get_capital_flow(U("AAPL"), Market::US, CapitalPeriod::DAY);
ucout << result.serialize() << std::endl;Updated 1 day ago
