Securities
Initialization
All examples on this page assume the following initialization has been completed:
from tigeropen.tiger_open_config import TigerOpenClientConfig
from tigeropen.quote.quote_client import QuoteClient
client_config = TigerOpenClientConfig(props_path='your_config_directory_path')
quote_client = QuoteClient(client_config)For details, see Prerequisites.
Get Market Status
QuoteClient.get_market_status(market=Market.ALL, lang=None)
Description
Retrieves the trading status of specified markets (such as intraday, pre-market, after-hours, etc.) and retrieve the latest opening time for that market.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| market | Market | No | The market to query. You use enum constants provided under tigeropen.common.consts.Market, such as Market.US. Defaults to Market.ALL (all markets). See enum parameters section |
| lang | Language | No | Supported language. You use enum constants provided under tigeropen.common.consts.Language, such as Language.zh_CN. defaults to Language.en_US. See enum parameters section |
Return
list
Elements are MarketStatus objects. MarketStatus structure is as follows:
| Parameter | Type | Description |
|---|---|---|
| market | str | Market name |
| trading_status | str | Trading status code: NOT_YET_OPEN (not yet open); PRE_HOUR_TRADING (pre-market trading); TRADING (trading); MIDDLE_CLOSE (midday break); POST_HOUR_TRADING (after-hours trading); CLOSING (closed); EARLY_CLOSED (early close); MARKET_CLOSED (market closed) |
| status | str | Trading status description |
| open_time | datetime | Latest opening trading time with timezone information |
Example
market_status = quote_client.get_market_status(Market.US)
# View attributes
print(market_status)Example Response
[MarketStatus({'market': 'US', 'status': 'Pre-market Trading', 'open_time': datetime.datetime(2019, 1, 7, 9, 30, tzinfo=<DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>), 'trading_status': 'PRE_HOUR_TRADING'})]
Get Market Trading Calendar
QuoteClient.get_trading_calendar(market, begin_date=None, end_date=None)
Description
Provides market trading calendars from 2015 to the end of the current year (excludes weekends and legal holidays for that market, but does not exclude temporary market closures). If the selected time exceeds the available range, start and end times will be automatically adjusted to the available data range.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| market | Market | Yes | The market to query. You use enum constants provided under tigeropen.common.consts.Market, such as Market.US. See enum parameters section |
| begin_date | str | No | Calendar start time, result includes this date. Format: yyyy-MM-dd, e.g., '2022-06-01' |
| end_date | str | No | Calendar end time, result excludes this date. Format: yyyy-MM-dd, e.g., '2022-06-01' |
begin_time and end_time parameter handling:
| begin_time passed | end_time passed | Description |
|---|---|---|
| yes | yes | begin_time and end_time are the passed values |
| yes | no | end_time is 365 days after begin_time |
| no | yes | begin_time is 365 days before end_time |
| no | no | begin_time is current date, end_time is 30 days after begin_time |
Return
list
Each element is a dict, with the following key meanings:
| Parameter | Type | Description |
|---|---|---|
| date | str | Trading day date |
| type | str | Trading day type: TRADING for normal trading day; EARLY_CLOSE for early close (non-trading days are excluded from results) |
| open_time | str | Market open time, e.g. "09:30:00", in the market's local timezone |
| close_time | str | Market close time, e.g. "16:00:00" (or "13:00:00" on early-close days), in the market's local timezone |
Example
calendar = quote_client.get_trading_calendar(Market.US, begin_date='2022-11-01', end_date='2022-12-01')
print(calendar)Example Response
[
{
"date": "2025-07-02",
"type": "TRADING",
"open_time": "09:30:00",
"close_time": "16:00:00"
},
{
"date": "2025-07-03",
"type": "EARLY_CLOSE",
"open_time": "09:30:00",
"close_time": "13:00:00"
},
{
"date": "2025-07-07",
"type": "TRADING",
"open_time": "09:30:00",
"close_time": "16:00:00"
}
]Note: Non-trading days (weekends and market holidays) are excluded from the results. In the example above, July 4 (Independence Day) and July 5-6 (weekend) are all excluded.
Get All Symbols
QuoteClient.get_symbols(market=Market.ALL, include_otc=False)
Description
Retrieves a list of all security symbols for the specified market, including delisted or temporarily non-tradable securities, as well as index codes.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| market | Market | No | The market to query. You use enum constants provided under tigeropen.common.consts.Market, such as Market.US. Defaults to Market.ALL (all markets) |
| include_otc | bool | No | Whether to include OTC securities |
Return
Type
list
Elements are symbols of all securities in the market, including delisted and non-tradable symbols. Codes starting with . are indices, e.g., .DJI represents the Dow Jones Index.
Example
symbols = quote_client.get_symbols(Market.US)
print(symbols)Example Response
['.DJI', '.IXIC', '.SPX', 'A', 'AA', 'AAA', 'AAAU', 'AAC', 'AAC.U', 'AAC.WS', 'AACG', 'AACI', 'AACIU', 'AACIW', 'AACQW', 'AADI', 'AADR', 'AAIC', 'AAIN', 'AAL', 'AAMC', 'AAME', 'AAN', 'AAOI', 'AAON', 'AAP', 'AAPL',....,'ZYME', 'ZYNE', 'ZYXI']
Get Symbols and Names
QuoteClient.get_symbol_names(market=Market.ALL, lang=None, include_otc=False)
Description
Retrieves all security symbols and names for a specified market.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| market | Market | No | The market to query. You use enum constants provided under tigeropen.common.consts.Market, such as Market.US. Defaults to Market.ALL (all markets) |
| lang | Language | No | Supported language. You use enum constants provided under tigeropen.common.consts.Language, defaults to English |
| include_otc | bool | No | Whether to include OTC securities |
Return
list
Each element in the list is a tuple, where the first element is the symbol and the second element is the name.
Example
symbol_names = quote_client.get_symbol_names(market=Market.ALL)
print(symbol_names)Example Response
[('AAAP', 'Advanced Accelerator Applications SA'), ('AAAU', 'Perth Mint Physical Gold ETF'), ('AABA', 'Altaba'), ('AAC', 'AAC Holdings Inc')]
Get Real-time Quotes
QuoteClient.get_stock_briefs(symbols, include_hour_trading=False, lang=None)
Description
Retrieves real-time stock quotes. The required market data access must be purchased before calling this API. Each request supports up to 50 stocks.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | Symbols; maximum 50 stocks, e.g., ['AAPL', 'MSFT'] |
| include_hour_trading | bool | No | Whether to return pre-market and after-hours data |
| lang | Language | No | Supported language. You use enum constants provided in tigeropen.common.consts.Language, defaults to English |
Return
pandas.DataFrame
Structure:
| COLUMN | Type | Description |
|---|---|---|
| symbol | str | Security symbol |
| 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 price |
| latest_price | float | Latest price |
| latest_time | int | Latest trading time, millisecond timestamp |
| volume | int | Trading volume |
| open | float | Opening price |
| high | float | Highest price |
| low | float | Lowest price |
| change | float | Price change |
| changeRate | float | Price change rate |
| amplitude | float | Price amplitude |
| status | str | Trading status |
| adj_pre_close | float | Adjusted previous close price after rights adjustment |
| hour_trading_tag | str | Pre-market ("Pre-Mkt"), after-hours ("Post-Mkt") identifier |
| hour_trading_latest_price | float | Pre-market/after-hours real-time price |
| hour_trading_latest_time | str | Latest trading time (Eastern Time) |
| hour_trading_volume | int | Pre-market/after-hours trading volume |
| hour_trading_timestamp | int | Latest trading time |
status (Trading Status) values:
- "UNKNOWN": Unknown
- "NORMAL": Normal
- "HALTED": Halted
- "DELIST": Delisted
- "NEW": New stock
- "ALTER": Change
- "CIRCUIT_BREAKER": Circuit breaker
- "ST": Special treatment
Example
import pandas as pd
briefs = quote_client.get_stock_briefs(['00700'])
print(briefs)
# Convert latest_time to a datetime in the market's time zone
briefs['cn_date'] = pd.to_datetime(briefs['latest_time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('Asia/Shanghai')
briefs['us_date'] = pd.to_datetime(briefs['latest_time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')Example Response
symbol open high low close pre_close latest_price latest_time \
AAPL 241.225 246.3 240.2106 245.50 237.88 245.50 1758312000000
ask_price ask_size bid_price bid_size volume status adj_pre_close \
0.0 0 0.0 0 163796191 NORMAL 237.88
hour_trading_tag hour_trading_latest_price hour_trading_pre_close \
Post-Mkt 245.69 245.50
hour_trading_latest_time hour_trading_volume hour_trading_timestamp
19:59 EDT 23831923 1758326399684
Get Depth Quotes
QuoteClient.get_depth_quote(symbols, market)
Description
Retrieves N-level bid/ask order data for specified securities, including order price, quantity, and number of orders. Each request supports up to 50 securities.
NOTE
Hong Kong stocks: Market closing auction time on trading days is 16:00-16:10, with actual closing time randomly between 16:08 and 16:10. The last depth quote data for the day is usually updated one to two minutes after 16:10.
US stocks: Depth quotes include pre-market and after-hours trading information. No additional parameters are required; real-time requests can be made directly.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | Symbols; maximum 50 per request |
| market | Market | Yes | The market to query. You use enum constants provided under tigeropen.common.consts.Market |
Return
dict
Data example:
If returning a single symbol:
{'symbol': '03833',
'asks': [(1.81, 139000, 7), (1.82, 211000, 9), (1.83, 245000, 9), (1.84, 59000, 6), (1.85, 83000, 7), (1.86, 30000, 2), (1.87, 54000, 4), (1.88, 141000, 6), (1.89, 180000, 4), (1.9, 117000, 7)],
'bids': [(1.8, 355000, 6), (1.79, 242000, 5), (1.78, 71000, 5), (1.77, 142000, 8), (1.76, 616000, 10), (1.75, 120000, 7), (1.74, 90000, 4), (1.73, 80000, 2), (1.72, 210000, 7), (1.71, 258000, 6)]}If returning multiple symbols:
{'03833':
{'symbol': '03833',
'asks': [(1.81, 131000, 7), (1.82, 164000, 8), (1.83, 245000, 9), (1.84, 59000, 6), (1.85, 83000, 7), (1.86, 30000, 2), (1.87, 54000, 4), (1.88, 141000, 6), (1.89, 180000, 4), (1.9, 117000, 7)],
'bids': [(1.8, 356000, 7), (1.79, 242000, 5), (1.78, 71000, 5), (1.77, 142000, 8), (1.76, 616000, 10), (1.75, 120000, 7), (1.74, 90000, 4), (1.73, 80000, 2), (1.72, 210000, 7), (1.71, 258000, 6)]},
'01810':
{'symbol': '01810',
'asks': [(55.8, 306800, 134), (55.85, 242400, 78), (55.9, 394000, 87), (55.95, 421000, 69), (56.0, 526000, 158), (56.05, 320600, 42), (56.1, 327000, 71), (56.15, 277400, 46), (56.2, 116800, 74), (56.25, 163200, 42)],
'bids': [(55.75, 71200, 46), (55.7, 1013000, 211), (55.65, 574200, 202), (55.6, 1297800, 749), (55.55, 1136200, 485), (55.5, 2075400, 1030), (55.45, 386800, 149), (55.4, 484800, 216), (55.35, 267000, 107), (55.3, 328200, 230)]
}
}The data meaning of list items corresponding to asks and bids is (order price, order quantity, number of orders):
[(ask_price1, ask_volume1, order_count), (ask_price2, ask_volume2, order_count), ...]
[(bid_price1, bid_volume2, order_count), (bid_price2, bid_volume2, order_count), ...]Example
depth_quote = quote_client.get_depth_quote(['02833'], Market.HK)Example Response
{'symbol': '02833',
'asks': [(27.4, 300, 2), (27.45, 500, 1), (27.5, 4400, 1), (27.55, 0, 0), (27.6, 5700, 3), (27.65, 0, 0),
(27.7, 500, 1), (27.75, 0, 0), (27.8, 0, 0), (27.85, 0, 0)],
'bids': [(27, 4000, 3), (26.95, 200, 1), (26.9, 0, 0), (26.85, 400, 1), (26.8, 0, 0), (26.75, 0, 0),
(26.7, 0, 0), (26.65, 0, 0), (26.6, 0, 0), (26.55, 0, 0)]
}Get Tick-by-Tick Trade Data
QuoteClient.get_trade_ticks(symbols, trade_session=None, begin_index=None, end_index=None, limit=None, lang=None)
Description
Retrieves trade tick data. This API supports both querying full tick records for the current trading day after market close and obtaining the latest real-time tick data during trading hours.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | Symbols; maximum 50 |
| trade_session | TradingSession | No | Trading session, use enum constants provided in tigeropen.common.consts.TradingSession, defaults to returning intraday (regular trading session) data |
| begin_index | int | No | Starting index, daily index starts from 0. If begin_index and end_index are set to -1, returns latest tick data. For subsequent queries, use the end_index from previous query as begin_index for continuous querying. Returns data as left-closed, right-open interval, e.g., begin_index=1, end_index=100 returns records 1-99. For next query, set begin_index=100, end_index=200. |
| end_index | int | No | Ending index. The difference between ending and starting index cannot exceed 2000. When greater than 2000, defaults to returning 200 records from starting index. When limit parameter is less than the difference between start and end index, only returns limit number of tick data from starting index. |
| limit | int | No | Return count limit, default: 200, maximum: 2000 |
| lang | Language | No | Supported language, use enum constants provided in tigeropen.common.consts.Language, defaults to English |
Usage Instructions for begin_index and end_index Parameters
| Query Type | begin_index | end_index | Description |
|---|---|---|---|
| Query Latest Tick Data | -1 | -1 | Returns limit number of latest tick records by default. limit defaults to 200 |
| Query Daily Tick by Range | Specific value | Specific value | Example: begin_index=10, end_index=100 returns 90 records from 10 to 99. If limit is set to 20, returns 20 records from 10 to 29. |
Return
pandas.DataFrame
Structure:
| Parameter | Type | Description |
|---|---|---|
| symbol | str | Symbol |
| index | int | Index value |
| time | int | Millisecond timestamp |
| price | float | Trade price |
| volume | int | Trade volume |
| direction | str | Price movement direction, "+" indicates active buy, "-" indicates active sell, "*" indicates neutral |
Example
from tigeropen.common.consts import TradingSession
ticks = quote_client.get_trade_ticks(['00700'])
# Query latest tick data
ticks = quote_client.get_trade_ticks(['AAPL'], begin_index=-1, end_index=-1)
# Request pre-market tick data
ticks = quote_client.get_trade_ticks(['AAPL'], trade_session=TradingSession.PreMarket)
# Request after-hours tick data
ticks = quote_client.get_trade_ticks(['00700'], trade_session=TradingSession.AfterHours)Example Response
symbol time volume price direction index
0 AAPL 1712347199527 291 169.53 - 521645
1 AAPL 1712347199564 200 169.53 - 521646
2 AAPL 1712347199564 400 169.53 - 521647
3 AAPL 1712347199564 500 169.53 - 521648
4 AAPL 1712347199566 900 169.53 - 521649
... ... ... ... ... ... ...
395 AMD 1712347200234 40 170.40 * 556800
396 AMD 1712347200273 55 170.39 * 556801
397 AMD 1712347200274 5 170.39 * 556802
398 AMD 1712347200488 1577655 170.42 * 556803
399 AMD 1712347200489 33 170.42 * 556804Get K-Line Data
QuoteClient.get_bars(symbols, period=BarPeriod.DAY, begin_time=-1, end_time=-1, right=QuoteRight.BR, limit=251, lang=None, page_token=None, trade_session=None)
Description
Retrieves candlestick bars (K-line data) for Hong Kong and US stocks at daily, weekly, monthly, yearly, 1-minute, 5-minute, 15-minute, 30-minute, 60-minute, and other intervals. Each request returns at most 1,200 records. Use multiple requests for longer ranges. The API accepts either a date range or a specific date.
- Minute-level bars (1/5/15/30/60 minutes): Supports nearly 10 years of historical data
- Daily bars and above (daily/weekly/monthly/yearly): Provides complete historical data
US pre-market and after-hours only support 60-minute and below candlestick bars after April 2024
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | List of symbols, single request limit: 50, A-share limit: 30, e.g., ['AAPL', 'GOOG'] |
| period | BarPeriod | No | bar period to retrieve. Default BarPeriod.DAY, use enum constants provided under tigeropen.common.consts.BarPeriod, such as BarPeriod.DAY. 'day'/'week'/'month'/'year'/'1min'/'5min'/'15min'/'30min'/'60min' |
| begin_time | int or str | No | Start time for range query, parameter restrictions: 1-minute and 5-minute bars only support data from the last month, 15/30/60-minute bars support data from the last year. For earlier minute-level bars, please use specific date query. Supports millisecond-level timestamps or date strings, such as 1639371600000 or '2019-06-07 23:00:00' or '2019-06-07'. If passing date strings, will be processed as Beijing time; if time is omitted in date string, defaults to 0 o'clock. Recommend using timestamps to avoid timezone issues in different markets |
| end_time | int or str | No | End time for range query, parameter restrictions: 1-minute and 5-minute bars only support data from the last month, 15/30/60-minute bars support data from the last year. For earlier minute-level bars, please use specific date query. Supports millisecond-level timestamps or date strings, such as 1639371600000 or '2019-06-07 23:00:00' or '2019-06-07'. If passing date strings, will be processed as Beijing time; if time is omitted in date string, defaults to 0 o'clock. Recommend using timestamps to avoid timezone issues in different markets |
| date | string | No | Use this parameter (format: yyyyMMdd) to get minute-level candlestick bars for a specific date.
|
| right | QuoteRight | No | Adjustment method. Default forward adjustment, use enum constants provided under tigeropen.common.consts.QuoteRight, such as QuoteRight.BR for forward adjustment, QuoteRight.NR for no adjustment |
| limit | int | No | Limit the number of data records. Default 251 |
| lang | Language | No | Supported language, use enum constants provided in tigeropen.common.consts.Language, defaults to English |
| page_token | str | No | Pagination token, records pagination position. The next_page_token returned from the previous request can be passed as the starting marker for the next request |
| with_fundamental | bool | No | Whether to return the PE ratio and turnover rate |
| trade_session | TradingSession | No | Trading session, use enum constants provided under tigeropen.common.consts.TradingSession, such as TradingSession.Regular for intraday trading (default), PreMarket for pre-market trading, AfterHours for after-hours trading, OverNight for overnight session (requires version >= 3.3.1) |
When trade_session parameter is set to PreMarket, AfterHours, or OverNight, the period parameter must be one of the following:
BarPeriod.ONE_MINUTE, BarPeriod.THREE_MINUTES, BarPeriod.FIVE_MINUTES, BarPeriod.TEN_MINUTES, BarPeriod.FIFTEEN_MINUTES, BarPeriod.HALF_HOUR, BarPeriod.ONE_HOUR, BarPeriod.TWO_HOURS, or BarPeriod.FOUR_HOURS, otherwise candlestick bars cannot be displayed correctly.
Return
pandas.DataFrame
Structure:
| Parameter | Type | Description |
|---|---|---|
| symbol | str | Symbol |
| time | int | Millisecond timestamp, e.g., 1639371600000 |
| open | float | Opening price of the bar |
| close | float | Closing price of the bar |
| high | float | Highest price of the bar |
| low | float | Lowest price of the bar |
| volume | float | Trading volume of the bar |
| amount | float | Trading amount of the bar |
| turnover_rate | float | Turnover rate. Not returned by default |
| ttm_pe | float | Trailing Twelve Months PE. Not returned by default |
| lyr_pe | float | Last Year Ratio PE. Not returned by default |
| next_page_token | str | Token for the next page |
Example
import pandas as pd
bars = quote_client.get_bars(['AAPL'])
#trade_session optional parameter values
# bars = quote_client.get_bars(['AAPL'],period = BarPeriod.ONE_MINUTE, trade_session=TradingSession.PreMarket)
# bars = quote_client.get_bars(['AAPL'],period = BarPeriod.HALF_HOUR, trade_session=TradingSession.AfterHours)
# bars = quote_client.get_bars(['AAPL'],period = BarPeriod.ONE_MINUTE,trade_session=TradingSession.OverNight)
print(bars.head())
# Minute bars
bars = quote_client.get_bars(symbols, period=BarPeriod.ONE_MINUTE,
begin_time='2023-06-05 00:30:00',
end_time='2023-06-10 23:31:00'
)
# Convert time format
bars['cn_date'] = pd.to_datetime(bars['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('Asia/Shanghai')
bars['us_date'] = pd.to_datetime(bars['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')Example Response
symbol time open high low close volume amount
0 00700 1515474000000 174.5500 175.0600 173.4100 174.33 21583997 1000
1 00700 1515560400000 173.1600 174.3000 173.0000 174.29 23959895 1000
2 00700 1515646800000 174.5900 175.4886 174.4900 175.28 18667729 1000
3 00700 1515733200000 176.1800 177.3600 175.6500 177.09 25418080 1000
4 00700 1516078800000 177.9000 179.3900 176.1400 176.19 29565947 1000
Get K-Line Data by Page
QuoteClient.get_bars_by_page(symbol, period=BarPeriod.DAY, begin_time=-1, end_time=-1, total=10000, page_size=1000, right=QuoteRight.BR, time_interval=2, lang=None, trade_session=None)
Description
Retrieves candlestick bars for specified stocks by page.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | str | Yes | Symbol; only one symbol can be queried at a time |
| period | BarPeriod | No | Bar period to retrieve. Defaults to BarPeriod.DAY. Use enum constants from tigeropen.common.consts.BarPeriod, such as 'day'/'week'/'month'/'year'/'1min'/'5min'/'15min'/'30min'/'60min' |
| begin_time | int or str | No | Start time. Supports millisecond-level timestamp or date string, such as 1639371600000 or '2019-06-07 23:00:00' or '2019-06-07' |
| end_time | int or str | No | End time. Supports millisecond-level timestamp or date string, such as 1639371600000 or '2019-06-07 23:00:00' or '2019-06-07' |
| total | int | No | Total number of bars requested. Default: 10000 |
| page_size | int | No | Number of bars per page. Default: 1000 |
| right | QuoteRight | No | Rights adjustment method. Default forward adjustment, use enum constants from tigeropen.common.consts.QuoteRight, such as QuoteRight.BR for forward adjustment, QuoteRight.NR for no adjustment |
| time_interval | int | No | Time interval for each request in seconds, default: 2 seconds |
| lang | Language | No | Supported language, use enum constants from tigeropen.common.consts.Language, default English |
| trade_session | TradingSession | No | Trading session, use enum constants from tigeropen.common.consts.TradingSession, such as TradingSession.PreMarket for pre-market trading, TradingSession.AfterHours for after-hours trading, TradingSession.Regular for regular trading |
Returns
pandas.DataFrame
Structure:
| Parameter | Type | Description |
|---|---|---|
| time | int | Millisecond timestamp, e.g. 1639371600000 |
| open | float | Opening price of the bar |
| close | float | Closing price of the bar |
| high | float | Highest price of the bar |
| low | float | Lowest price of the bar |
| volume | float | Volume of the bar |
| next_page_token | str | Page token for the next page |
Example
import pandas as pd
bars = quote_client.get_bars_by_page(
'AAPL',
period=BarPeriod.DAY,
begin_time='2024-06-25 21:30:00',
end_time='2025-02-02 23:31:00',
total=1000,
page_size=10,
time_interval=0.01,
)
print(bars.head().to_string())Example Response
symbol time open high low close volume amount \
0 AAPL 1719374400000 211.50 214.8600 210.64 213.25 66213186 1.411181e+10 \
1 AAPL 1719460800000 214.69 215.7395 212.35 214.10 49772707 1.064720e+10 \
next_page_token
xxxxxx
Get Intraday Data for the Latest Trading Day
QuoteClient.get_timeline(symbols, include_hour_trading=False, begin_time=-1, lang=None, trade_session=None)
Description
Retrieves one record per minute for the latest trading day. Historical trading days are not supported.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | Symbols; maximum 50 per request, e.g. ['AAPL', 'TSLA'] |
| include_hour_trading | bool | No | Whether to include pre-market and after-hours intraday data, optional, e.g. True or False |
| begin_time | str | No | Start time for intraday data, supports millisecond-level timestamp or datetime string. e.g. 1639386000000 or '2019-06-07 23:00:00' or '2019-06-07', returns current day data by default |
| lang | Language | No | Supported language, use enum constants from tigeropen.common.consts.Language, default English |
| trade_session | TradingSession | No | Trading session, use enum constants from tigeropen.common.consts.TradingSession, default returns regular (regular session) data |
Returns
pandas.DataFrame
Structure:
| COLUMN | Type | Description |
|---|---|---|
| symbol | str | Symbol, e.g., AAPL |
| time | int | Millisecond-precision timestamp, e.g. 1639386000000 |
| price | float | Closing price for the current minute |
| avg_price | float | Volume-weighted average price up to the current time |
| pre_close | float | Previous day's closing price |
| volume | int | Volume for this minute |
| trade_session | str | String, "PreMarket" for pre-market trading, "Regular" for regular trading, "AfterHours" for after-hours trading. |
Example
import pandas as pd
timeline = quote_client.get_timeline(['01810'], include_hour_trading=False)
# Convert time to a datetime in the market's time zone
timeline['cn_date'] = pd.to_datetime(timeline['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('Asia/Shanghai')
timeline['us_date'] = pd.to_datetime(timeline['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')
# View the latest data
print(timeline.iloc[-1].price)
print(timeline.iloc[-1].volume)
# Filter by symbol
df = timeline.loc[timeline['symbol'] == 'AAPL']
Example Response
symbol time price avg_price pre_close volume trade_session
0 01810 1547217000000 23.4700 23.211563 23.4 233000 regular
1 01810 1547217060000 23.6700 23.408620 23.4 339296 regular
2 01810 1547217120000 23.5900 23.423038 23.4 46337 regular
3 01810 1547217180000 23.5000 23.428830 23.4 66697 regular
4 01810 1547217240000 23.5108 23.433360 23.4 46762 regular
Get Historical Intraday Data
QuoteClient.get_timeline_history(symbols, date, right=QuoteRight.BR, trade_session=None)
Description
Retrieves historical intraday data for a specified date.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | Symbols; maximum 50 per request, e.g. ['AAPL', 'TSLA'] |
| date | str | Yes | Date string. e.g. '2022-04-14' |
| right | QuoteRight | No | Quote rights adjustment, default forward adjustment. Can use enums from tigeropen.common.consts.QuoteRight |
| trade_session | TradingSession | No | Trading session, use enum constants from tigeropen.common.consts.TradingSession, default returns regular (regular session) data |
Returns
pandas.DataFrame
Structure:
| COLUMN | Type | Description |
|---|---|---|
| symbol | str | Symbol, e.g., AAPL |
| time | int | Millisecond-precision timestamp, e.g. 1639386000000 |
| price | float | Closing price for the current minute |
| avg_price | float | Volume-weighted average price up to the current time |
Example
import pandas as pd
timeline = quote_client.get_timeline_history(['AAPL', 'BABA'], '2021-04-11')
# Convert time to a datetime in the market's time zone
timeline['cn_date'] = pd.to_datetime(timeline['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('Asia/Shanghai')
timeline['us_date'] = pd.to_datetime(timeline['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')
# Filter by symbol
df = timeline.loc[timeline['symbol'] == 'AAPL']
print(timeline)Example Response
symbol time volume price avg_price
0 AAPL 1649683800000 1569372 168.5000 168.749760
1 AAPL 1649683860000 323022 168.5800 168.739030 Get Delayed Stock Quotes
QuoteClient.get_stock_delay_briefs(symbols, lang=None)
Description
This API provides free delayed quotes without requiring market data access. You can use it directly after opening a developer account. Currently supports only US stock delayed quotes, which are delayed by approximately 15 minutes compared to real-time quotes.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | List of symbols, currently supports only US stock delayed quotes. e.g. ['AAPL', 'MSFT'], maximum 50 per request |
| lang | Language | No | Supported language, use enum constants from tigeropen.common.consts.Language, default English |
Returns
pandas.DataFrame
Structure:
| Parameter | Type | Description |
|---|---|---|
| symbol | str | Symbol |
| pre_close | float | Previous closing price |
| time | int | Latest trade time, millisecond timestamp, e.g. 1639429200000 |
| volume | int | Trading volume |
| open | float | Opening price |
| high | float | Highest price |
| low | float | Lowest price |
| close | float | Closing price |
| halted | float | Security status (0: Normal 3: Suspended 4: Delisted 7: New Stock 8: Changed) |
Example
import pandas as pd
briefs = quote_client.get_stock_delay_briefs(['AAPL'])
print(briefs)
# Convert time to a datetime in the market's time zone
briefs['cn_date'] = pd.to_datetime(briefs['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('Asia/Shanghai')
briefs['us_date'] = pd.to_datetime(briefs['time'], unit='ms').dt.tz_localize('UTC').dt.tz_convert('US/Eastern')Example Response
symbol pre_close halted time open high low close \
0 AAPL 174.33 0.0 1639602000000 175.11 179.5 172.3108 179.3
volume cn_date us_date
0 131063257 2021-12-16 05:00:00+08:00 2021-12-15 16:00:00-05:00 Get Stock Trading Information
QuoteClient.get_trade_metas(symbols)
Description
Retrieves essential information for stock trading, such as shares per lot.
Request Frequency
For rate limits, see API Request Limits
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbols | list[str] | Yes | Symbols; maximum 50 |
Returns
pandas.DataFrame
Structure:
| COLUMN | Type | Description |
|---|---|---|
| symbol | str | Symbol |
| lot_size | int | Shares per lot |
| min_tick | float | Minimum price movement |
| spread_scale | float | Quote precision |
Example
trade_metas = quote_client.get_trade_metas(symbols=['00700', '00336'])Example Response
symbol lot_size min_tick spread_scale
0 00700 100 0.20 0
1 00336 1000 0.01 0
Get Stock Capital Flow Data
QuoteClient.get_capital_flow
Description
Retrieves stock net capital inflow data, including real-time minute data for the latest trading day and historical net inflow data for different periods. Supports daily, weekly, monthly, quarterly, semi-annual, and annual data. Maximum 1200 records per request, default returns 200 records.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | string | Yes | Stock symbol |
| period | CapitalPeriod | Yes | Data type, values (intraday:real-time, day:daily, week:weekly, month:monthly, year:yearly, quarter:quarterly, 6month:semi-annual) |
| market | Market | Yes | US for US stocks, HK for Hong Kong stocks, CN for A-shares (real-time capital flow does not support A-shares) |
| begin_time | int | No | Start time, default: -1, unit: milliseconds (ms), left-closed right-open interval, query results will include start time data, for weekly/monthly/yearly bars, will return data including current period (e.g., if start time is Wednesday, will return data from this Monday) |
| end_time | int | No | End time, default: -1, unit: milliseconds (ms) |
| limit | int | No | Number of records returned per request, default 200, limit cannot exceed 1200, if limit is set greater than 1200, only 1200 records will be returned |
| lang | Lang | No | Language support: zh_CN/zh_TW/en_US, default: en_US |
Returns
pandas.DataFrame
| Field | Type | Description |
|---|---|---|
| symbol | string | Stock symbol |
| period | string | Period |
| time | string | Time string in the security's market timezone, real-time data format "11-25 12:48:00 EST", non-real-time data format "2022-11-22" |
| timestamp | int | 13-digit timestamp |
| net_inflow | float | Net inflow amount, negative numbers indicate outflow |
Example
from tigeropen.common.consts import Market, CapitalPeriod
result = quote_client.get_capital_flow('AAPL', market=Market.US, period=CapitalPeriod.INTRADAY)
print(result)
# Get net_inflow from the first row
result.iloc[0]['net_inflow']
# or result['net_inflow'].iloc[0]
Example Response
time timestamp net_inflow symbol period
0 2022-02-24 1645678800000 -5.889058e+08 AAPL day
1 2022-02-25 1645765200000 -1.229127e+08 AAPL day
2 2022-02-28 1646024400000 1.763644e+08 AAPL day
Get Stock Capital Distribution
QuoteClient.get_capital_distribution
Description
Retrieves stock capital distribution.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | str | Yes | Stock symbol |
| market | Market | Yes | US for US stocks, HK for Hong Kong stocks, CN for A-shares |
| lang | Lang | No | Language support: zh_CN/zh_TW/en_US, default: en_US |
Returns
tigeropen.quote.domain.capital_distribution.CapitalDistribution
| Field | Type | Description |
|---|---|---|
| symbol | str | Stock symbol |
| net_inflow | float | Net inflow amount (total inflow - total outflow), negative numbers indicate outflow |
| in_all | float | Total capital inflow (large + medium + small orders) |
| in_big | float | Large order inflow |
| in_mid | float | Medium order inflow |
| in_small | float | Small order inflow |
| out_all | float | Total capital outflow (large + medium + small orders) |
| out_big | float | Large order outflow |
| out_mid | float | Medium order outflow |
| out_small | float | Small order outflow |
Example
result = quote_client.get_capital_distribution('JD', market=Market.US)
print(result)Example Response
CapitalDistribution({'symbol': 'JD', 'net_inflow': -14178801.76, 'in_all': 157357147.5,
'in_big': 25577130.842900004, 'in_mid': 13664116.789999994, 'in_small': 118115899.86410056,
'out_all': 171535949.25, 'out_big': 22642951.677099995, 'out_mid': 12733553.691200001,
'out_small': 136159443.88620025})
Get HK Broker Trading Seats
QuoteClient.get_stock_broker
Description
Retrieves Hong Kong broker trading seats.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| symbol | str | Yes | Stock symbol |
| limit | int | No | Number of bid/ask seats returned per request, defaults to 40, limit cannot exceed 60, if limit is set greater than 60, only 60 records will be returned |
| lang | Lang | No | Language support: zh_CN/zh_TW/en_US, default: en_US |
Returns
tigeropen.quote.domain.stock_broker.StockBroker
| Field | Type | Description |
|---|---|---|
| symbol | str | Stock symbol |
| bid_broker | LevelBroker | Bid side price level array, refer to tigeropen.quote.domain.stock_broker.LevelBroker description |
| ask_broker | LevelBroker | Ask side price level array, refer to tigeropen.quote.domain.stock_broker.LevelBroker description |
LevelBroker attributes:
| field | type | desc |
|---|---|---|
| level | int | Price level |
| price | float | Price |
| broker_count | int | Number of seats |
| broker | list | Broker trading seats; see tigeropen.quote.domain.stock_broker.Broker |
Broker attributes:
| field | type | desc |
|---|---|---|
| id | str | broker id |
| name | str | broker name |
Example
result = quote_client.get_stock_broker('01810', limit=5)
print(result)Example Response
StockBroker({'symbol': '01810',
'bid_broker': [
LevelBroker({'level': 1, 'price': 11.46, 'broker_count': 5,
'broker': [Broker({'id': '5999', 'name': 'China Chuangying'}), Broker({'id': '4374', 'name': 'Barclays Asia'}),
Broker({'id': '1438', 'name': 'Susquehanna'}), Broker({'id': '4821', 'name': 'Upsmart'}),
Broker({'id': '6998', 'name': 'China Investment'})]})],
'ask_broker': [
LevelBroker({'level': 1, 'price': 11.48, 'broker_count': 5,
'broker': [Broker({'id': '4374', 'name': 'Barclays Asia'}), Broker({'id': '9056', 'name': 'UBS'}),
Broker({'id': '2027', 'name': 'Bank of East Asia'}), Broker({'id': '4821', 'name': 'Upsmart'}),
Broker({'id': '4374', 'name': 'Barclays Asia'})]})]})
Get Market Value of HK Broker Holdings
QuoteClient.get_broker_hold
Description
Retrieves Hong Kong stock broker holdings market value.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| market | Market | Yes | Supports only HK (Hong Kong stocks) |
| limit | int | No | Number of records per page, defaults to 50, limit cannot exceed 500, if limit is set greater than 500, only 500 records will be returned |
| page | int | No | Page number, starting from 0, default 0 |
| order_by | str | No | Sort field, default "marketValue", optional values: marketValue/sharesHold/buyAmount/buyAmount5/buyAmount20/buyAmount60 |
| direction | str | No | Sort direction, DESC descending/ASC ascending, default DESC |
| lang | Lang | No | Language support: zh_CN/zh_TW/en_US, default: en_US |
Returns
pd.DataFrame
| Field | Type | Description |
|---|---|---|
| org_id | str | Broker ID |
| org_name | str | Broker name |
| date | str | Latest trading day |
| shares_hold | int | Shares held |
| market_value | float | Holdings market value |
| buy_amount | int | 1-day net buy amount |
| buy_amount5 | int | 5-day net buy amount |
| buy_amount20 | int | 20-day net buy amount |
| buy_amount60 | int | 60-day net buy amount |
| market | str | Market |
Example
result = quote_client.get_broker_hold(market=Market.HK, limit=5, order_by='marketValue', direction=SortDirection.ASC, lang=Language.zh_CN)
print(result)Example Response
org_id org_name date shares_hold market_value buy_amount buy_amount5 \
0 C00019 The Hongkong and Shanghai Banking Corporation 2025-04-10 697552502881 8.943928e+12 -1405700331 -3893473916 \
1 A00003 Shanghai-Hong Kong Stock Connect 2025-04-10 293590702492 2.493193e+12 843074553 4263428837 \
2 C00010 Citibank 2025-04-10 206768714970 1.926757e+12 386287281 483932517 \
buy_amount20 buy_amount60 market page total_page total_count
-7103861935 -29489710005 HK 0 135 672
10882949005 17126490078 HK 0 135 672
-22419868 -5182619457 HK 0 135 672
Popular Trading Rankings
QuoteClient.get_trade_rank(market, lang=Language.en_US)
Description
Retrieves stock popular trading rankings, data is updated approximately every 20 seconds.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| market | Market | Yes | US stocks, HK Hong Kong stocks, SG Singapore stocks |
| lang | Lang | No | Language support: zh_CN/zh_TW/en_US, default: en_US |
Returns
pandas.DataFrame
US stocks return 30 records, Hong Kong and Singapore stocks return 10 records, structure as follows:
| Field | Type | Description |
|---|---|---|
| symbol | str | Stock symbol |
| market | str | Market |
| name | str | Name |
| sec_type | str | Security type |
| change_rate | float | Intraday change rate, if currently not in trading session, then it's the previous trading day's intraday change rate |
| sell_order_rate | float | Sell order ratio, cumulative buy/sell ratio for the day, intraday phase includes pre-market + intraday cumulative buy/sell ratio, after-hours phase includes pre-market + intraday + after-hours cumulative buy/sell ratio |
| buy_order_rate | float | Buy order ratio, calculation method same as above |
| hour_trading_trading_status | int | Pre-market/after-hours trading status (US stocks only) |
| hour_trading_trade_session | str | Pre-market/after-hours trading session, corresponding status (US stocks only) |
| hour_trading_change_rate | float | Latest pre-market/after-hours change rate (US stocks only) |
Example
result = quote_client.get_trade_rank(market=Market.US, lang=Lang.ZH_CN)
print(result)Example Response
symbol market name sec_type change_rate sell_order_rate \
0 TSLA US Tesla Motors STK 0.022118 0.490115 \
1 NVDA US NVIDIA STK 0.002440 0.418413 \
2 INTC US Intel STK -0.032385 0.401211 \
buy_order_rate hour_trading_trading_status hour_trading_trade_session hour_trading_change_rate
0.509885 3 AfterHours -0.001338
0.581587 3 AfterHours -0.003792
0.598789 3 AfterHours -0.003381
Updated 7 days ago
