Stocks

Get Market Status

value QuoteClient::get_market_state(utility::string_t market);

Description

Get the trading status of specified markets (such as intraday, pre-market, post-market, etc.) and retrieve the latest opening time for that market.

Rate Limit

For rate limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketutility::string_tYesMarket to query

Return

list

Elements are MarketStatus objects. MarketStatus structure is as follows:

ParameterTypeDescription
marketstrMarket name
trading_statusstrTrading status code: NOT_YET_OPEN (not yet open); PRE_HOUR_TRADING (pre-market trading); TRADING (trading); POST_HOUR_TRADING (post-market trading); CLOSING (closed); EARLY_CLOSED (early close); MARKET_CLOSED (market closed)
statusstrTrading status description
open_timedatetimeLatest opening trading time with time zone information

Example Call

/* This is a sample Main.cpp used with pre-compiled openapi_cpp_test TigerAPI SDK
found under output/Windows/x64/Release_MD in https://github.com/tigerfintech/openapi-cpp-sdk.git
Get configs from Tiger's Developer Info Page: https://developer.tradeup.com/profile
download tiger_openapi_config.properties and copy it to the project's home directory
*/

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));

    /**
     * Use QuoteClient
     */
    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value result = quote_client->get_market_state("US");
    // value result = quote_client->get_market_state(U("US")); < Wide format for Vstudio
    cout << result << endl;
    // wcout << result << endl; < wide format
    return 0;
}

Example Response

[{"market":"HK","marketStatus":"Trading","openTime":"01-12 09:30:00","status":"TRADING"}]

Get Market Trading Calendar

Get the trading calendar of the selected market.

QuoteClient::get_trading_calendar(Market market, utility::string_t begin_date, utility::string_t end_date)

Description

The trading days are obtained by excluding weekends and holidays from the natural days and does not exclude temporary market closures.
Provides a calendar from 2015 onwards to the end of the current year. If it is out of range, the start and end times will be processed to be within the range of the provided data.

Rate Limit

For rate limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketutility::string_t / MarketYesMarket to query
Use the Market enum constants provided in include/tigerapi/enums.h
Refer to the enumeration parameters section for details
begin_dateutility::string_tYesbegin date of calendar, including today. format yyyy-MM-dd, like '2022-06-01'
end_dateutility::string_tYesend date of calendar, excluding today. format yyyy-MM-dd

begin_date and end_date parameters description:

begin_date providedend_date providedDate Range Result
yesyes(begin_date, end_date)
yesno(begin_date, begin_date+365)
noyes(end_date-365,end_date)

Return

list

Each element is a dict, with the following key meanings:

ParameterTypeDescription
dateutility::string_ttrade day date
typeutility::string_ttrade day type. TRADING: whole day trading; EARLY_CLOSE: close market early

Example Call

/* This is a sample Main.cpp used with pre-compiled openapi_cpp_test TigerAPI SDK
found under output/Windows/x64/Release_MD in https://github.com/tigerfintech/openapi-cpp-sdk.git
Get configs from Tiger's Developer Info Page: https://developer.tradeup.com/profile
download tiger_openapi_config.properties and copy it to the project's home directory
*/

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));


    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value result = quote_client->get_trading_calendar("US", "2023-01-01", "2023-03-01");
    // value result = quote_client->get_trading_calendar(U("US"),U("2026-06-01"),U("2026-06-10"));;
    cout << result << endl;

    return 0;
}

Example Response

[{"date":"2023-01-03","type":"TRADING"},{"date":"2023-01-04","type":"TRADING"},{"date":"2023-01-05","type":"TRADING"},{"date":"2023-01-06","type":"TRADING"},{"date":"2023-01-09","type":"TRADING"},{"date":"2023-01-10","type":"TRADING"},{"date":"2023-01-11","type":"TRADING"},{"date":"2023-01-12","type":"TRADING"},{"date":"2023-01-13","type":"TRADING"},{"date":"2023-01-17","type":"TRADING"},{"date":"2023-01-18","type":"TRADING"},{"date":"2023-01-19","type":"TRADING"},{"date":"2023-01-20","type":"TRADING"},{"date":"2023-01-23","type":"TRADING"},{"date":"2023-01-24","type":"TRADING"},{"date":"2023-01-25","type":"TRADING"},{"date":"2023-01-26","type":"TRADING"},{"date":"2023-01-27","type":"TRADING"},{"date":"2023-01-30","type":"TRADING"},{"date":"2023-01-31","type":"TRADING"},{"date":"2023-02-01","type":"TRADING"},{"date":"2023-02-02","type":"TRADING"},{"date":"2023-02-03","type":"TRADING"},{"date":"2023-02-06","type":"TRADING"},{"date":"2023-02-07","type":"TRADING"},{"date":"2023-02-08","type":"TRADING"},{"date":"2023-02-09","type":"TRADING"},{"date":"2023-02-10","type":"TRADING"},{"date":"2023-02-13","type":"TRADING"},{"date":"2023-02-14","type":"TRADING"},{"date":"2023-02-15","type":"TRADING"},{"date":"2023-02-16","type":"TRADING"},{"date":"2023-02-17","type":"TRADING"},{"date":"2023-02-21","type":"TRADING"},{"date":"2023-02-22","type":"TRADING"},{"date":"2023-02-23","type":"TRADING"},{"date":"2023-02-24","type":"TRADING"},{"date":"2023-02-27","type":"TRADING"},{"date":"2023-02-28","type":"TRADING"}]

Get All Symbols

value get_symbols(Market market=Market::ALL, bool include_otc=false);

Description

Get ticker symbols of all securities of the selected market, including delisted stocks or stocks that are not available for trading.

Rate Limit

For rate limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketMarketNofilter by market, you can use the enums defined in include/tigerapi/enums.h, such as Market.US
default: Market::ALL
include_otcboolNoif True include OTC stocks,
default: False

Response

Type

list

Elements are symbols of all securities in the market, including delisted and non-tradable symbols. Codes starting with . are indices, e.g., .DJI represents the Dow Jones Index.

Example Call

/* This is a sample Main.cpp used with pre-compiled openapi_cpp_test TigerAPI SDK
found under output/Windows/x64/Release_MD in https://github.com/tigerfintech/openapi-cpp-sdk.git
Get configs from Tiger's Developer Info Page: https://developer.tradeup.com/profile
download tiger_openapi_config.properties and copy it to the project's home directory
*/

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value result = quote_client->get_symbols();
    cout << result << endl;

    return 0;
}

Example Response

"ZCMD","ZD","ZDGE","ZEAL","ZECP","ZEN","ZENV","ZEPP","ZEST","ZETA","ZEUS","ZEV","ZG","ZH","ZHDG","ZI","ZIG","ZIM","ZINGU","ZION","ZIONL","ZIONO","ZIONP","ZIP","ZIVO","ZKIN","ZLAB","ZM","ZNH","ZNTEU","ZNTL","ZOM","ZROZ","ZS","ZSB","ZSL","ZT","ZTAQU","ZTO","ZTR","ZTS","ZUMZ","ZUO","ZVIA","ZWS","ZY","ZYME","ZYNE","ZYXI"]

Get Symbols and Names

value get_all_symbol_names(Market market = Market::ALL, bool include_otc=false);
value get_all_symbol_names(utility::string_t market = U("ALL"), bool include_otc=false);

Description

Get the ticker symbols and names of all securities in the selected market

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketMarket / utility::string_tNofilter by market, you can use the enums defined in include/tigerapi/enums.h, such as Market::US
default: Market::ALL
include_otcboolNoFalse by default, if True, includes OTC stocks

Response

list

Each object in the list is a tuple. The first element of the tuple is the symbol and the second element is the name

ParameterTypeRequiredDescription
symbolstringYessymbol
namestringYesname

Example Call

Note: "get_symbol_names()" call does not exist in C++ SDK compilation.

/* This is a sample Main.cpp used with pre-compiled openapi_cpp_test TigerAPI SDK
found under output/Windows/x64/Release_MD in https://github.com/tigerfintech/openapi-cpp-sdk.git
Get configs from Tiger's Developer Info Page: https://developer.tradeup.com/profile
download tiger_openapi_config.properties and copy it to the project's home directory
*/

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    // For C++ version use get_all_symbol_names(Market::your_market)
    value result = quote_client->get_symbol_names(Market::HK);
    cout << result << endl;

    return 0;
}

Example Response

[{"name":"XXX HOLDINGS","symbol":"00001"},{"name":"YYY HOLDINGS","symbol":"00002"},
{"name":"DCBA GAS","symbol":"00003"},{"name":"ZZZ HOLDINGS","symbol":"00004"},
{"name":"WWW HOLDINGS","symbol":"00005"}]

Get Intraday Data for the Latest Trading Day

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

Description

Get the latest timeline data, which contains one-minute price data of the stock. This method will only return data from last trading day, use get_bars method to inqury

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist<str...>YesSymbols of stocks, with a maximum of 50 per request. Example: ['ABCD', 'XY']
include_hour_tradingboolNoWhether data after regular trading hours is included
default: false
begin_timetime_tNoThe beginning time of the first data point, Use timestamp Format: 1639386000000
default: -1

Response

Structured as follows:

ParameterTypeDescription
symbolstringTicker symbol of asset. such as ABCD
timeintTimestamp. Example: 1639386000000
pricefloatclose price of current one-minute bar
avg_pricefloatvolume weighted average price
pre_closefloatclose price of last trading day
volumeintvolume of current one-minute bar
trading_sessionstrPossible values are: "pre_market", "regular" and "after_hours"

Example Call

/* This is a sample Main.cpp used with pre-compiled openapi_cpp_test TigerAPI SDK
found under output/Windows/x64/Release_MD in https://github.com/tigerfintech/openapi-cpp-sdk.git
Get configs from Tiger's Developer Info Page: https://developer.tradeup.com/profile
download tiger_openapi_config.properties and copy it to the project's home directory
*/

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("ABCD");
    symbols[1] = value::string("XY");
    /* Windows VS version
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
    */
    value result = quote_client->get_timeline(symbols);
    cout << result << endl;

    return 0;
}

Get Historical Intraday Data

value get_history_timeline(const value &symbols, utility::string_t date, QuoteRight right=QuoteRight::br);

Description

Get historical time-share data for a certain date

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist<str...>Yessecurity code list, Up to 50 passes at a time, e.g. ['ABCD', 'XY']
datestringYestimeline date. e.g. '2022-04-14'
rightQuoteRightNoquote right, refer to: include/tigerapi/enums.h
default: QuoteRight::br

Response

Structured as follows:

ParameterTypeDescription
symbolstringsecurity code, e.g. ABCD
timeintmillisecond timestamp, e.g. 1639386000000
pricefloatcurrent minute closing price
avg_pricefloatvolume-weighted average price to the current time

Example Call

/* This is a sample Main.cpp used with pre-compiled openapi_cpp_test TigerAPI SDK
found under output/Windows/x64/Release_MD in https://github.com/tigerfintech/openapi-cpp-sdk.git
Get configs from Tiger's Developer Info Page: https://developer.tradeup.com/profile
download tiger_openapi_config.properties and copy it to the project's home directory
*/

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("ABCD");
    symbols[1] = value::string("XY");
    value result = quote_client->get_history_timeline(symbols, "2026-06-26");
    // VS version: value result = quote_client->get_history_timeline(symbols, U("2026-06-26"));
    cout << result << endl;

    return 0;
}

Example Response

[{"items":[{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673361000000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673361060000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673361120000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673361180000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673361240000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673364660000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673364720000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673364780000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673364840000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673364900000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673364960000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365020000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365080000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365140000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365200000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365260000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365320000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365380000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365440000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365500000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365560000,"volume":0},{"avgPrice":130.15000000000001,"price":130.15000000000001,"time":1673365620000,"volume":0},{"avgPrice":63.130000000000003,"price":63.130000000000003,"time":1673384220000,"volume":0},{"avgPrice":63.130000000000003,"price":63.130000000000003,"time":1673384280000,"volume":0},{"avgPrice":63.662365000000001,"price":63.649999999999999,"time":1673384340000,"volume":230124}],"symbol":"XY"}]

Get Tick-by-Tick Trade Data

value get_trade_tick(const value &symbols, TradingSession trade_session=TradingSession::Regular, long begin_index=-1,
                             long end_index=-1, int limit=100);
value get_trade_tick(const value &symbols, long begin_index=-1,
                             long end_index=-1, utility::string_t trade_session=U("Regular"), int limit=100);

Description

To obtain transaction data by transaction, this interface can support the query of the full transaction record of the current trading day after the market closes, and can also support the query of the latest real-time transaction record in the market.

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist<str...>YesTicker symbol of a list of stocks, single request max support: 50
trade_sessioninclude/tigerapi/enums.h TradingSessionNoTrade session,PreMarket/Regular/AfterHours
default: TradingSession::Regular
begin_indexintNoStart index, the index value of the current day starts from 0. If begin_index and end_index are set to -1, the latest item-by-item data of Response will be displayed. In subsequent queries, the end_index value of the last query Response can be used as begin_index to perform continuous queries , Response data is a collection of front-close and back-open, for example: begin_index=1, end_index=100, it will record the Response from 1 to 99, and set begin_index=100, end_index=200 in the next query.
default: -1
end_indexintNoEnd index, The difference between the end index and the start index cannot be greater than 2000, and when it is greater than 2000, the default response is 200 records from the start index. When the limitArgument is smaller than the difference between the start and end indexes, only the limit item-by-item data starting from the start index will be returned.
default: -1
limitintNoResponse number limit, maximum limit: 2000
default: 100

begin_index, end_index arguments description

query typebegin_indexend_indexdescription
query latest data-1-1limit default value 200
query by sectionindex numberindex numberfor example: begin_index=10, end_index=100 ,Returns 90 rows containing 10 to 99. If limit is set to 20, 20 records from 10 to 29 will be returned.

Response

Structured as follows:

ParameterTypeDescription
symbolutility::string_tSymbol of security
beginIndexintStart time index
endIndexintEnd time index
itemslistlist of TradeTickItems

TradeTickItem Structure

ParameterTypeDescription
timeinttimestamp in milliseconds
volumeintvolume
pricedoubleprice
typestringdirection of the price change, "+" stands for "active buy", "-" stands for "active sell", "*" stands for "neutral transaction"

Example Call

/* This is a sample Main.cpp used with pre-compiled openapi_cpp_test TigerAPI SDK
found under output/Windows/x64/Release_MD in https://github.com/tigerfintech/openapi-cpp-sdk.git
Get configs from Tiger's Developer Info Page: https://developer.tradeup.com/profile
download tiger_openapi_config.properties and copy it to the project's home directory
*/

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>

using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("01810");
    value result = quote_client->get_trade_tick(symbols);
    /*If above doesn't work modify as follows.
    Specify makket
    symbols[0] = value::string(U("US.01810"));
    Fix overload error
    value result = quote_client->get_trade_tick(symbols, 10, (time_t)-1);
    */
    cout << result << endl;
    //wcout << result << endl; On VS Windows
    return 0;
}

Example Response

[{"symbol":"01810","beginIndex":99437,"endIndex":99637,"items":[{"time":1741852234015,"volume":200,"price":52.9,"type":"+"},
{"time":1741852236040,"volume":200,"price":52.9,"type":"+"},{"time":1741852236720,"volume":400,"price":52.85,"type":"-"},
{"time":1741852237436,"volume":200,"price":52.9,"type":"+"},{"time":1741852237436,"volume":200,"price":52.9,"type":"+"}...

Get Real-time Quotes

value get_quote_real_time(const value &symbols);

Description

Get real-time data for a stock/stocks. An active market quote permission is required.

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist<str...>YesSymbols of stocks, with a maximum of 50 per request. Example: ['ABCD', 'XY']

Response

ParameterTypeDescription
symbolstrTicker symbol of a specific stock
ask_pricefloatAsk price
ask_sizeintAsk size
bid_pricefloatBid price
bid_sizeintBid size
pre_closefloatClose price of the last trading day
latest_pricefloatLatest price
latest_timeintTime when last trade is made. Unix timestamp, example: 1547516984730
volumeintVolume
openfloatOpening price
highfloatHigh price
lowfloatLow price
statusstrTrading status

Possible trading statuses:

  • "UNKNOWN"
  • "NORMAL"
  • "HALTED"
  • "DELIST"
  • "NEW"
  • "ALTER"

Example Call

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
   
    value symbols = value::array();
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
    // value result = quote_client->get_quote_real_time(symbols);
    //vector function required for json output here
    std::vector<RealtimeQuote> result = quote_client->get_quote_real_time(symbols);
    
    // wcout << result.serialize() << endl; 
    // multiple symbols output requires itterator
    for (const auto& q : result) {
        wcout << L"Symbol: " << q.symbol << endl;
    }


    return 0;
}

Example Response

{"adjPreClose":216.97999999999999,"askPrice":215.78,"askSize":200,"bidPrice":215.44999999999999,"bidSize":200,
"close":216.97999999999999,"high":221.75,"latestPrice":216.97999999999999,"latestTime":1741809600000,"low":214.91,
"open":220.13999999999999,"preClose":220.84,"status":"NORMAL","symbol":"ABCD","volume":62547467}

Get Delayed Stock Quotes

value get_quote_delay(const value &symbols);

Description

Get delayed market data for U.S. stocks. An active market data permission subscription is not required. This data is only available for U.S stocks. The data is delayed by 15 minutes

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist<str...>YesA list of ticker symbols, only U.Ss makret is supported. Example: ['ABCD', 'XY']

Response

Structured as follows:

ParameterTypeDescription
symbolstrTicker symbol of the stock
pre_closefloatclose price of last trading day
timeintLast update time, format: UNIX timestamp. Example: 1639429200000
volumeintVolume
openfloatOpening price
highfloatHigh Price
lowfloatLow price
closefloatClose price
haltedfloatStatus of the stock (0: Normal 3: Halt 4: Delisted 7: New 8: Alter)

Example Call

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));


    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("ABCD");
    symbols[1] = value::string("XY");
    /* For VS windows comment two lines above and uncomment two lines below
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
   */
    value result = quote_client->get_quote_delay(symbols);
    cout << result << endl;

    return 0;
}

Example Response

[{"close":130.72999999999999,"halted":0,"high":131.2636,"low":128.12,"open":130.25999999999999,"preClose":130.15000000000001,"symbol":"ABCD","time":1673384400000,"volume":63896155},{"close":63.649999999999999,"halted":0,"high":64.620000000000005,"low":62.950000000000003,"open":64.099999999999994,"preClose":63.130000000000003,"symbol":"XY","time":1673384400000,"volume":5537959}]

Get K-Line Data

value 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 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> 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(""));

Description

Get the K-line data of a specified stock. Currently, this interface supports obtaining K-line data in units of days, weeks, months, years, minutes, 5 minutes, 15 minutes, 30 minutes, and 60 minutes. Considering the performance and stability of the interface, the maximum number of requests for this interface is 1200. For users who need more historical data for analysis or backtesting, it can be requested via the get_bars_by_page method. You can also implement the loop yourself to obtain historical data with a longer time range through multiple requests.
Please note that there may be restrictions on the length of K-lines that can be requested.

Rate Limit

Please refer to: API Request Limits

Paramaters

ParameterTypeRequiredDescription
symbolslist<str...>YesA list of symbols. Maximum 50 per request, example: ['ABCD', 'XY']
period/include/tigerapi/enums.h BarPeriodNoK-line period 'day'/'week'/'month'/...
default: BarPeriod::DAY
begin_timetime_tNoBegin time. Unix time stamp in millisecond or a date string. Example: 1639371600000 / '2019-06-07 23:00:00' / '2019-06-07'
default: -1
end_timetime_tNoEnd time. Unix time stamp in millisecond or a date string. Example: 1639371600000 / '2019-06-07 23:00:00' / '2019-06-07'
default: -1
right/include/tigerapi/enums.h QuoteRightNoAdjustment type. Use enums defined in include/tigerapi/enums.h Example: QuoteRight.BR-forward adjust. QuoteRight.NR-No adjustment
default: QuoteRight::br
limitintNoThe maximum number of bars returned
default: 251
page_tokenstringNoPagination token, records the position of pagination. The next_page_token returned from the previous request can be passed as the starting marker for the next request
default: U("")

Response

Structured as follows:

ParameterTypeDescription
timeintTimestamp. Example: 1639371600000
openfloatOpening price of a bar
closefloatClosing price of a bar
highfloatHigh price of a bar
lowfloatlow price of a bar
volumefloatVolume of a bar
amountfloatamount of a bar

Example Call

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));


    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("ABCD");
    symbols[1] = value::string("XY");
    /* For VS windows comment two lines above and uncomment two lines below
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
   */
    value result = quote_client->get_kline(symbols);
    cout << result << endl;

    return 0;
}

Example Response

[
    {
        "items": [
            {
                "close": 139.5,
                "high": 141.43000000000001,
                "low": 137.49000000000001,
                "open": 140.41,
                "time": 1667883600000,
                "volume": 89908477
            },
            {
                "close": 134.87,
                "high": 138.55000000000001,
                "low": 134.5933,
                "open": 138.5,
                "time": 1667970000000,
                "volume": 74917794
            },
            {
                "close": 146.87,
                "high": 146.87,
                "low": 139.5,
                "open": 141.24000000000001,
                "time": 1668056400000,
                "volume": 118854028
            },
            {
                "close": 149.69999999999999,
                "high": 150.00999999999999,
                "low": 144.37,
                "open": 145.81999999999999,
                "time": 1668142800000,
                "volume": 93979665
            },
            {
                "close": 148.28,
                "high": 150.28,
                "low": 147.43000000000001,
                "open": 148.97,
                "time": 1668402000000,
                "volume": 73374114
            }
        ],
        "period": "day",
        "symbol": "ABCD"
    },
    {
        "items": [
            {
                "close": 45.490000000000002,
                "high": 45.840000000000003,
                "low": 43.950099999999999,
                "open": 45,
                "time": 1667883600000,
                "volume": 9351285
            },
            {
                "close": 42.460000000000001,
                "high": 43.600000000000001,
                "low": 42.195,
                "open": 43.435000000000002,
                "time": 1667970000000,
                "volume": 9533906
            },
            {
                "close": 46.030000000000001,
                "high": 46.93,
                "low": 45.229999999999997,
                "open": 45.390000000000001,
                "time": 1668056400000,
                "volume": 11965986
            },
            {
                "close": 48.93,
                "high": 50.549999999999997,
                "low": 48.530000000000001,
                "open": 49.469999999999999,
                "time": 1668142800000,
                "volume": 12951770
            },
            {
                "close": 50.850000000000001,
                "high": 52.020000000000003,
                "low": 50.119999999999997,
                "open": 50.939999999999998,
                "time": 1668402000000,
                "volume": 12662512
            }
        ],
        "period": "day",
        "symbol": "XY"
    }
]

Get Depth Quotes

⚠️

Account should be enabled for Level 2 for this call to work

value QuoteClient::get_quote_depth(const value &symbols, Market market = Market::US)

Description

Get market depth quote, including price, quantity and number of orders. The request limit is 50 symbols per request

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist<str...>YesA list of stock ticker symbols, maximum number is 50
marketMarketNoMarket being quoted
default: Market::US

Response

Asks and Bids (order price, order quantity, order count)

Example Call

#include "tigerapi/quote_client.h"
#include <memory>
using namespace web;
using namespace web::json;
using namespace TIGER_API;



int main(int argc, char* argv[]) {
    ClientConfig config(true, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
    value result = quote_client->get_quote_depth(symbols);
    ucout << result << endl;

    return 0;
}

Example Response

  #for a single symbol:
  {'symbol': '02833',
    'asks': [(27.4, 300, 2), (27.45, 500, 1), (27.5, 4400, 1), (27.55, 0, 0), (27.6, 5700, 3), (27.65, 0, 0),
            (27.7, 500, 1), (27.75, 0, 0), (27.8, 0, 0), (27.85, 0, 0)],
    'bids': [(27, 4000, 3), (26.95, 200, 1), (26.9, 0, 0), (26.85, 400, 1), (26.8, 0, 0), (26.75, 0, 0),
            (26.7, 0, 0), (26.65, 0, 0), (26.6, 0, 0), (26.55, 0, 0)]
  }

  #for a list of symbols:
  {'02833':
      {'symbol': '02833',
        'asks': [(27.35, 200, 1), (27.4, 2100, 2), (27.45, 500, 1), (27.5, 4400, 1), (27.55, 0, 0),
                (27.6, 5700, 3), (27.65, 0, 0), (27.7, 500, 1), (27.75, 0, 0), (27.8, 0, 0)],
        'bids': [(27.05, 100, 1), (27, 5000, 4), (26.95, 200, 1), (26.9, 0, 0), (26.85, 400, 1), (26.8, 0, 0),
              (26.75, 0, 0), (26.7, 0, 0), (26.65, 0, 0), (26.6, 0, 0)]
      },
  '02828':
      {'symbol': '02828',
        'asks': [(106.6, 6800, 7), (106.7, 110200, 10), (106.8, 64400, 8), (106.9, 80600, 8), (107, 9440, 16),
              (107.1, 31800, 5), (107.2, 11800, 4), (107.3, 9800, 2), (107.4, 9400, 1), (107.5, 21000, 9)],
        'bids': [(106.5, 62800, 17), (106.4, 68200, 9), (106.3, 78400, 6), (106.2, 52400, 4), (106.1, 3060, 4),
                (106, 33400, 4), (105.9, 29600, 3), (105.8, 9600, 2), (105.7, 15200, 2), (105.6, 0, 0)]}
      }

Get Stock Trading Information

QuoteClient::get_quote_stock_trade(const value &symbols)

Description

Obtain the information needed for stock trading, such as the number of shares per lot.
Please not that the number of shares placed in Hong Kong stocks must be an integral multiple of the number of shares per lot.

Rate Limit

Please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist<str...>Yessymbol list, per request max support: 50

Response

ColumnTypeDescription
symbolstrsymbol
lot_sizeintlot size
min_tickfloatThe smallest unit of price change
spread_scalefloatspread scale

Example Call

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));


    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("ABCD");
    symbols[1] = value::string("XY");
    /* For VS windows comment two lines above and uncomment two lines below
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
   */
    value result = quote_client->get_quote_stock_trade(symbols);
    cout << result << endl;
    // wcout << result << endl; < For VS

    return 0;
}

Example Response

[{"lotSize":1,"minTick":0.01,"spreadScale":1,"symbol":"ABCD"},{"lotSize":1,"minTick":0.01,"spreadScale":1,"symbol":"XY"}]

Get Stock Capital Flow Data

value QuoteClient::get_capital_flow(utility::string_t symbol, Market market = Market::US, CapitalPeriod period = CapitalPeriod::DAY); value QuoteClient::get_capital_flow(utility::string_t symbol, utility::string_t market, utility::string_t period = U("day"));

Description

Obtain the net inflow data of stock funds, including the real-time minute data of the latest trading day, and the net inflow data of different periods. For different time granularities, it supports obtaining data in units of day, week, month, quarter, half year, and year. The maximum limit is 1200, and the default is 200.

Parameters

ParameterTypeRequiredDescription
symbolutility::string_tYessymbol
marketMarketNoUS-U.S. Stocks,
default: Market::US
periodCapitalPeriodNoperiod, possible values are: intraday, day, week, month, year, quarter, 6month
default: CapitalPeriod::DAY)

Response

ParameterTypeDescription
symbolutility::string_tstock symbol
periodutility::string_tperiod type
timeutility::string_ttime string,real-time format is "11-25 12:48:00 EST",non real-time format is "2022-11-22"
timestampinttimestamp in millisecond
net_inflowfloatnet inflow, negative means outflow

Example Call

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));


    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("ABCD");
    symbols[1] = value::string("XY");
    /* For VS windows comment two lines above and uncomment two lines below
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
    */
    value result = quote_client->get_capital_flow("ABCD");
    cout << result << endl;
    // value result = quote_client->get_capital_flow(U("ABCD"));
    // wcout << result << endl; These two lines for VS on Windows
    return 0;
}

Example Response

{"items":[{"netInflow":66792509.8979,"time":"01-10 09:30:00 EST","timestamp":1673361000000},{"netInflow":68356370.344899997,"time":"01-10 09:31:00 EST","timestamp":1673361060000},
  {"netInflow":70886790.490799993,"time":"01-10 09:32:00 EST","timestamp":1673361120000},{"netInflow":73072909.183300003,"time":"01-10 09:33:00 EST","timestamp":1673361180000},
  {"netInflow":18778097.630399998,"time":"01-10 15:45:00 EST","timestamp":1673383500000},{"netInflow":17920771.363000002,"time":"01-10 15:46:00 EST","timestamp":1673383560000},
  {"netInflow":16638279.7092,"time":"01-10 15:47:00 EST","timestamp":1673383620000},{"netInflow":16618314.0484,"time":"01-10 15:48:00 EST","timestamp":1673383680000},
  {"netInflow":16369111.518200001,"time":"01-10 15:49:00 EST","timestamp":1673383740000},{"netInflow":24502314.359200001,"time":"01-10 15:50:00 EST","timestamp":1673383800000},
  {"netInflow":25853726.0222,"time":"01-10 15:51:00 EST","timestamp":1673383860000},{"netInflow":22492884.448399998,"time":"01-10 15:52:00 EST","timestamp":1673383920000},
  {"netInflow":23272406.638500001,"time":"01-10 15:53:00 EST","timestamp":1673383980000},{"netInflow":22988058.011999998,"time":"01-10 15:54:00 EST","timestamp":1673384040000},
  {"netInflow":28326520.442699999,"time":"01-10 15:55:00 EST","timestamp":1673384100000},{"netInflow":24328584.693300001,"time":"01-10 15:56:00 EST","timestamp":1673384160000},
  {"netInflow":29597845.616900001,"time":"01-10 15:57:00 EST","timestamp":1673384220000},{"netInflow":27514469.558699999,"time":"01-10 15:58:00 EST","timestamp":1673384280000},
  {"netInflow":35487493.496799998,"time":"01-10 15:59:00 EST","timestamp":1673384340000}],"period":"intraday","symbol":"ABCD"}

Get Stock Capital Distribution

value get_capital_distribution(utility::string_t symbol, Market market = Market::US);;

Description

Get capital distribution.

Parameters

ParameterTypeRequiredDescription
symbolstring_tYesstock symbol
marketMarketNoUS-U.S.Stocks,
default: Market::US

Response

NameTypeDescription
symbolstringsymbol
net_inflowdoublenet inflow(inAll - outAll)
in_alldoubleall inflow(inBig + inMid + inSmall)
in_bigdoublebig orders's inflow
in_middoublemedian orders's inflow
in_smalldoublesmall orders's inflow
out_alldoubleall outflow(outBig + outMid + outSmall)
out_bigdoublebig orders's outflow
out_middoublemedian orders's outflow
out_smalldoublesmall orders's outflow

Example Call

#include "tigerapi/quote_client.h"
#include "tigerapi/trade_client.h"
#include <iostream>
#include <memory>using namespace std;
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* args[]) {
    
    ClientConfig config(false, U("tiger_openapi_config.properties"));


    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value symbols = value::array();
    symbols[0] = value::string("ABCD");
    symbols[1] = value::string("XY");
    /* For VS windows comment two lines above and uncomment two lines below
    symbols[0] = value::string(U("ABCD"));
    symbols[1] = value::string(U("XY"));
    */
    value result = quote_client->get_capital_distribution("ABCD");
    cout << result << endl;
    // value result = quote_client->get_capital_distribution(U("ABCD"));
    // wcout << result << endl; These two lines for VS on Windows

    return 0;
}

Example Response

{"inAll":3333362528.4099998,"inBig":577964736.26520014,"inMid":273636829.47490007,"inSmall":2481760962.6747251,
  "netInflow":35487493.5,"outAll":3297875034.9200001,"outBig":483301755.98959994,"outMid":292564622.11769968,"outSmall":2522008656.8106923,"symbol":"ABCD"}

Get Stock Broker Information

value get_stock_broker(utility::string_t symbol, int limit=40);

Description

Get Hong Kong stock broker information.

Parameters

ParameterTypeRequiredDescription
symbolstringYesstock symbol
limitintegerNoThe maximum number of points returned.
default: 40, Maximum is 60

Response

NameTypeDescription
ask_brokerLevelBrokerLevelBroker
bid_brokerLevelBrokerLevelBroker
symbolstrstock symbol

LevelBroker:

NameTypeDescription
brokerBrokerlist of Broker
broker_countintegerthe count of brokers
levelintegerprice level
pricedoubleprice

Broker:

NameTypeDescription
idstrbroker id
namestrbroker name

Example Call

⚠️

QA NOTE:

get_stock_broker - demo SDK only supports HK brokers. Returns <Exception: api error, response: {"code":null}> even if ran with legit HK symbol.

#include "tigerapi/quote_client.h"
#include <memory>
using namespace web;
using namespace web::json;
using namespace TIGER_API;

int main(int argc, char* argv[]) {
    ClientConfig config(true, U("tiger_openapi_config.properties"));

    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value result = quote_client->get_stock_broker(U("00700"));
    ucout << result << endl;

    return 0;

}

Did this page help you?