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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array, e.g., value::array({value::string(U("AAPL"))})
include_hour_tradingboolNoWhether to include pre/post market data, default false
include_ask_bidboolNoWhether to include ask/bid data, default false
rightQuoteRightNoAdjustment 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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array
langutility::string_tNoLanguage, e.g., U("zh_CN"), default empty
sec_typeutility::string_tNoSecurity 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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array
include_hour_tradingboolNoWhether to include pre/post market data, default false
begin_timetime_tNoStart 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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array
dateutility::string_tYesDate, format "yyyy-MM-dd", e.g., U("2024-01-15")
rightQuoteRightNoAdjustment 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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array
periodBarPeriod or utility::string_tNoK-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_timetime_tNoStart timestamp (milliseconds), default -1
end_timetime_tNoEnd timestamp (milliseconds), default -1
rightQuoteRight or utility::string_tNoAdjustment type, default QuoteRight::br or U("br")
limitintNoMaximum number of records to return, default 251
page_tokenutility::string_tNoPagination token, default empty

Return

web::json::value JSON object, or vector<Kline> Kline object list (using the corresponding overloaded version)

Kline Object Properties

PropertyTypeDescription
symbolutility::string_tSymbol code
periodutility::string_tK-line period
itemsvector<KlineItem>K-line data list

KlineItem Object Properties

PropertyTypeDescription
opendoubleOpen price
highdoubleHigh price
lowdoubleLow price
closedoubleClose price
volumelong longVolume
timetime_tTimestamp

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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array

Return

vector<RealtimeQuote> Real-time quote object list

RealtimeQuote Object Properties

PropertyTypeDescription
symbolutility::string_tSymbol code
opendoubleOpen price
highdoubleHigh price
lowdoubleLow price
closedoubleClose price
pre_closedoublePrevious close price
latest_pricedoubleLatest price
latest_timetime_tLatest trade time
volumelong longVolume
ask_pricedoubleAsk price
ask_sizedoubleAsk size
bid_pricedoubleBid price
bid_sizedoubleBid size
statusutility::string_tMarket 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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array
trade_sessionTradingSession or utility::string_tNoTrading session, default TradingSession::Regular
begin_indexlongNoStart index, default -1
end_indexlongNoEnd index, default -1
limitintNoMaximum 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

ParameterTypeRequiredDescription
symbolsvalueYesSymbol code array
marketMarketNoMarket, 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

ParameterTypeRequiredDescription
symbolutility::string_tYesHK stock code, e.g., U("00700")
limitintNoNumber of records to return, default 40
langutility::string_tNoLanguage, default empty
sec_typeutility::string_tNoSecurity 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

ParameterTypeRequiredDescription
symbolutility::string_tYesSymbol code
marketMarketNoMarket, default Market::US
langutility::string_tNoLanguage, 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

ParameterTypeRequiredDescription
symbolutility::string_tYesSymbol code
marketMarket or utility::string_tNoMarket, default Market::US
periodCapitalPeriod or utility::string_tNoPeriod, default CapitalPeriod::DAY. Available values: intraday/day/week/month/year/quarter/6month
begin_timetime_tNoStart timestamp, default -1
end_timetime_tNoEnd timestamp, default -1
limitintNoNumber 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;

What’s Next