Options
get_option_expirations Get Option Expiration Dates
QuoteClient.get_option_expirations(symbols, market=None)
Description
Get option expiration dates
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | List of underlying asset symbols. For Hong Kong contracts, use symbols provided by get_option_symbols in format "CODE.HK" |
| market | tigeropen.common.consts.Market | Yes | Market, US/HK for Hong Kong stocks. |
Returns
pandas.DataFrame
The meaning of each column is as follows:
| Parameter | Type | Description |
|---|---|---|
| symbol | str | Security code |
| date | str | Expiration date in YYYY-MM-DD format |
| timestamp | int | Expiration date timestamp in milliseconds |
| period_tag | str | Option period tag, m for monthly options, w for weekly options |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import Market
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
expiration = quote_client.get_option_expirations(symbols=['AAPL'], market=Market.US)
#for HK contracts
#expirationHK = quote_client.get_option_expirations(symbols=["MET.HK"],market=Market.HK)
print(expiration.head())Return Example
symbol date timestamp
0 AAPL 2019-01-11 1547182800000
1 AAPL 2019-01-18 1547787600000
2 AAPL 2019-01-25 1548392400000
3 AAPL 2019-02-01 1548997200000
4 AAPL 2019-02-08 1549602000000
get_option_briefs Get Option Real-time Quotes
QuoteClient.get_option_briefs(identifiers, market=None, timezone=None)
Description
Get option real-time quotes
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| identifiers | list[str] | Yes | List of underlying asset symbols. For Hong Kong contracts, use symbols provided by get_option_symbols in format "CODE.HK" |
| market | tigeropen.common.consts.Market | Yes | Market, US: US stocks, HK: Hong Kong stocks. |
| timezone | str | No | Timezone, such as 'US/Eastern', 'Asia/Hong_Kong' |
Returns
pandas.DataFrame
The meaning of each column is as follows:
| Field | Type | Description |
|---|---|---|
| identifier | str | Option code |
| symbol | str | Stock code |
| strike | str | Strike price |
| bid_price | float | Bid price |
| bid_size | int | Bid size |
| ask_price | float | Ask price |
| ask_size | int | Ask size |
| latest_price | float | Latest price |
| latest_time | int | Latest trade time |
| volume | int | Volume |
| high | float | High price |
| low | float | Low price |
| open | float | Open price |
| pre_close | float | Previous close price |
| open_interest | int | Open interest |
| open | float | Open price |
| change | float | Price change |
| multiplier | int | Multiplier, default 100 for US options |
| rates_bonds | float | One-year US Treasury rate, updated daily, e.g., 0.0078 means actual rate: 0.78% |
| put_call | str | Direction (PUT/CALL) |
| volatility | str | Historical volatility |
| expiry | int | Expiration time (milliseconds, midnight of the day) |
| midPrice | float | Mid price |
| midTimestamp | int | Timestamp of the mid price |
| markPrice | float | Mark price |
| markTimestamp | int | Timestamp of the mark price |
| preMarkPrice | float | Previous mark price |
| sellingReturn | float | Annualized return from selling |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import Market
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
briefs = quote_client.get_option_briefs(['AAPL 230317C000135000'], market=Market.US)
# Hong Kong options
# briefs = quote_client.get_option_briefs(['TCH.HK 230317C000135000'], market=Market.HK)Return Example
identifier symbol expiry strike put_call multiplier ask_price open \
NVDA 260116C00100000 NVDA 1768539600000 100.0 CALL 100 79.05 65 \
ask_size bid_price bid_size pre_close latest_price latest_time volume open_interest \
78.0 178 78.7 78.2 None 36 84175 78.09 \
high low rates_bonds volatility change
79.57 77.89 0.036165 29.29% -0.5
get_option_chain Get Option Chain
QuoteClient.get_option_chain(symbol, expiry, option_filter=None, return_greek_value=None, market=None, timezone=None, **kwargs)
Description
Get option chain
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | str | Yes | Stock code corresponding to the option |
| expiry | str or int | Yes | Option expiration date, numeric timestamp in milliseconds or date string, e.g., 1705640400000 or '2024-01-19' |
| option_filter | tigeropen.quote.domain.filter.OptionFilter | No | Filter parameters, optional |
| return_greek_value | bool | No | Whether to return Greek values |
| market | tigeropen.common.consts.Market | Yes | Market, supports US/HK |
| timezone | str | No | Timezone, such as 'US/Eastern', 'Asia/Hong_Kong' |
Filter parameters:
For all filtering indicators except the in_the_money attribute, other indicators use field names with _min suffix (representing minimum range value) or _max suffix (representing maximum range value), such as delta_min, theta_max. See code examples.
OptionFilter filterable indicators are as follows:
| Parameter | Type | Required | Description |
|---|---|---|---|
| implied_volatility | float | No | Implied volatility, reflecting the market's expectation of future stock price volatility. Higher implied volatility indicates expected greater price volatility. |
| in_the_money | bool | No | Whether in-the-money |
| open_interest | int | No | Open interest, the number of contracts held by market participants at the end of each trading day. Reflects market depth and liquidity. |
| delta | float | No | Delta, reflecting the impact of stock price changes on option price changes. For every $1 change in stock price, option price changes approximately by delta. Range: -1.0 ~ 1.0 |
| gamma | float | No | Gamma, reflecting the impact of stock price changes on delta. For every $1 change in stock price, delta changes by gamma. |
| theta | float | No | Theta, reflecting the impact of time changes on option price changes. For every day decrease in time, option price changes approximately by theta. |
| vega | float | No | Vega, reflecting the impact of volatility on option price changes. For every 1% change in volatility, option price changes approximately by vega. |
| rho | float | No | Rho, reflecting the impact of risk-free interest rate on option price changes. For every 1% change in risk-free rate, option price changes approximately by rho. |
Returns
pandas.DataFrame
| Field Name | Type | Description |
|---|---|---|
| identifier | str | Option code |
| symbol | str | Underlying stock code for the option |
| expiry | int | Option expiration date, millisecond timestamp |
| strike | float | Strike price |
| put_call | str | Option direction |
| multiplier | float | Multiplier |
| ask_price | float | Ask price |
| ask_size | int | Ask size |
| bid_price | float | Bid price |
| bid_size | int | Bid size |
| pre_close | float | Previous close |
| latest_price | float | Latest price |
| volume | int | Volume |
| open_interest | int | Open interest quantity |
| implied_vol | float | Implied volatility |
| delta | float | Delta |
| gamma | float | Gamma |
| theta | float | Theta |
| vega | float | Vega |
| rho | float | Rho |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import Market
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
option_chain = quote_client.get_option_chain(symbol='AAPL', expiry='2019-01-18', market=Market.US)
# Hong Kong options
# option_chains = quote_client.get_option_chain(symbol='TCH.HK', expiry='2024-06-27', market='HK', return_greek_value=True)
print(option_chain)
# Can define OptionFilter for filtering
option_filter = OptionFilter(implied_volatility_min=0.5, implied_volatility_max=0.9, delta_min=0, delta_max=1,
open_interest_min=100, gamma_min=0.005, theta_max=-0.05, in_the_money=True)
option_chain = quote_client.get_option_chain('AAPL', '2023-01-20', option_filter=option_filter, market=Market.US)
print(option_chain)
# Can also filter directly using indicator names
option_chain = quote_client.get_option_chain('AAPL', '2023-01-20', implied_volatility_min=0.5, open_interest_min=200, vega_min=0.1, rho_max=0.9, market=Market.US)
# Convert expiry time format
option_chain['expiry_date'] = pd.to_datetime(option_chain['expiry'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')Return Example
symbol expiry identifier strike put_call volume latest_price \
0 AAPL 1689912000000 AAPL 230721C00095000 95.0 CALL 0 80.47
1 AAPL 1689912000000 AAPL 230721C00100000 100.0 CALL 0 73.50
pre_close open_interest multiplier implied_vol delta gamma theta vega \
80.47 117 100 0.989442 0.957255 0.001332 -0.061754 0.059986 \
76.85 206 100 0.903816 0.955884 0.001497 -0.058678 0.060930 \
rho expiry_date
0.133840 2023-07-21 00:00:00-04:00
0.141341 2023-07-21 00:00:00-04:00
get_option_depth Get Option Depth Market Data
QuoteClient.get_option_depth(identifiers: list[str], market, timezone=None)
Description
Get option depth market data. Supports US and Hong Kong market options.
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| identifiers | list[str] | Yes | List of option codes, e.g., ['AAPL 220128C000175000']. Format Description |
| market | tigeropen.common.consts.Market | Yes | Market, US/HK |
| timezone | str | No | Timezone, default value is 'US/Eastern', Hong Kong options need to pass 'Asia/Hong_Kong' |
Returns
dict
Structure as follows:
| Parameter | Type | Description |
|---|---|---|
| identifier | str | Option symbol |
| asks | list[tuple] | Ask information |
| bids | list[tuple] | Bid information |
Each item in asks and bids is a tuple, with tuple elements composed of (price, volume, timestamp, code)
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import Market
from tigeropen.common.util.contract_utils import get_option_identifier
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# or client_config = get_client_config(props_path='path to tiger_openapi_config.properties file')
quote_client = QuoteClient(client_config)
identifier = 'AAPL 190104P00134000'
# Or generated from four elements
# identifier = get_option_identifier('AAPL', '20190104', 'PUT', 134)
result = quote_client.get_option_depth([identifier], market=Market.US)
print(result)Return Example
Single underlying:
{'identifier': 'ADBE 240816C00560000',
'asks': [(18.3, 36, 1719852973090, 'PHLX'), (18.3, 19, 1719852973090, 'EDGX'), (18.3, 14, 1719852972660, 'MPRL'), (18.3, 14, 1719852972512, 'BOX'), (18.3, 13, 1719852973090, 'EMLD'), (18.3, 12, 1719852973090, 'MIAX'), (18.3, 11, 1719852969837, 'ISE'), (18.3, 10, 1719852973487, 'AMEX'), (18.3, 10, 1719852973090, 'CBOE'), (18.3, 7, 1719852973090, 'GEM'), (18.3, 7, 1719852969591, 'MCRY'), (18.3, 7, 1719852969585, 'BZX'), (18.3, 6, 1719852969647, 'NSDQ'), (18.3, 4, 1719852973525, 'ARCA'), (18.3, 3, 1719852972512, 'MEMX'), (18.3, 3, 1719852969818, 'C2'), (18.3, 2, 1719852973422, 'BX')],
'bids': [(17.9, 8, 1719852972512, 'BOX'), (17.9, 7, 1719852973487, 'AMEX'), (17.9, 6, 1719852973090, 'EMLD'), (17.9, 6, 1719852972660, 'MPRL'), (17.9, 6, 1719852969837, 'ISE'), (17.9, 5, 1719852973422, 'BX'), (17.9, 5, 1719852973090, 'PHLX'), (17.9, 5, 1719852969647, 'NSDQ'), (17.9, 5, 1719852969591, 'MCRY'), (17.9, 4, 1719852973090, 'EDGX'), (17.9, 4, 1719852973090, 'MIAX'), (17.9, 3, 1719852973525, 'ARCA'), (17.9, 2, 1719852973090, 'CBOE'), (17.9, 2, 1719852973090, 'GEM'), (17.9, 2, 1719852969818, 'C2'), (17.9, 1, 1719852969585, 'BZX'), (17.85, 6, 1719852972512, 'MEMX')]
}
Multiple underlyings:
{'ADBE 240816C00560000':
{'identifier': 'ADBE 240816C00560000',
'asks': [(18.3, 36, 1719852973090, 'PHLX'), (18.3, 19, 1719852973090, 'EDGX'), (18.3, 14, 1719852972660, 'MPRL'), (18.3, 14, 1719852972512, 'BOX'), (18.3, 13, 1719852973090, 'EMLD'), (18.3, 12, 1719852973090, 'MIAX'), (18.3, 11, 1719852969837, 'ISE'), (18.3, 10, 1719852973487, 'AMEX'), (18.3, 10, 1719852973090, 'CBOE'), (18.3, 7, 1719852973090, 'GEM'), (18.3, 7, 1719852969591, 'MCRY'), (18.3, 7, 1719852969585, 'BZX'), (18.3, 6, 1719852969647, 'NSDQ'), (18.3, 4, 1719852973525, 'ARCA'), (18.3, 3, 1719852972512, 'MEMX'), (18.3, 3, 1719852969818, 'C2'), (18.3, 2, 1719852973422, 'BX')],
'bids': [(17.9, 8, 1719852972512, 'BOX'), (17.9, 7, 1719852973487, 'AMEX'), (17.9, 6, 1719852973090, 'EMLD'), (17.9, 6, 1719852972660, 'MPRL'), (17.9, 6, 1719852969837, 'ISE'), (17.9, 5, 1719852973422, 'BX'), (17.9, 5, 1719852973090, 'PHLX'), (17.9, 5, 1719852969647, 'NSDQ'), (17.9, 5, 1719852969591, 'MCRY'), (17.9, 4, 1719852973090, 'EDGX'), (17.9, 4, 1719852973090, 'MIAX'), (17.9, 3, 1719852973525, 'ARCA'), (17.9, 2, 1719852973090, 'CBOE'), (17.9, 2, 1719852973090, 'GEM'), (17.9, 2, 1719852969818, 'C2'), (17.9, 1, 1719852969585, 'BZX'), (17.85, 6, 1719852972512, 'MEMX')]},
'ADBE 240816P00560000':
{'identifier': 'ADBE 240816P00560000',
'asks': [(17.45, 6, 1719863999000, 'BOX'), (17.45, 5, 1719863999000, 'EMLD'), (17.45, 5, 1719863999000, 'PHLX'), (17.45, 1, 1719863999000, 'CBOE'), (17.45, 1, 1719863999000, 'ISE'), (17.45, 1, 1719863999000, 'ARCA'), (17.45, 1, 1719863999000, 'MPRL'), (17.45, 1, 1719863999000, 'NSDQ'), (17.45, 1, 1719863999000, 'BX'), (17.45, 1, 1719863999000, 'C2'), (17.45, 1, 1719863999000, 'BZX'), (21.65, 4, 1719863999000, 'EDGX'), (22.0, 2, 1719863999000, 'AMEX'), (27.3, 1, 1719863999000, 'GEM'), (27.5, 1, 1719863999000, 'MIAX'), (28.0, 1, 1719863999000, 'MCRY'), (0.0, 0, 1719864000000, 'MEMX')],
'bids': [(17.05, 6, 1719863999000, 'ISE'), (17.05, 5, 1719863999000, 'BOX'), (17.05, 5, 1719863999000, 'PHLX'), (17.05, 3, 1719863999000, 'MCRY'), (17.05, 2, 1719863999000, 'ARCA'), (17.05, 2, 1719863999000, 'MPRL'), (17.05, 2, 1719863999000, 'NSDQ'), (17.05, 2, 1719863999000, 'BX'), (17.05, 2, 1719863999000, 'BZX'), (17.05, 1, 1719863999000, 'AMEX'), (17.05, 1, 1719863999000, 'CBOE'), (17.05, 1, 1719863999000, 'GEM'), (17.05, 1, 1719863999000, 'C2'), (15.6, 1, 1719863999000, 'EDGX'), (15.5, 1, 1719863999000, 'MIAX'), (11.95, 1, 1719863999000, 'EMLD'), (0.0, 0, 1719864000000, 'MEMX')]}
}
get_option_trade_ticks Get Option Tick-by-Tick Trade Data
QuoteClient.get_option_trade_ticks(identifiers)
Description
Get option tick-by-tick trade data
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| identifiers | list[str] | Yes | List of option codes, e.g., ['AAPL 220128C000175000']. Format Description |
Returns
pandas.DataFrame
Structure as follows:
| Parameter | Type | Description |
|---|---|---|
| symbol | str | Underlying stock code for the option |
| expiry | str | Option expiration time in YYYY-MM-DD format |
| put_call | str | Option direction |
| strike | float | Strike price |
| time | int | Trade time |
| price | float | Trade price |
| volume | int | Trade volume |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.util.contract_utils import get_option_identifier
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
identifier = 'AAPL 190104P00134000'
# Or generated from four elements
# identifier = get_option_identifier('AAPL', '20190104', 'PUT', 134)
option_trade_ticks = quote_client.get_option_trade_ticks([identifier])Return Example
identifier symbol expiry put_call strike time price volume
0 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640701803177 9.38 9
1 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640701803177 9.38 1
2 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640701803846 9.46 7
3 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640701806266 9.55 1
4 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640701918302 9.08 1
.. ... ... ... ... ... ... ... ...
111 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640722112754 8.91 25
112 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640723067491 9.00 4
113 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640723585351 8.85 4
114 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640724302670 9.13 2
115 AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1640724600973 8.85 1
get_option_bars Get Option K-line Data
QuoteClient.get_option_bars(identifiers, begin_time=-1, end_time=4070880000000, period=BarPeriod.DAY, limit=None, sort_dir=None, market=None, timezone=None)
Description
Get option K-line data
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| identifiers | list[str] | Yes | Option code list, maximum 30 per request, e.g. ['AAPL 220128C000175000'], Format Description |
| begin_time | str or int | Yes | Start time, millisecond timestamp or date string, e.g. 1643346000000 or '2019-01-01' |
| end_time | str or int | Yes | End time, millisecond timestamp or date string, e.g. 1643346000000 or '2019-01-01' |
| period | tigeropen.common.consts.BarPeriod | No | K-line type, value range (DAY: daily K, ONE_MINUTE: 1 minute, FIVE_MINUTES: 5 minutes, HALF_HOUR: 30 minutes, ONE_HOUR: 60 minutes) |
| limit | int | No | Number of K-lines returned per option |
| sort_dir | tigeropen.common.consts.SortDirection | No | Sort order, enum ASC/DESC, default ASC |
| market | tigeropen.common.consts.Market | Yes | Market, US: US stocks, HK: Hong Kong stocks |
| timezone | str | No | Time zone, e.g. 'US/Eastern', 'Asia/Hong_Kong' |
Returns
pandas.DataFrame
Structure as follows:
| Parameter Name | Type | Description |
|---|---|---|
| identifier | str | Option code |
| symbol | str | Underlying stock symbol |
| expiry | int | Expiry date, millisecond timestamp |
| put_call | str | Option direction |
| strike | float | Strike price |
| time | int | Bar time, millisecond timestamp |
| open | float | Opening price |
| high | float | Highest price |
| low | float | Lowest price |
| close | float | Closing price |
| volume | int | Trading volume |
| open_interest | int | Open interest |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import BarPeriod, Market
from tigeropen.common.util.contract_utils import get_option_identifier
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
identifier = 'AAPL 190104P00134000'
# Or generated from four elements
# identifier = get_option_identifier('AAPL', '20190104', 'PUT', 134)
bars = quote_client.get_option_bars([identifier],period = BarPeriod.DAY, market=Market.US)
print(bars)
# Convert time format
bars['expiry_date'] = pd.to_datetime(bars['expiry'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')
bars['time_date'] = pd.to_datetime(bars['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')Return Example
identifier symbol expiry put_call strike time open high \
AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1639026000000 8.92 9.80 \ AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1639112400000 9.05 10.80 \ AAPL 220128C00175000 AAPL 1643346000000 CALL 175.0 1639371600000 11.70 12.50 \
low close volume open_interest expiry_date time_date
8.00 8.20 364 0 2022-01-28 00:00:00-05:00 2021-12-09 00:00:00-05:00
7.80 10.80 277 177 2022-01-28 00:00:00-05:00 2021-12-10 00:00:00-05:00
8.72 8.75 304 328 2022-01-28 00:00:00-05:00 2021-12-13 00:00:00-05:00
get_option_timeline Get Option Intraday Data
QuoteClient.get_option_timeline(self, identifiers: Union[str, list[str]], market:Optional[Union[Market, str]] = None, begin_time: Optional[Union[str, int]] = None, timezone: Optional[str] = None)
Description
Get intraday data for options
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| identifiers | list[str] | Yes | Option code list, maximum 30 per request, e.g. ['AAPL 220128C000175000'], Format Description |
| market | Market | Yes | Market, default HK, currently only supports HK |
Returns
| Field | Type | Description |
|---|---|---|
| identifier | str | Option symbol |
| symbol | str | Stock code |
| put_call | str | Call or Put (CALL/PUT) |
| expiry | int | Expiry time |
| strike | str | Strike price |
| pre_close | float | Previous day's closing price |
| volume | int | Trading volume |
| avg_price | double | Average trading price |
| price | double | Latest price |
| time | int | Current time-series time |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import BarPeriod, Market
from tigeropen.common.util.contract_utils import get_option_identifier
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
identifier = 'TCH.HK 250929C00510000'
# Or generated from four elements
# identifier = get_option_identifier('TCH.HK', '20190104', 'PUT', 134)
result = quote_client.get_option_timeline([identifier], market=Market.HK)
print(result)
Return Example
identifier symbol expiry put_call strike pre_close price \
0 TCH.HK250929C00510000 TCH.HK 1759075200000 CALL 510.00 29.36 29.36 \
1 TCH.HK250929C00510000 TCH.HK 1759075200000 CALL 510.00 29.36 29.36 \
2 TCH.HK250929C00510000 TCH.HK 1759075200000 CALL 510.00 29.36 29.36 \
avg_price time volume
29.360000 1750901400000 0
29.360000 1750901460000 0
29.360000 1750901520000 0
get_option_symbols Get Hong Kong Option Symbol
QuoteClient.get_option_symbols(market = Market.HK, lang = Language.en_US)
Description
Get Hong Kong option symbol, for example, the code for 00700 is TCH.HK
Request Frequency
For frequency limits, please refer to: API Request Limits
Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| market | tigeropen.common.consts.Market | No | Market.HK |
| lang | Language | No | Language for returned information, optional, defaults to English |
Returns
pandas.DataFrame
Structure as follows:
| Parameter Name | Type | Description |
|---|---|---|
| symbol | str | Option code, e.g. TCH.HK |
| name | str | Name |
| underlying_symbol | str | Hong Kong stock code, e.g. 00700 |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.util.contract_utils import get_option_identifier
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
result = quote_client.get_option_symbols()
print(result)Return Example
symbol name underlying_symbol
0 ALC.HK ALC 02600
1 CRG.HK CRG 00390
2 PAI.HK PAI 02318
3 XCC.HK XCC 00939
4 XTW.HK XTW 00788
5 SHL.HK SHL 00968
6 GHL.HK GHL 00868
7 HEX.HK HEX 00388
8 ACC.HK ACC 00914
9 STC.HK STC 02888
get_option_analysis Get option analysis indicators
QuoteClient.get_option_analysis(symbols, period = OptionAnalysisPeriod.FIFTY_TWO_WEEK, market = None, lang = None)
Description
Obtain option analysis indicators, including data such as implied volatility, historical volatility, IV/HV ratio, call-put ratio, IV percentile, IV ranking, etc.
Request Frequency
For frequency limits, please refer to: Interface Request Limits
Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| symbols | List[str] or List[dict] | Yes | List of stock codes. It can be a list of strings such as ["AAPL", "TSLA"], a list of dictionaries such as [{"symbol": "AAPL", "period": "26week"}], or a mixed format |
| period | tigeropen.common.consts.OptionAnalysisPeriod | No | Analysis period, default is FIFTY_TWO_WEEK. Optional values: THREE_YEAR, FIFTY_TWO_WEEK, TWENTY_SIX_WEEK, THIRTEEN_WEEK |
| market | tigeropen.common.consts.Market | No | Market, such as Market.US, Market.HK |
| lang | Language | No | Language of the returned information, not required, default is English |
Return
A list of List[OptionAnalysis] objects, where each object has the following structure:
| Attribute Name | Type | Description |
|---|---|---|
| symbol | str | Stock code |
| implied_vol_30_days | float | Implied volatility of the underlying asset. It is obtained by comprehensively weighted calculation of the implied volatility of some options in the option chain, which is the IV of the underlying asset. It reflects the overall fluctuation of the option chain in the next 30 days, and this data also has reference value for the underlying stock. |
| his_volatility | float | Historical volatility of the underlying asset. It reflects the actual fluctuation of the underlying asset in the past 30 days and is used to measure the degree to which the underlying asset deviates from its average price. |
| iv_his_v_ratio | float | Ratio of implied volatility to historical volatility |
| call_put_ratio | float | Call-put ratio |
| iv_metric | IVMetric | Implied volatility indicator object |
IVMetric Object Structure:
Attribute | Type | Desc |
|---|---|---|
period | str | Period, like: "52week"、"26week" |
percentile | float | Implied Volatility Percentile. IV Percentile is also a relative indicator that counts, over the past year, how many days have an implied volatility lower than the current one. The calculation formula is: IV Percentile = Number of days in a year with IV lower than the current IV / Trading days The value range of IV Percentile fluctuates between 0% and 100%; when IV Percentile is 0%, it means that in the past year, 0% of the trading days have an IV lower than the current IV; when IV Percentile is 100%, it means that in the past year, 100% of the trading days have an IV lower than the current IV. |
rank | float | Implied Volatility Ranking. IV Rank is a relative indicator that calculates the current relative position of IV based on the highest and lowest IV values of the underlying asset over the past year. The calculation formula is: IV Rank = (Current IV - Lowest IV in 1 year) / (Highest IV in 1 year - Lowest IV in 1 year) The value range of IV Rank fluctuates between 0 and 1; when IV Rank is 0, it indicates that the current IV is in the lower range within the past year; when IV Rank is 1, it indicates that the current IV is in the higher range within the past year |
Example
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import Market, OptionAnalysisPeriod
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
quote_client = QuoteClient(client_config)
# Specify the period using an enumeration
result = quote_client.get_option_analysis(
symbols=['AAPL', 'TSLA'],
period=OptionAnalysisPeriod.FIFTY_TWO_WEEK,
market=Market.US
)
print(result)
# Specify different periods for different stocks
result = quote_client.get_option_analysis(
symbols=[
{"symbol": "AAPL", "period": "52week"},
{"symbol": "TSLA", "period": "26week"}
],
market=Market.US
)Return example
[OptionAnalysis({"symbol": "AAPL", "implied_vol_30_days": 0.3071, "his_volatility": 0.1967, "iv_his_v_ratio": 1.5617, "call_put_ratio": 0.0, "iv_metric": IVMetric({"period": "52week", "percentile": 0.527363184079602, "rank": 0.18213875790384876})}),
OptionAnalysis({"symbol": "TSLA", "implied_vol_30_days": 0.5162, "his_volatility": 0.3603, "iv_his_v_ratio": 1.4328, "call_put_ratio": 0.0, "iv_metric": IVMetric({"period": "52week", "percentile": 0.08, "rank": 0.04194153521422974})})]
Updated about 1 month ago
