Options

About 4 min

get_option_expirations Get Options Expiration Date

value QuoteClient::get_option_expirations(const value &symbols)

Description

Get the Expiration date for option

Rate Limit

Refer to Rate Limit

Parameters

ParameterTypeRequiredDescription
symbolslist<string>YesList of symbols of the underlying assets

Response

FieldTypeDescription
countintNumber of expirations
dateslist<string>Expiration dates of the option. Date String formatted as "YYYY-MM-DD"
optionSymbolslist<string>option symbols
periodTagslist<string>Option period label, "m" is the monthly option, "w" is the weekly option
symbolstringstock symbol
timestampslist<int>Expiration times of the option

Example

#include "tigerapi/quote_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 symbols = value::array();  
	symbols[0] = value::string("TSLA");  
	cout << "symbols " << symbols << endl;  
	value result = quote_client->get_option_expirations(symbols);
    cout << result << endl;

    return 0;
 }   

Response Example

{
  "count":22,
  "dates":["2025-03-14","2025-03-21","2025-03-28","2025-04-04","2025-04-11","2025-04-17","2025-04-25","2025-05-02","2025-05-16",
    "2025-06-20","2025-07-18","2025-08-15","2025-09-19","2025-11-21","2025-12-19","2026-01-16","2026-03-20","2026-06-18",
    "2026-09-18","2026-12-18","2027-01-15","2027-06-17"],
  "optionSymbols":["TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA",
    "TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA","TSLA"],
  "periodTags":["w","m","w","w","w","m","w","w","m","m","m","m","m","m","m","m","m","m","m","m","m","w"],
  "symbol":"TSLA",
  "timestamps":[1741924800000,1742529600000,1743134400000,1743739200000,1744344000000,1744862400000,1745553600000,
    1746158400000,1747368000000,1750392000000,1752811200000,1755230400000,1758254400000,1763701200000,1766120400000,
    1768539600000,1773979200000, 1781755200000,1789704000000,1797570000000,1799989200000,1813204800000]
}

get_option_chain Get Option Chain

value get_option_chain(const utility::string_t symbol, time_t expiry, value option_filter= value::null());
value get_option_chain(const utility::string_t symbol, utility::string_t expiry, value option_filter= value::null());

Description

Get option chain of a selected option

Rate Limit

Refer to Rate Limit

Parameters

ParameterTypeRequiredDescription
symbolstring_tYesSymbol of the underlying asset
expirytime_t/string_tYesExpiry time of the option, Unix timestamp in millisecond (1705640400000), or a date string formatted as 'YYYY-MM-DD' ('2024-01-19')
option_filterOptionFilterNoParameters for filtering the result
default: value::null()

Response

ParameterTypeDescription
identifierstringOption Identifier
symbolstringSymbol of the underlying asset
expiryintExpiration time of the option, Unix timestamp in millisecond
strikefloatStrike price
put_callstringCall/Put
multiplierfloatMultiplier
ask_pricefloatAsk price
ask_sizeintAsk size
bid_pricefloatBid price
bid_sizeintBid size
pre_closefloatPre close price
latest_pricefloatLatest price
volumeintVolume
open_interestintOpen interest

Example

#include "tigerapi/quote_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_option_chain("TSLA", "2023-01-20");
    cout << result << endl;

    return 0;
}

Response Example


get_option_brief Get Options brief

value get_option_brief(value identifiers);
value get_option_brief(const utility::string_t identifier);

Description

Get latest quote data for an option, including latest price, volume, bid/asd price and volume

Rate Limit

Refer to Rate Limit

Parameters

ParameterTypeRequiredDescription
identifiersstring_t/list<string>YesA list of option identifiers. Maximum number of contracts per request is 30. Example: ['AAPL 220128C000175000']

Response

Structured as follows:

ParameterTypeDescription
expiryintExpiry time of the option, Unix timestamp in millisecond
identifierstringOption Identifier
multiplierfloatMultiplier
ratesBondsfloatInterest rate or bond yield used in pricing the option
rightstringOption type ("call" or "put")
strikefloatStrike price
symbolstringSymbol of the underlying asset
volatilitystringImplied volatility of the option, often expressed as a percentage
volumeintVolume

Example

#include "tigerapi/quote_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_option_brief("AAPL 230224C000150000");
    cout << result << endl;

    return 0;
}

Response Example

{
  "expiry":1677164400000,
  "identifier":"AAPL  230223C00150000",
  "multiplier":100,
  "ratesBonds":0.041241,
  "right":"call",
  "strike":"150.0",
  "symbol":"AAPL",
  "volatility":"27.52%",
  "volume":0
}

get_option_kline Get Option Kline

vector<Kline> get_option_kline(value identifiers, time_t begin_time, time_t end_time=4070880000000);

Description

Get daily aggregate bars for an option over a given date range.

Rate Limit

Refer to Rate Limit

Parameters

ParameterTypeRequiredDescription
identifierslist<string>YesA list of option identifiers. Maximum number of contracts per request is 30. Example: ['AAPL 220128C000175000']
begin_timetime_tYesThe start time of the time window
end_timetime_tNoThe end time of the time window
default: 4070880000000

Response

Structured as follows:

ParameterTypeDescription
identifierstringOption Identifier
symbolstringSymbol of the underlying asset
expiryintOption expiration date, format: YYYY-MM-DD
put_callstringPut or call
strikefloatStrike price
timeintTimestamp of the open/start time of each bar, UNIX timestamp in millisecond
openfloatOpening price
highfloatHigh
lowfloatLow
closefloatClose
volumeintVolume
open_interestintOpen interest. Total number of option contracts that has been traded but not yet been liquified

Example

#include "tigerapi/quote_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";



    std::shared_ptr<QuoteClient> quote_client = std::make_shared<QuoteClient>(config);
	value identifiers = value::array();  
	identifiers[0] = value::string("AAPL 220923C000155000");  
	value result = quote_client->get_option_kline(identifiers,1000880000000);
    cout << result << endl;

    return 0;
    }

Response Example


get_option_trade_tick Get Option Tick Data


value get_option_trade_tick(value identifiers);

Description

Get the most recent tick data for a given option

Rate Limit

Refer to Rate Limit

Parameters

ParameterTypeRequiredDescription
identifierslist<string>YesA list of option identifiers. Example: ['AAPL 220128C000175000']

Response

Structured as follows:

ParameterTypeDescription
symbolstringOption identifier
expirystringOption expiration date, format: YYYY-MM-DD
put_callstringPut or call
strikefloatStrike price
timeintTime of the
pricefloatPrice
volumeintVolume

Example


#include "tigerapi/quote_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 identifiers = value::array();  
	identifiers[0] = value::string("AAPL 230923C000155000");  
	value result = quote_client->get_option_trade_tick(identifiers);
    cout << result << endl;

    return 0;
}    
Last update: