Quotation Subscription Push
Subscribe to Stock Quotes
Subscribe Method
PushClient.subscribe_quote(symbols)
Unsubscribe Method
PushClient.unsubscribe_quote(symbols)
Description
Real-time subscription and unsubscription interface for stock quotes. Once subscribed, quote data is pushed to the client whenever there are price changes or order book updates.
Callback data is returned in the following formats:
- Basic quote data:
QuoteBasicData(tigeropen.push.pb.QuoteBasicData_pb2.QuoteBasicData) - Best bid/offer (BBO) data:
QuoteBBOData(tigeropen.push.pb.QuoteBasicData_pb2.QuoteBBOData)
This interface operates asynchronously. Use the following callbacks to handle incoming data:
PushClient.quote_changedhandles basic quote updates (QuoteBasicData)PushClient.quote_bbo_changedhandles best bid/offer updates (QuoteBBOData)
Note: Subscription to US stock index quotes is not supported
Parameters
| Parameter | Type | Description |
|---|---|---|
| symbols | list[str] | List of security symbols. Symbols must be uppercase |
Return Data
For a complete description of all fields included in stock quote callback data, refer to Quote Changes
CAUTION
Stock quote callback data is returned in two distinct types:
- Trading data
- Order book data
The fields included in the callback differ between these two data types. Make sure to handle each type appropriately when processing the callback payload.
Example
from tigeropen.push.push_client import PushClient
from tigeropen.push.pb.QuoteBBOData_pb2 import QuoteBBOData
from tigeropen.push.pb.QuoteBasicData_pb2 import QuoteBasicData
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'), use_protobuf=True)
# Define callback methods
def on_quote_changed(frame: QuoteBasicData):
"""Basic quote data callback
"""
print(f'quote basic change: {frame}')
def on_quote_bbo_changed(frame: QuoteBBOData):
"""Best bid/offer quote, ask/bid
"""
print(f'quote bbo changed: {frame}')
# Bind callback methods
push_client.quote_changed = on_quote_changed
push_client.quote_bbo_changed = on_quote_bbo_changed
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe
push_client.subscribe_quote(['XYZX'])
# Unsubscribe
push_client.unsubscribe_quote(['XYZX'])
# Disconnect, will cancel all subscriptions
push_client.disconnect()Callback Data Example
tigeropen.push.pb.QuoteBasicData_pb2.QuoteBasicData data example:
symbol: "00700"
type: BASIC
timestamp: 1677742483530
serverTimestamp: 1677742483586
avgPrice: 365.37
latestPrice: 363.8
latestPriceTimestamp: 1677742483369
latestTime: "03-02 15:34:43"
preClose: 368.8
volume: 12674730
amount: 4630947968
open: 368.2
high: 369
low: 362.4
marketStatus: "Trading"
mi {
p: 363.8
a: 365.37
t: 1677742440000
v: 27300
}
tigeropen.push.pb.QuoteBasicData_pb2.QuoteBBOData data example:
symbol: "01810"
type: BBO
timestamp: 1677741267291
serverTimestamp: 1677741267329
askPrice: 12.54
askSize: 397600
askTimestamp: 1677741266304
bidPrice: 12.52
bidSize: 787400
bidTimestamp: 1677741266916
Subscribe to Option Quotes
Parameters
Parameter | Type | Description |
|---|---|---|
symbols | list[str] | List of option symbols. Each symbol consists of four space‑separated elements:
|
Callback Data
Bind the callback handler using push_client.quote_changed.
Option quote updates use the same callback method as stock quotes.
Example
push_client.subscribe_option(['XYZX 20230120 150.0 CALL', 'SPY 20220930 470.0 PUT'])
Alternatively,
push_client.subscribe_quote(['XYZX 20230120 150.0 CALL', 'SPY 20220930 470.0 PUT'])
from tigeropen.push.push_client import PushClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'))
# Define callback methods
def on_quote_changed(frame: QuoteBasicData):
"""Basic quote data callback
"""
print(f'quote basic change: {frame}')
def on_quote_bbo_changed(frame: QuoteBBOData):
"""Best bid/offer quote, ask/bid
"""
print(f'quote bbo changed: {frame}')
# Bind callback methods
push_client.quote_changed = on_quote_changed
push_client.quote_bbo_changed = on_quote_bbo_changed
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe to option quotes
push_client.subscribe_option(['XYZX 20240119 155.0 PUT', 'SPY 20221118 386.0 CALL'])
# Unsubscribe
push_client.unsubscribe_quote(['XYZX 20240119 155.0 PUT', 'SPY 20221118 386.0 CALL'])
# Disconnect, will cancel all subscriptions
push_client.disconnect()Subscribe to Market Depth Quotes
Subscribe Method
Push_client.subscribe_depth_quote(symbols)
Unsubscribe Method
PushClient.unsubscribe_depth_quote(symbols)
Description
Subscribe to real-time market depth quotes for stocks and options.
- US market depth quotes are pushed every 300 ms
- Each update returns up to 40 levels of bid and ask order book data
Data is delivered in real time and pushed whenever the order book changes.
This interface is asynchronous. Use PushClient.quote_depth_changed to handle incoming depth quote data in the form of QuoteDepthData (tigeropen.push.pb.QuoteDepthData_pb2.QuoteDepthData) objects.
Parameters
| Parameter | Type | Description |
|---|---|---|
| symbols | list[str] | List of security symbols |
Example
from tigeropen.push.push_client import PushClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'))
# Define callback methods
def on_quote_depth_changed(frame: QuoteDepthData):
print(f'quote depth changed: {frame}')
# Print prices
print(f'ask price: {frame.ask.price}')
# First level price
print(f'ask price item 0: {frame.ask.price[0]}')
# Bind callback methods
push_client.quote_depth_changed = on_quote_depth_changed
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe to market depth quotes
push_client.subscribe_depth_quote(['XYZX'])
# Unsubscribe
push_client.unsubscribe_depth_quote(['XYZX'])
# Disconnect, will cancel all subscriptions
push_client.disconnect()Callback Data
tigeropen.push.pb.QuoteDepthData_pb2.QuoteDepthData
CAUTION
This interface returns up to 40 levels of bid and ask order book data only.
Data structure:
| Field | Type | Description |
|---|---|---|
| symbol | string | Security symbol |
| timestamp | long | Timestamp of the depth data |
| ask | OrderBook | Ask‑side order book data |
| bid | OrderBook | Bid‑side order book data |
OrderBook data structure:
| Field | Type | Description |
|---|---|---|
| price | list[float] | Price at each order book level |
| volume | list[int] | Order volume at each corresponding level |
| exchange | string | Option data source (options only). If price or volume is 0, the quote from this data source has expired. For enum values, see: Option Exchanges |
| time | long | Order timestamp from the option exchange (options only) |
Callback Data Example
Adjacent levels may share the same price, and orderCount is optional depending on the market and asset type.
symbol: "00700"
timestamp: 1677742734822
ask {
price: 363.8
price: 364
price: 364.2
price: 364.4
price: 364.6
price: 364.8
price: 365
price: 365.2
price: 365.4
price: 365.6
volume: 26900
volume: 14800
volume: 15200
volume: 31500
volume: 15800
volume: 7700
volume: 29400
volume: 6300
volume: 6000
volume: 5500
orderCount: 27
orderCount: 20
orderCount: 19
orderCount: 22
orderCount: 14
orderCount: 10
orderCount: 20
orderCount: 12
orderCount: 10
orderCount: 11
}
bid {
price: 363.6
price: 363.4
price: 363.2
price: 363
price: 362.8
price: 362.6
price: 362.4
price: 362.2
price: 362
price: 361.8
volume: 9400
volume: 19900
volume: 35300
volume: 74200
volume: 26300
volume: 16700
volume: 22500
volume: 21100
volume: 40500
volume: 5600
orderCount: 16
orderCount: 23
orderCount: 36
orderCount: 79
orderCount: 30
orderCount: 32
orderCount: 31
orderCount: 34
orderCount: 143
orderCount: 26
}
Subscribe to Tick-by-Tick Trade Data
Subscribe Method
Push_client.subscribe_tick(symbols)
Unsubscribe Method
PushClient.unsubscribe_tick(symbols)
Description
An asynchronous subscription interface for tick‑by‑tick trade data.
To receive tick updates, implement the PushClient.tick_changed interface. Unlike other market data subscriptions, tick data is returned in a compressed format and does not use the original Protobuf schema. Instead, data is delivered as:
tigeropen.push.pb.trade_tick.TradeTick
Tick-by-tick data behavior:
- Push frequency: every 200 ms
- Delivery mode: snapshot
- Each push contains the latest 50 tick records
Parameters
| Parameter | Type | Description |
|---|---|---|
| symbols | list[str] | List of security symbols |
Example
from tigeropen.push.pb.trade_tick import TradeTick
from tigeropen.push.push_client import PushClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'))
# Subscribe callback method
def on_tick_changed(data: TradeTick):
print(f'tick changed: {data}')
# Bind callback method
push_client.tick_changed = on_tick_changed
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe to tick-by-tick transaction data
push_client.subscribe_tick(['XYZX'])
time.sleep(10)
# Unsubscribe
push_client.unsubscribe_tick(['XYZX'])
# Disconnect, will cancel all subscriptions
push_client.disconnect()Callback Data
tigeropen.push.pb.trade_tick.TradeTick
The TradeTick object is structured as follows:
| Field | Type | Description |
|---|---|---|
| symbol | str | Stock symbol |
| secType | str | Security type: STK (stock) |
| quoteLevel | str | Quote permission level where the data originates (US stocks only). USQuoteBasic provides less tick data than USStockQuote |
| timestamp | int | Timestamp of tick data batch |
| ticks | list[TradeTickItem] | Collection of tick-by-tick trade records |
Each element in ticks represents an individual trade and has the following structure:
Field | Type | Description |
|---|---|---|
sn | int | Tick sequence number |
volume | int | Trade volume |
tickType | str | Price movement indicator:
|
price | double | Trade price |
time | int | Trade timestamp |
cond | str | Trade condition list for each tick. An empty value indicates automatic matching trades |
partCode | str | Exchange code for each trade (US stocks only) |
partName | str | Exchange name for each trade (US stocks only) |
Callback Data Example
symbol: "00700"
type: "-+"
sn: 37998
priceBase: 3636
priceOffset: 1
time: 1677742815311
time: 69
price: 0
price: 2
volume: 500
volume: 100
quoteLevel: "StockQuoteLv2"
timestamp: 1677742815776
secType: "STK"
Subscribe to Full Tick-by-Tick Trade Data
Subscribe Method
Push_client.subscribe_tick(symbols)
Unsubscribe Method
PushClient.unsubscribe_tick(symbols)
Description
An asynchronous subscription interface for full tick‑by‑tick trade data.
To receive full tick updates, implement the PushClient.full_tick_changed interface.
Full tick data is delivered using the following callback object:
tigeropen.push.pb.TickData_pb2.TickData
Parameters
| Parameter | Type | Description |
|---|---|---|
| symbols | list[str] | List of security codes |
To enable full tick mode, update the client configuration before initializing PushClient:
client_config.use_full_tick = True
push_client = PushClient(client_config=client_config)Example
from tigeropen.push.pb.TickData_pb2 import TickData
from tigeropen.push.push_client import PushClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
client_config.use_full_tick = True
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'), client_config=client_config)
# Subscribe callback method
def on_full_tick_changed(frame: TickData):
print(f'full tick changed: {frame}')
# Bind callback method
push_client.full_tick_changed = on_full_tick_changed
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe to tick-by-tick transaction data
push_client.subscribe_tick(['XYZX', '00700'])
time.sleep(10)
# Unsubscribe
push_client.unsubscribe_tick(['XYZX'])
# Disconnect, will cancel all subscriptions
push_client.disconnect()Callback Data
Full tick‑by‑tick trade updates are returned as TickData objects:
tigeropen.push.pb.TickData_pb2.TickData
TickData Structure:
| Field | Type | Description |
|---|---|---|
| symbol | str | Stock |
| source | str | Security type: STK (stock) |
| timestamp | int | Timestamp of the tick data batch |
| ticks | list[Tick] | Collection of tick‑by‑tick trade records |
Each element in ticks has the following data structure:
Field | Type | Description |
|---|---|---|
sn | int | Tick sequence number |
volume | int | Trade volume |
type | str | Price movement indicator:
|
price | double | Trade price |
time | int | Trade timestamp |
partCode | str | Exchange code for each trade (US stocks only) |
Callback Data Example
symbol: "XYZX"
ticks {
sn: 2381
time: 1712669401076
price: 874.1
volume: 10
type: "*"
partCode: "t"
}
ticks {
sn: 2382
time: 1712669401076
price: 874.1
volume: 11
type: "*"
partCode: "t"
}
ticks {
sn: 2383
time: 1712669401076
price: 874.1
volume: 3
type: "*"
partCode: "t"
}
timestamp: 1712669403808
source: "NLS"
Subscribe to Stock Popular Trading Rankings
Subscribe Method
PushClient.subscribe_stock_top(market, indicators=None)
Unsubscribe Method
PushClient.unsubscribe_stock_top(market, indicators=None)
Description
Subscribe to stock market ranking data based on popular trading indicators.
- Data is pushed only during trading hours
- Push interval: every 30 seconds
- Each push returns the top 30 symbols for each subscribed indicator
- Data is delivered via an asynchronous callback
To receive ranking updates, implement the ApiComposeCallback interface.
The callback returns results as StockTopData objects.
For each indicator, symbols are sorted in descending order by indicator value.
Supported Markets & Indicators
- US stocks
- Intraday rankings support all indicators defined in StockRankingIndicator
Pre‑market and after‑hours sessions support only:
- Change rate (changeRate)
- 5‑minute change rate (changeRate5Min)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| market | str or Market enum | Yes | Market identifier (e.g., US) |
| indicators | list[tigeropen.common.consts.StockRankingIndicator] | No | List of stock ranking indicators to subscribe to. If not specified, all supported indicators are subscribed. See below for enum values |
The following indicator values are supported:
- changeRate — Daily price change rate
- changeRate5Min— 5‑minute price change rate
- turnoverRate— Turnover rate
- amount— Daily turnover amount
- volume— Daily trading volume
- amplitude— Daily price amplitude
Note: Pre-market and after-hours rankings support only changeRate and changeRate5Min
Callback Data
Bind the callback handler using:
push_client.stock_top_changed
StockTopData Structure:
| Field | Type | Description |
|---|---|---|
| market | str | Market identifier: US |
| timestamp | int | Timestamp of the ranking data |
| topData | list[TopData] | Ranking data grouped by indicator |
TopData Structure:
| Field | Type | Description |
|---|---|---|
| targetName | str | Indicator name, such as changeRate, changeRate5Min, turnoverRate, amount, volume, or amplitude |
| item | list[StockItem] | Ranked list of stocks for this indicator |
StockItem Structure:
| Field | Type | Description |
|---|---|---|
| symbol | str | Stock symbol |
| latestPrice | float | Latest price |
| targetValue | float | Value of the corresponding ranking indicator |
Example
from tigeropen.push.push_client import PushClient
from tigeropen.common.consts import OptionRankingIndicator, StockRankingIndicator
from tigeropen.push.pb.StockTopData_pb2 import StockTopData
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'))
# Define callback method
def on_stock_top_changed(frame: StockTopData):
print(f'stock top changed: {frame}')
# Bind callback method
push_client.stock_top_changed = on_stock_top_changed
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe
push_client.subscribe_stock_top("US", [StockRankingIndicator.Amount])
# Unsubscribe
push_client.unsubscribe_stock_top("US", [StockRankingIndicator.Amount])
Callback Data Example
topData {
targetName: "amount"
item {
symbol: "02800"
latestPrice: 19.55
targetValue: 3338633741
}
item {
symbol: "00700"
latestPrice: 338.8
targetValue: 2950736047
}
item {
symbol: "02828"
latestPrice: 66.34
targetValue: 1533436182
}
item {
symbol: "09988"
latestPrice: 85.2
targetValue: 1396707122
}
item {
symbol: "02269"
latestPrice: 37.1
targetValue: 1238930730
}
item {
symbol: "03690"
latestPrice: 127.9
targetValue: 1167532142
}
item {
symbol: "01211"
latestPrice: 262.6
targetValue: 716540400
}
item {
symbol: "03033"
latestPrice: 3.916
targetValue: 629691374
}
item {
symbol: "01357"
latestPrice: 3.29
targetValue: 589222680
}
item {
symbol: "02318"
latestPrice: 50.25
targetValue: 572686837
}
item {
symbol: "01299"
latestPrice: 80.25
targetValue: 510098294
}
item {
symbol: "09888"
latestPrice: 139.7
targetValue: 504564066
}
item {
symbol: "00388"
latestPrice: 303.8
targetValue: 488918091
}
item {
symbol: "07226"
latestPrice: 4.85
targetValue: 477161727
}
item {
symbol: "01398"
latestPrice: 4.16
targetValue: 459215853
}
item {
symbol: "02331"
latestPrice: 43.2
targetValue: 439082885
}
item {
symbol: "02015"
latestPrice: 137.8
targetValue: 407068273
}
item {
symbol: "09618"
latestPrice: 143.9
targetValue: 389690725
}
item {
symbol: "07552"
latestPrice: 6.59
targetValue: 387550625
}
item {
symbol: "01024"
latestPrice: 54.85
targetValue: 350567971
}
item {
symbol: "00981"
latestPrice: 20.65
targetValue: 349594737
}
item {
symbol: "00386"
latestPrice: 4.47
targetValue: 347819789
}
item {
symbol: "00883"
latestPrice: 11.12
targetValue: 320431605
}
item {
symbol: "09868"
latestPrice: 44.05
targetValue: 292605044
}
item {
symbol: "02020"
latestPrice: 81.95
targetValue: 285153726
}
item {
symbol: "03968"
latestPrice: 36.25
targetValue: 273604906
}
item {
symbol: "00939"
latestPrice: 5.05
targetValue: 270755731
}
item {
symbol: "01088"
latestPrice: 23.6
targetValue: 265332533
}
item {
symbol: "00020"
latestPrice: 2.14
targetValue: 256621941
}
item {
symbol: "00941"
latestPrice: 63.25
targetValue: 248440129
}
}
Subscribe to Option Popular Trading Rankings
Subscribe
PushClient.subscribe_option_top(market, indicators=None)
Unsubscribe Method
PushClient.unsubscribe_option_top(market, indicators=None)
Description
Subscribe to options market ranking data.
- Data is pushed only during trading hours
- Push interval: every 30 seconds
- Each push contains the top 50 underlying symbols for each subscribed indicator
- Data is delivered via an asynchronous callback
To receive ranking updates, implement the ApiComposeCallback interface.
The callback returns an OptionTopData object with the following behavior:
- Unusual large orders (
bigOrder)- Single trades with volume greater than 1,000
- Sorted by transaction time in descending order (most recent first)
- Other indicators
- Values are cumulative for the current trading day
- Sorted in descending order by indicator value
Supported Markets & Indicators
- US options
- Intraday rankings support all indicators defined in
OptionRankingIndicator
Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| market | str or Market enum | Yes | Market identifier. Supported values: US |
| indicators | list[tigeropen.common.consts.OptionRankingIndicator] | No | List of option ranking indicators to subscribe to. If not specified, all supported indicators are subscribed |
The following OptionRankingIndicator values are supported:
- bigOrder — Unusual large orders (single trade volume > 1,000)
- volume — Daily cumulative trading volume
- amount — Daily cumulative turnover amount
- openInt — Open interest
Callback Data
Bind the callback handler using push_client.option_top_changed
OptionTopData Structure:
| Field | Type | Description |
|---|---|---|
| market | string | Market identifier (e.g., US) |
| timestamp | long | Timestamp of the ranking data |
| topData | list[TopData] | Ranking data grouped by indicator |
TopData Structure:
| Field | Type | Description |
|---|---|---|
| targetName | string | Indicator name (bigOrder, volume, amount, openInt) |
| bigOrder | list[BigOrder] | List of unusual large order records (present only when targetName is bigOrder) |
| item | list[OptionItem] | Ranking results for this indicator |
BigOrder Structure:
| Field | Type | Description |
|---|---|---|
| symbol | str | Underlying stock or ETF symbol |
| expiry | str | Option expiration date (YYYYMMDD) |
| strike | str | Strike price |
| right | str | Option type: CALL or PUT |
| dir | str | Trade direction: BUY, SELL, or NONE |
| volume | float | Trade volume |
| price | float | Trade price |
| amount | float | Turnover amount |
| tradeTime | int | Trade timestamp |
OptionItem Structure:
| Field | Type | Description |
|---|---|---|
| symbol | str | Stock ETF underlying |
| expiry | str | Expiry date, format: yyyyMMdd |
| strike | str | Strike price |
| right | str | CALL/PUT |
| totalAmount | float | Turnover |
| totalVolume | float | Volume |
| totalOpenInt | float | Open interest |
| volumeToOpenInt | float | Volume/Open interest |
| latestPrice | float | Latest price |
| updateTime | int | Indicator data update timestamp |
Example
from tigeropen.push.push_client import PushClient
from tigeropen.common.consts import OptionRankingIndicator
from tigeropen.push.pb.OptionTopData_pb2 import OptionTopData
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'))
# Define callback method
def on_option_top_changed(frame: OptionTopData):
print(f'option top changed: {frame}')
# Bind callback method
push_client.option_top_changed = on_option_top_changed
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe
push_client.subscribe_option_top("US", [OptionRankingIndicator.Amount])
# Unsubscribe
push_client.unsubscribe_option_top("US", [OptionRankingIndicator.Amount])Callback Data Example
{
"market":"US",
"timestamp":"1687277160445",
"topData":[
{
"targetName":"volume",
"item":[
{
"symbol":"SPY",
"expiry":"20230620",
"strike":"435.0",
"right":"PUT",
"totalAmount":5394115,
"totalVolume":212478,
"totalOpenInt":16377,
"volumeToOpenInt":0.012467,
"latestPrice":0.25,
"updateTime":"1687277254390"
},
{
"symbol":"SPY",
"expiry":"20230620",
"strike":"436.0",
"right":"PUT",
"totalAmount":7754077,
"totalVolume":194423,
"totalOpenInt":13403,
"volumeToOpenInt":0.011408,
"latestPrice":0.58,
"updateTime":"1687277213603"
},
{
"symbol":"SPY",
"expiry":"20230620",
"strike":"437.0",
"right":"PUT",
"totalAmount":10420625,
"totalVolume":182078,
"totalOpenInt":13973,
"volumeToOpenInt":0.010683,
"latestPrice":1.17,
"updateTime":"1687277213602"
},
{
"symbol":"SPY",
"expiry":"20230620",
"strike":"438.0",
"right":"CALL",
"totalAmount":4482482,
"totalVolume":181899,
"totalOpenInt":961,
"volumeToOpenInt":0.010673,
"latestPrice":0.09,
"updateTime":"1687277213603"
},
{
"symbol":"SPY",
"expiry":"20230620",
"strike":"436.0",
"right":"CALL",
"totalAmount":7331667,
"totalVolume":150604,
"totalOpenInt":238,
"volumeToOpenInt":0.008837,
"latestPrice":0.66,
"updateTime":"1687277208599"
}
// ......
]
},
{
"targetName":"amount",
"item":[
{
"symbol":"TSLA",
"expiry":"20230721",
"strike":"5.0",
"right":"CALL",
"totalAmount":34061561,
"totalVolume":1812,
"totalOpenInt":18,
"volumeToOpenInt":0.00023,
"latestPrice":259.99,
"updateTime":"1687276953360"
},
{
"symbol":"TSLA",
"expiry":"20230721",
"strike":"500.0",
"right":"PUT",
"totalAmount":30877216,
"totalVolume":1960,
"volumeToOpenInt":0.000248,
"latestPrice":234.97,
"updateTime":"1687276953360"
},
{
"symbol":"TSLA",
"expiry":"20230623",
"strike":"265.0",
"right":"CALL",
"totalAmount":27928028,
"totalVolume":66361,
"totalOpenInt":12928,
"volumeToOpenInt":0.008405,
"latestPrice":6.5,
"updateTime":"1687277264395"
},
{
"symbol":"SPY",
"expiry":"20230721",
"strike":"420.0",
"right":"CALL",
"totalAmount":21629503,
"totalVolume":11105,
"totalOpenInt":46931,
"volumeToOpenInt":0.000652,
"latestPrice":19.27,
"updateTime":"1687273142271"
},
{
"symbol":"TSLA",
"expiry":"20230623",
"strike":"270.0",
"right":"CALL",
"totalAmount":17657903,
"totalVolume":61012,
"totalOpenInt":14302,
"volumeToOpenInt":0.007728,
"latestPrice":4.52,
"updateTime":"1687277254390"
}
// ......
]
},
{
"targetName":"openInt",
"item":[
{
"symbol":"AMC",
"expiry":"20230721",
"strike":"10.0",
"right":"CALL",
"totalAmount":4933,
"totalVolume":750,
"totalOpenInt":340843,
"volumeToOpenInt":0.00022,
"latestPrice":0.1,
"updateTime":"1687276788220"
},
{
"symbol":"AMC",
"expiry":"20230721",
"strike":"10.0",
"right":"PUT",
"totalVolume":1,
"totalOpenInt":321814,
"latestPrice":6.2,
"updateTime":"1687276853278"
},
{
"symbol":"AMC",
"expiry":"20230721",
"strike":"4.0",
"right":"PUT",
"totalAmount":117982,
"totalVolume":2748,
"totalOpenInt":242101,
"volumeToOpenInt":0.000806,
"latestPrice":0.81,
"updateTime":"1687277034280"
},
{
"symbol":"ATVI",
"expiry":"20240119",
"strike":"85.0",
"right":"PUT",
"totalAmount":3500,
"totalVolume":26,
"totalOpenInt":230702,
"volumeToOpenInt":0.000016,
"latestPrice":7,
"updateTime":"1687274092822"
},
{
"symbol":"EEM",
"expiry":"20231215",
"strike":"47.0",
"right":"CALL",
"totalAmount":310,
"totalVolume":15,
"totalOpenInt":183054,
"volumeToOpenInt":0.000003,
"latestPrice":0.18,
"updateTime":"1687269619956"
}
// ......
]
},
{
"targetName":"bigOrder",
"bigOrder":[
{
"symbol":"AMC",
"expiry":"20230818",
"strike":"10.0",
"right":"PUT",
"dir":"Buy",
"volume":1000,
"price":6.94,
"amount":694000,
"tradeTime":"1687276860753"
},
{
"symbol":"GLPI",
"expiry":"20230818",
"strike":"50.0",
"right":"CALL",
"dir":"Sell",
"volume":1094,
"price":1.2,
"amount":131280,
"tradeTime":"1687276744519"
},
{
"symbol":"AMD",
"expiry":"20230818",
"strike":"140.0",
"right":"CALL",
"dir":"Buy",
"volume":1700,
"price":3.25,
"amount":552500,
"tradeTime":"1687276467421"
},
{
"symbol":"AAPL",
"expiry":"20230915",
"strike":"185.0",
"right":"PUT",
"dir":"Sell",
"volume":1500,
"price":6.65,
"amount":997500,
"tradeTime":"1687276413267"
},
{
"symbol":"BABA",
"expiry":"20240119",
"strike":"75.0",
"right":"PUT",
"dir":"Sell",
"volume":1500,
"price":4.8,
"amount":720000,
"tradeTime":"1687276036749"
}
// ......
]
}
]
}Query Subscribed Symbols
PushClient.query_subscribed_quote()
Description
Query the list of subscribed symbols
This interface is asynchronous. To receive the query result, implement the following callback handler:
PushClient.query_subscribed_callback
Parameters
None
Callback Data
The callback returns a summary of subscription limits and currently subscribed symbols across different data types.
Callback Data Structure:
| Field | Type | Description |
|---|---|---|
| limit | int | Maximum allowed number of subscribed quote symbols (stocks, options) |
| used | int | Current number of subscribed quote symbols (stocks, options) |
| subscribedSymbols | list | List of subscribed quote symbols |
| askBidLimit | int | Maximum allowed number of subscribed depth‑quote (bid/ask) stocks |
| askBidUsed | int | Current number of subscribed depth‑quote stocks |
| subscribedAskBidSymbols | list | List of subscribed depth‑quote stock symbols |
| tradeTickLimit | int | Maximum allowed number of subscribed tick‑by‑tick symbols |
| tradeTickUsed | int | Current number of subscribed tick‑by‑tick symbols |
| subscribedTradeTickSymbols | list | List of subscribed tick‑by‑tick symbols |
Example
from tigeropen.push.push_client import PushClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')
# Initialize PushClient
protocol, host, port = client_config.socket_host_port
push_client = PushClient(host, port, use_ssl=(protocol == 'ssl'), use_protobuf=True)
# Define callback method
def query_subscribed_callback(data):
"""
data example:
{'subscribed_symbols': ['QQQ'], 'limit': 1200, 'used': 1, 'symbol_focus_keys': {'qqq': ['open', 'prev_close', 'low', 'volume', 'latest_price', 'close', 'high']},
'subscribed_quote_depth_symbols': ['XYZX'], 'quote_depth_limit': 20, 'quote_depth_used': 1,
'subscribed_trade_tick_symbols': ['QQQ', '00700'], 'trade_tick_limit': 1200, 'trade_tick_used': 3}
"""
print(f'subscribed data:{data}')
print(f'subscribed symbols:{data["subscribed_symbols"]}')
# Bind callback method
push_client.query_subscribed_callback = query_subscribed_callback
# Establish connection
push_client.connect(client_config.tiger_id, client_config.private_key)
# Subscribe to quotes
push_client.subscribe_quote(['QQQ'])
# Subscribe to depth quotes
push_client.subscribe_depth_quote(['XYZX'])
push_client.subscribe_depth_quote(['HSImain'])
# Subscribe to tick data
push_client.subscribe_tick(['QQQ'])
push_client.subscribe_tick(['HSImain'])
# Query subscribed contracts
push_client.query_subscribed_quote()
time.sleep(10)Callback Data Example
{'subscribed_symbols': ['QQQ'], 'limit': 1200, 'used': 1,
'subscribed_ask_bid_symbols': ['XYZX'], 'ask_bid_limit': 20, 'ask_bid_used': 1,
'subscribed_trade_tick_symbols': ['QQQ', '00700'], 'trade_tick_limit': 1200, 'trade_tick_used': 3
}Updated 7 days ago