Stocks

get_market_status 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_trading_calendar 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_symbols 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"]


Did this page help you?