Market Subscriptions
Example context
import { createClientConfig, PushClient } from '@tigeropenapi/tigeropen';
const config = createClientConfig();
const pushClient = new PushClient(config);
// Set up callback functions
pushClient.setCallbacks({
onConnect: () => {
console.log('Connected');
// Subscribe after connection is established
pushClient.subscribeQuote(['AAPL', '00700']);
},
onQuote: (data) => {
console.log('Quote update:', data.symbol, data.latestPrice);
},
onTick: (data) => {
console.log('Tick update:', data.symbol, data.ticks.length);
},
onKline: (data) => {
console.log('Kline update:', data.symbol);
},
onDisconnect: () => {
console.log('Disconnected');
},
onError: (err) => {
console.error('Error:', err.message);
},
});
// Initiate connection
pushClient.connect();Stock quotes
Subscribe
Signature
subscribeQuote(symbols: string[]): voidPurpose
Subscribes to stock quote updates. Data is received through the onQuote callback.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeQuote(['AAPL', '00700']);Callback data example (received via onQuote)
BBO update (type=2, best bid/offer change only):
{
"symbol": "00700",
"type": 2,
"timestamp": 1785826149941,
"serverTimestamp": 1785826149946,
"latestPrice": 485.4,
"askPrice": 485.6,
"askSize": 13000,
"bidPrice": 485.2,
"bidSize": 6300,
"volume": 28453200,
"amount": 13792456000
}BASIC update (type=1, full quote snapshot):
{
"symbol": "AAPL",
"type": 1,
"timestamp": 1785826200000,
"serverTimestamp": 1785826200005,
"latestPrice": 198.52,
"latestPriceTimestamp": 1785826199800,
"preClose": 197.96,
"volume": 45230100,
"amount": 8975632000,
"open": 198.10,
"high": 199.62,
"low": 197.80,
"avgPrice": 198.35
}The
typefield:1= BASIC (full quote snapshot),2= BBO (best bid/offer update only).
For the Quote data type, the current dispatcher does not inspectQuoteData.type, so both BASIC and BBO go toonQuote. The public callback interface still declaresonQuoteBBO, but the current dispatch path does not invoke it.
Unsubscribe
Signature
unsubscribeQuote(symbols?: string[]): voidPurpose
Unsubscribes from quote updates. If no symbols are passed, unsubscribes from all quotes.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | No | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeQuote(['AAPL']);Trade ticks
Ordinary ticks
Signature
subscribeTick(symbols: string[]): voidPurpose
Subscribes to trade tick updates. In ordinary mode, onTick receives PushTradeTick. Push frequency and batch size vary with available market data.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeTick(['AAPL']);Callback data example (received via onTick)
{
"symbol": "AAPL",
"secType": "STK",
"quoteLevel": "usStockQuote",
"timestamp": 1785826150651,
"ticks": [
{
"sn": 63725,
"time": 1785826150107,
"price": 485.6,
"volume": 200,
"tickType": "+",
"cond": "US_REGULAR_SALE",
"partCode": "NSDQ",
"partName": "NASDAQ Stock Market, LLC (NASDAQ)"
}
]
}| Field | Type | Description |
|---|---|---|
symbol | string | Stock symbol |
secType | string | Security type, such as STK |
quoteLevel | string | Quote entitlement level |
timestamp | number | Push time in milliseconds |
ticks | PushTick[] | Trade ticks decoded by the SDK |
ticks[].sn | number | Tick sequence number |
ticks[].time | number | Decoded trade time in milliseconds |
ticks[].price | number | Decoded trade price |
ticks[].volume | number | Trade size |
ticks[].tickType | string | + buyer-initiated, - seller-initiated, * neutral |
ticks[].cond | string | Decoded trade condition; see Trade Tick Conditions |
ticks[].partCode / ticks[].partName | string | Resolved venue abbreviation/name |
Full ticks
Signature
new PushClient(config, { useFullTick: true })
subscribeTick(symbols: string[]): voidPurpose
Full stock ticks use the same subscribeTick method as ordinary ticks. Set useFullTick: true before connect() to receive TickData through onFullTick. Full-tick access must be enabled separately; contact OpenAPI technical support.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | — |
Returns
void
Type-checked example
const pushClient = new PushClient(config, { useFullTick: true });
pushClient.setCallbacks({
onFullTick: (data) => console.log('Full tick:', data),
});
await pushClient.connect();
pushClient.subscribeTick(['AAPL']);Callback data example (received via onFullTick)
{
"symbol": "AAPL",
"timestamp": 1785826200000,
"source": "",
"ticks": [
{
"sn": 128450,
"time": 1785826199800,
"price": 198.52,
"volume": 100,
"type": "+",
"cond": "",
"partCode": "d"
},
{
"sn": 128451,
"time": 1785826199850,
"price": 198.50,
"volume": 200,
"type": "-",
"cond": "",
"partCode": "d"
}
]
}Full tick data does not use delta encoding; each trade includes absolute price and time values.
type:+active buy,-active sell,*neutral.
| Field | Type | Description |
|---|---|---|
symbol | string | Stock symbol |
timestamp | number | Push time in milliseconds |
source | string | Data source; may be empty |
ticks | TickData_Tick[] | Full-tick list |
ticks[].sn | number | Arrival-order sequence number, for reference only |
ticks[].time | number | Trade time in milliseconds |
ticks[].price | number | Trade price |
ticks[].volume | number | Trade size |
ticks[].type | string | + buyer-initiated, - seller-initiated, * neutral |
ticks[].cond | string | Raw one-character trade condition; may be empty. See Trade Tick Conditions |
ticks[].partCode | string | Raw execution-venue code; may be empty |
Unsubscribe
Signature
unsubscribeTick(symbols?: string[]): voidPurpose
Unsubscribes from ordinary or full tick updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | No | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeTick(['AAPL']);Market depth
Subscribe
Signature
subscribeDepth(symbols: string[]): voidPurpose
Subscribes to order book depth updates. US market depth updates every 300ms, while Hong Kong market depth updates every 2s. Data is received through the onDepth callback.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeDepth(['00700']);Callback data example (received via onDepth)
{
"symbol": "00700",
"timestamp": 1785826150200,
"ask": {
"price": [485.6, 485.8, 486.0, 486.2, 486.4],
"volume": [13000, 8500, 22000, 5600, 3200],
"orderCount": [5, 3, 8, 2, 1],
"exchange": [],
"time": []
},
"bid": {
"price": [485.4, 485.2, 485.0, 484.8, 484.6],
"volume": [6300, 15200, 9800, 4100, 7500],
"orderCount": [3, 6, 4, 2, 3],
"exchange": [],
"time": []
}
}HK market includes
orderCount(number of orders at each price level). Theexchangeandtimefields are used for option exchange information.
Unsubscribe
Signature
unsubscribeDepth(symbols?: string[]): voidPurpose
Unsubscribes from depth updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | No | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeDepth(['00700']);Option quotes
Subscribe
Signature
subscribeOption(symbols: string[]): voidPurpose
Subscribes to option quote updates. Data is received through the onOption callback with the same QuoteData structure as onQuote.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeOption(['AAPL 250718C00200000']);Callback data example (received via onOption)
{
"symbol": "AAPL 250718C00200000",
"type": 1,
"timestamp": 1785826200000,
"serverTimestamp": 1785826200003,
"latestPrice": 5.30,
"preClose": 5.15,
"volume": 12580,
"identifier": "AAPL 250718C00200000",
"openInt": 45230,
"askPrice": 5.35,
"askSize": 120,
"bidPrice": 5.25,
"bidSize": 85
}Option quotes additionally include
identifier(contract identifier) andopenInt(open interest).
Unsubscribe
Signature
unsubscribeOption(symbols?: string[]): voidPurpose
Unsubscribes from option updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | No | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeOption(['AAPL 250718C00200000']);Futures quotes
Subscribe
Signature
subscribeFuture(symbols: string[]): voidPurpose
Subscribes to futures quote updates. Data is received through the onFuture callback with the same QuoteData structure as onQuote.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeFuture(['ES2506']);Callback data example (received via onFuture)
{
"symbol": "ES2506",
"type": 1,
"timestamp": 1785826200000,
"serverTimestamp": 1785826200002,
"latestPrice": 5425.50,
"preClose": 5410.25,
"preSettlement": 5412.00,
"volume": 1520300,
"tradeTime": 1785826199500,
"minTick": 0.25,
"askPrice": 5425.75,
"askSize": 150,
"bidPrice": 5425.50,
"bidSize": 230
}Futures quotes additionally include
preSettlement(previous settlement price),tradeTime(latest trade time), andminTick(minimum price increment).
Unsubscribe
Signature
unsubscribeFuture(symbols?: string[]): voidPurpose
Unsubscribes from futures updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | No | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeFuture(['ES2506']);Klines
Subscribe
Signature
subscribeKline(symbols: string[]): voidPurpose
Subscribes to minute kline (candlestick) updates. Data is received through the onKline callback.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeKline(['AAPL']);Callback data example (received via onKline)
{
"symbol": "AAPL",
"time": 1785826140000,
"open": 198.35,
"high": 198.62,
"low": 198.20,
"close": 198.52,
"avg": 198.41,
"volume": 125600,
"count": 890,
"amount": 24920000,
"serverTimestamp": 1785826200005
}The same minute may receive multiple K-line callbacks; update the current minute by matching
time.timeis the start timestamp of that minute bar;countis the number of trades within that minute.
Unsubscribe
Signature
unsubscribeKline(symbols?: string[]): voidPurpose
Unsubscribes from kline updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
symbols | string[] | No | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeKline(['AAPL']);Stock rankings
Subscribe
Signature
subscribeStockTop(market: string, indicators: string[]): voidPurpose
Subscribes to stock top ranking updates. Data is received through the onStockTop callback.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
market | string | Yes | None | — |
indicators | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeStockTop('US', ['changeRate', 'volume']);Callback data example (received via onStockTop)
{
"market": "US",
"timestamp": 1785826200000,
"topData": [
{
"targetName": "volume",
"item": [
{ "symbol": "NVDA", "latestPrice": 135.20, "targetValue": 82500000 },
{ "symbol": "TSLA", "latestPrice": 248.50, "targetValue": 65300000 },
{ "symbol": "AAPL", "latestPrice": 198.52, "targetValue": 45230100 }
]
},
{
"targetName": "changeRate",
"item": [
{ "symbol": "XYZ", "latestPrice": 12.80, "targetValue": 0.156 },
{ "symbol": "ABC", "latestPrice": 45.30, "targetValue": 0.098 }
]
}
]
}Supported
targetNameindicators:changeRate(price change %),changeRate5Min(5-min change %),turnoverRate(turnover rate),amount(trade amount),volume(trade volume),amplitude(price amplitude).
Unsubscribe
Signature
unsubscribeStockTop(market: string, indicators: string[]): voidPurpose
Unsubscribes from stock top updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
market | string | Yes | None | — |
indicators | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeStockTop('US', ['volume']);Option rankings
Subscribe
Signature
subscribeOptionTop(market: string, indicators: string[]): voidPurpose
Subscribes to option top ranking updates. Data is received through the onOptionTop callback.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
market | string | Yes | None | — |
indicators | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.subscribeOptionTop('US', ['volume', 'bigOrder']);Callback data example (received via onOptionTop)
{
"market": "US",
"timestamp": 1785826200000,
"topData": [
{
"targetName": "volume",
"bigOrder": [],
"item": [
{
"symbol": "TSLA",
"expiry": "20250718",
"strike": "260.0",
"right": "CALL",
"totalAmount": 5820000,
"totalVolume": 98500,
"totalOpenInt": 125000,
"volumeToOpenInt": 0.788,
"latestPrice": 8.65,
"updateTime": 1785826199000
}
]
},
{
"targetName": "bigOrder",
"bigOrder": [
{
"symbol": "AAPL",
"expiry": "20250718",
"strike": "200.0",
"right": "CALL",
"dir": "BUY",
"volume": 5000,
"price": 5.30,
"amount": 2650000,
"tradeTime": 1785826180000
}
],
"item": []
}
]
}Supported
targetNameindicators:bigOrder(large orders),volume(trade volume),amount(trade amount),openInt(open interest). Big order threshold: single trade volume > 1000 contracts.
Unsubscribe
Signature
unsubscribeOptionTop(market: string, indicators: string[]): voidPurpose
Unsubscribes from option top updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
market | string | Yes | None | — |
indicators | string[] | Yes | None | — |
Returns
void
Type-checked example
pushClient.unsubscribeOptionTop('US', ['volume']);Cryptocurrency quotes
Subscribe
Signature
subscribeCc(symbols: string[]): voidPurpose
Subscribes to cryptocurrency real-time quotes. Data is received as QuoteData through onQuote; this method is not used for full stock ticks.
pushClient.subscribeCc(['BTC.USD', 'ETH.USD']);Unsubscribe
Signature
unsubscribeCc(symbols?: string[]): voidpushClient.unsubscribeCc(['BTC.USD']);HK whole-market quotes
Subscribe
Signature
subscribeMarket(market: string): voidPurpose
Subscribes to quote updates for the whole Hong Kong market. The server delivers ongoing per-symbol QuoteData through the ordinary onQuote callback; this is neither a market-status subscription nor a one-time market snapshot or stock-ranking subscription.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
market | string | Yes | None | Only HK is supported |
Returns
void
Type-checked example
pushClient.subscribeMarket('HK');Unsubscribe
Signature
unsubscribeMarket(market: string): voidPurpose
Unsubscribes from whole-market Hong Kong quote updates.
Parameters, defaults, and constraints
| Parameter | Type | Required | SDK default | Constraints |
|---|---|---|---|---|
market | string | Yes | None | Only HK is supported |
Returns
void
Type-checked example
pushClient.unsubscribeMarket('HK');Updated about 1 month ago
