Common

About 2 min

QuoteClient(const ClientConfig &cf, bool is_grab_permission = true);

grab_quote_permission Grab Quote Permission

QuoteClient::grab_quote_permission()

Description

"Grab quote permission", the purpose of this function is that: When a single tiger id is shared by multiple devices, only the primary device can receive the quote information. As a result, every time you switch to another device, and wish to receive quote information on this device, you must call this function to set it as your primary device. You do not need to call this function if you are not switching between multiple devices. The returned value of this function is a Python dictionary, which contains all your current quote subscriptions.

Argmuments

N/A

Response

The dictionary has the following fields:

KEYVALUE
nameName of the quote permission subscription
expire_atExpiration time (-1 means never expire)

Example

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

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


int main(int argc, char *args[]) {
    /************************** set config **********************/
    ClientConfig config = ClientConfig(true);

    config.private_key = "-----BEGIN RSA PRIVATE KEY-----\n"
                         "xxxxxx private key xxxxxxxx"
                         "-----END RSA PRIVATE KEY-----";
    config.tiger_id = "Tiger ID";
    config.account = "Account ID";


    /**
     * Use QuoteClient
     */
    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value result = quote_client->grab_quote_permission();
    cout << result << endl;

    return 0;
}

Response Example

[{'name': 'usStockQuote', 'expire_at': 1698767999000}, {'name': 'usStockQuoteLv2Arca', 'expire_at': 1698767999000}, {'name': 'usStockQuoteLv2Totalview', 'expire_at': 1698767999000}, {'name': 'hkStockQuoteLv2', 'expire_at': 1698767999000}, {'name': 'usOptionQuote', 'expire_at': 1698767999000}]

get_quote_permission Query Current Quote Subscription

QuoteClient::get_quote_permission()

Description Use this function to query all your current quote permissions subscriptions.

Arguments

N/A

Return

Same as grab_quote_permission

Example

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

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


int main(int argc, char *args[]) {
    /************************** set config **********************/
    ClientConfig config = ClientConfig(true);

    config.private_key = "-----BEGIN RSA PRIVATE KEY-----\n"
                         "xxxxxx private key xxxxxxxx"
                         "-----END RSA PRIVATE KEY-----";
    config.tiger_id = "Tiger ID";
    config.account = "Account ID";


    /**
     * Use QuoteClient
     */
    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value result = quote_client->get_quote_permission();
    cout << result << endl;

    return 0;
}

Response Example

[{"expireAt":1704177094000,"name":"HKEXFuturesQuoteLv2"},
{"expireAt":1698997529000,"name":"SGXFuturesQuoteLv2"},{"expireAt":1675158055000,"name":"COMEXFuturesQuoteLv2"},
{"expireAt":1704177094000,"name":"HKEXDerivativeQuoteLv2"},{"expireAt":1688716533000,"name":"COMEXFuturesQuoteLv1"},
{"expireAt":4000000000000,"name":"usStockQuoteLv2Arca"},{"expireAt":1746080241000,"name":"OSEFuturesQuoteLv2"},
{"expireAt":4002592000000,"name":"usStockQuoteLv2Totalview"},{"expireAt":1932709961000,"name":"NYMEXFuturesQuoteLv2"},
{"expireAt":-1,"name":"hkStockQuoteLv2"},{"expireAt":4133951999000,"name":"usOptionQuote"},
{"expireAt":2003052655000,"name":"usQuoteBasic"},{"expireAt":1704177094000,"name":"hkOptionQuoteLv2"}]

get_kline_quota

Get historical kline quota details
value get_kline_quota(bool with_details = false);

Description

Query the number of symbols used and remaining according to the level of this user, including stocks, futures, options corresponding to the stock (different options of the same stock, only occupy a symbol)

**Parameters

ParameterTypeRequired or notDescription
with_detailsboolNoWhether to return the details of the requested symbol, default is no

** Returns a ** list.

list. Each of these is as follows

fieldstypedescription
remainintnumber used
usedintRemaining quantity
methodstrapi interface (kline: stock kline; future_kline: futures kline; option_kline: option kline; history_timeline: stock history time frame
detailsvaluedetails of used underlying

example

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

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


int main(int argc, char *args[]) {
    /************************** set config **********************/
    ClientConfig config = ClientConfig();

    config.private_key = "xxxxxx your private key string xxxxxxxx";
    config.tiger_id = "your tiger id";
    config.account = "your account";


    /**
     * 使用封装后的行情接口 QuoteClient
     */
    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
    value result = quote_client->get_kline_quota();
    cout << result << endl;

    return 0;
}

Response example

[{"remain": 2, "used": 18, "method": "kline", "details": ["AAPL", "FB"]}, 
{"remain": 10, "used": 0, "method": "future_kline", "details": []},
 {"remain": 20, "used": 0, "method": "option_kline", "details": []}, 
 {"remain": 20, "used": 0, "method": "history_timeline", "details": []}]
Last update: