中文

Securities

get_market_status Get Market Status

QuoteClient.get_market_status(market=Market.ALL, lang=None)

Description

Get the trading status of specified markets (such as intraday, pre-market, post-market, etc.) and retrieve the latest opening time for that market.

Request Frequency

For rate limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketMarketYesThe market to query. You can use enum constants provided under tigeropen.common.consts.Market, such as Market.US. See enum parameters section
langLanguageNoSupported language. You can use enum constants provided under tigeropen.common.consts.Language, such as Language.zh_CN. Default is Language.en_US. See enum parameters section

Return

list

Elements are MarketStatus objects. MarketStatus structure is as follows:

ParameterTypeDescription
marketstrMarket name
trading_statusstrTrading status code: NOT_YET_OPEN (not yet open); PRE_HOUR_TRADING (pre-market trading); TRADING (trading); MIDDLE_CLOSE (midday break); POST_HOUR_TRADING (post-market trading); CLOSING (closed); EARLY_CLOSED (early close); MARKET_CLOSED (market closed)
statusstrTrading status description
open_timedatetimeLatest opening trading time with timezone information

Example

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

market_status = quote_client.get_market_status(Market.US)

# View attributes
print(market_status)

Return Example

[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_trading_calendar 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, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketMarketYesThe market to query. You can use enum constants provided under tigeropen.common.consts.Market, such as Market.US. See enum parameters section
begin_datestrNoCalendar start time, result includes this date. Format: yyyy-MM-dd, e.g., '2022-06-01'
end_datestrNoCalendar end time, result excludes this date. Format: yyyy-MM-dd, e.g., '2022-06-01'

begin_time and end_time parameter handling:

begin_time passedend_time passedDescription
yesyesbegin_time and end_time are the passed values
yesnoend_time is 365 days after begin_time
noyesbegin_time is 365 days before end_time
nonobegin_time is current date, end_time is 30 days after begin_time

Return

list

Each element is a dict, with the following key meanings:

ParameterTypeDescription
datestrTrading day date
typestrTrading day type: TRADING for normal trading day, full-day trading; EARLY_CLOSE for early close

Example

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

calendar = quote_client.get_trading_calendar(Market.US, begin_date='2022-11-01', end_date='2022-12-01')
print(calendar)

Return Example

[
    {
        "date": "2022-11-01",
        "type": "TRADING"
    },
    {
        "date": "2022-11-02",
        "type": "TRADING"
    },
    {
        "date": "2022-11-03",
        "type": "TRADING"
    }
]

get_symbols Get All Security Symbol List

QuoteClient.get_symbols(market=Market.ALL, include_otc=False)

Description

Get 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, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketMarketNoThe market to query. You can use enum constants provided under tigeropen.common.consts.Market, such as Market.US
include_otcboolNoWhether 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

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

symbols = quote_client.get_symbols(Market.US)
print(symbols)

Return Example

['.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_symbol_names Get Symbol and Name List

QuoteClient.get_symbol_names(market=Market.ALL, lang=None, include_otc=False)

Description

Get symbols and corresponding names for all securities in the specified market.

Request Frequency

For rate limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
marketMarketYesThe market to query. You can use enum constants provided under tigeropen.common.consts.Market, such as Market.US
langLanguageNoSupported language. You can use enum constants provided under tigeropen.common.consts.Language, default is English
include_otcboolNoWhether 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

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

symbol_names = quote_client.get_symbol_names(market=Market.ALL)
print(symbol_names)

Return Example

[('AAAP', 'Advanced Accelerator Applications SA'), ('AAAU', 'Perth Mint Physical Gold ETF'), ('AABA', 'Altaba'), ('AAC', 'AAC Holdings Inc')]

get_stock_briefs Get Real-time Stock Quotes

QuoteClient.get_stock_briefs(symbols, include_hour_trading=False, lang=None)

Description

Get real-time stock quotes. You need to purchase corresponding market data permissions before using this interface. Each request supports up to 50 stocks.

Request Frequency

For rate limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist[str]YesList of security symbols, maximum 50 stocks, e.g., ['AAPL', 'MSFT']
include_hour_tradingboolNoWhether to return pre-market and post-market data
langLanguageNoSupported language. You can use enum constants provided in tigeropen.common.consts.Language, default is English

Return

pandas.DataFrame

Structure:

COLUMNTypeDescription
symbolstrSecurity symbol
ask_pricefloatAsk price
ask_sizeintAsk size
bid_pricefloatBid price
bid_sizeintBid size
pre_closefloatPrevious close price
latest_pricefloatLatest price
latest_timeintLatest trading time, millisecond timestamp
volumeintTrading volume
openfloatOpening price
highfloatHighest price
lowfloatLowest price
statusstrTrading status
adj_pre_closestrAdjusted previous close price after rights adjustment
hour_trading_tagstrPre-market ("Pre-Mkt"), Post-market ("Post-Mkt") identifier
hour_trading_latest_pricefloatPre-market/post-market real-time price
hour_trading_latest_timestrLatest trading time (Eastern Time)
hour_trading_volumeintPre-market/post-market trading volume
hour_trading_timestampintLatest 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
from tigeropen.quote.quote_client import QuoteClient
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_stock_briefs(['00700'])
print(briefs)

# Convert latest_time to corresponding timezone datetime
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')

Return Example

  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_quote Get Depth Quote

QuoteClient.get_depth_quote(symbols, market)

Description

Get N-level bid/ask order data for specified securities, including order price, quantity, and number of orders. Each request supports up to 50 securities.

⚠️

CAUTION

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 post-market trading information. No additional parameters are required; real-time requests can be made directly.

Request Frequency

For rate limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist[str]YesList of security symbols, maximum 50 per request
marketMarketYesThe market to query. You can 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

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

depth_quote = quote_client.get_depth_quote(['02833'], Market.HK)

Return Example

{'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_trade_ticks Get Trade Tick Data

QuoteClient.get_trade_ticks(symbols, trade_session=None, begin_index=None, end_index=None, limit=None, lang=None)

Description

Get trade tick data. This interface 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 frequency limits, please refer to: Interface Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist[str]YesList of security codes, maximum 50
trade_sessionTradingSessionNoTrading session, can use enumeration constants provided in tigeropen.common.consts.TradingSession, defaults to returning intraday (regular trading session) data
begin_indexintNoStarting 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_indexintNoEnding 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.
limitintNoReturn count limit, default: 200, maximum limit: 2000
langLanguageNoSupported language, can use enumeration constants provided in tigeropen.common.consts.Language, defaults to English

Usage Instructions for begin_index and end_index Parameters

Query Typebegin_indexend_indexDescription
Query Latest Tick Data-1-1Returns limit number of latest tick records by default. limit defaults to 200
Query Daily Tick by RangeSpecific valueSpecific valueExample: 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:

ParameterTypeDescription
indexintIndex value
timeintMillisecond timestamp
pricefloatTrade price
volumeintTrade volume
directionstrPrice movement direction, "+" indicates active buy, "-" indicates active sell, "*" indicates neutral

Example

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.common.consts import TradingSession
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

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)

Return Example

    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         *  556804

get_bars Get 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

Supports getting K-line data for Hong Kong and US stocks, including: daily, weekly, monthly, yearly, as well as minute, 5-minute, 15-minute, 30-minute, 60-minute and other levels. Each request returns a maximum of 1200 records. It's recommended to use loop calls to obtain longer historical data ranges to ensure interface performance and stability. The interface supports querying by date range or specific date.

  • Minute-level K-lines (1/5/15/30/60 minutes): Supports nearly 10 years of historical data
  • Daily K-lines and above (daily/weekly/monthly/yearly): Provides complete historical data

US pre-market and after-hours only support 60-minute and below K-line data after April 2024

Request Frequency

For frequency limits, please refer to: Interface Request Limits

Parameters

Parameter

Type

Required

Description

symbols

list[str]

Yes

List of security codes, single request limit: 50, A-share limit: 30, e.g., ['AAPL', 'GOOG']

period

BarPeriod

No

K-line period to retrieve. Default BarPeriod.DAY, can use enumeration 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 K-lines only support data from the last month, 15/30/60-minute K-lines support data from the last year. For earlier minute-level K-lines, 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 K-lines only support data from the last month, 15/30/60-minute K-lines support data from the last year. For earlier minute-level K-lines, 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 K-line data for a specific date.

  1. Supports querying minute-level K-line data for nearly 10 years
  2. period parameter supports 1min, 5min, 15min, 30min, 60min
  3. symbols parameter can only accept a single stock code
  4. Pagination and time filtering parameters like limit, pageToken, begin_time, end_time will automatically become invalid and don't need to be passed

right

QuoteRight

No

Adjustment method. Default forward adjustment, can use enumeration 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, can use enumeration 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, can use enumeration 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 K-line data cannot be displayed correctly.

Return

pandas.DataFrame

Structure:

ParameterTypeDescription
timeintMillisecond timestamp, e.g., 1639371600000
openfloatOpening price of the bar
closefloatClosing price of the bar
highfloatHighest price of the bar
lowfloatLowest price of the bar
volumefloatTrading volume of the bar
amountfloatTrading amount of the bar
turnover_ratefloatTurnover rate. Not returned by default
ttm_pefloatTrailing Twelve Months PE. Not returned by default
lyr_pefloatLast Year Ratio PE. Not returned by default
next_page_tokenstrToken for the next page

Example

import pandas as pd
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

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 K-line
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')

Return Example

     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_bars_by_page 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

Get K-line data for specified stocks by page.

Request Frequency

For frequency limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolstrYesSecurity code, only one symbol can be queried at a time.
periodBarPeriodNoK-line period to retrieve. Default BarPeriod.DAY, can use enum constants from tigeropen.common.consts.BarPeriod like 'day'/'week'/'month'/'year'/'1min'/'5min'/'15min'/'30min'/'60min', etc.
begin_timeint or strNoStart time. Supports millisecond-level timestamp or date string, such as 1639371600000 or '2019-06-07 23:00:00' or '2019-06-07'
end_timeint or strNoEnd time. Supports millisecond-level timestamp or date string, such as 1639371600000 or '2019-06-07 23:00:00' or '2019-06-07'
totalintNoTotal number of bars requested. Default: 10000
page_sizeintNoNumber of bars per page. Default: 1000
rightQuoteRightNoRights adjustment method. Default forward adjustment, can use enum constants from tigeropen.common.consts.QuoteRight, such as QuoteRight.BR for forward adjustment, QuoteRight.NR for no adjustment
time_intervalintNoTime interval for each request in seconds, default: 2 seconds
langLanguageNoSupported language, can use enum constants from tigeropen.common.consts.Language, default English
trade_sessionTradingSessionNoTrading session, can 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:

ParameterTypeDescription
timeintMillisecond timestamp, e.g. 1639371600000
openfloatOpening price of the bar
closefloatClosing price of the bar
highfloatHighest price of the bar
lowfloatLowest price of the bar
volumefloatVolume of the bar
next_page_tokenstrPage token for the next page

Example

import pandas as pd
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

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())

Return Example

  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_timeline 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

Get intraday data for the latest trading day. Intraday data is similar to minute K-lines, generating one record per minute. Only supports querying data for the latest trading day.

Request Frequency

For frequency limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist[str]YesList of security codes, maximum 50 per request, e.g. ['AAPL', 'TSLA']
include_hour_tradingboolNoWhether to include pre-market and after-hours intraday data, optional, e.g. True or False
begin_timestrNoStart 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
langLanguageNoSupported language, can use enum constants from tigeropen.common.consts.Language, default English
trade_sessionTradingSessionNoTrading session, can use enum constants from tigeropen.common.consts.TradingSession, default returns regular (normal trading session) data

Returns

pandas.DataFrame

Structure:

COLUMNTypeDescription
symbolstrSecurity code, e.g. AAPL
timeintMillisecond-precision timestamp, e.g. 1639386000000
pricefloatClosing price for the current minute
avg_pricefloatVolume-weighted average price up to the current time
pre_closefloatPrevious day's closing price
volumeintVolume for this minute
trading_sessionstrString, "PreMarket" for pre-market trading, "Regular" for regular trading, "AfterHours" for after-hours trading.

Example

import pandas as pd
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

timeline = quote_client.get_timeline(['01810'], include_hour_trading=False)

# Convert time to corresponding timezone datetime
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']

Return Example

     symbol           time    price  avg_price  pre_close  volume trading_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_timeline_history Get Historical Intraday Data

QuoteClient.get_timeline_history(symbols, date, right=QuoteRight.BR,trade_session=none)

Description

Get historical intraday data for a specified date.

Request Frequency

For frequency limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist[str]YesList of security codes, maximum 50 per request, e.g. ['AAPL', 'TSLA']
datestrYesDate string. e.g. '2022-04-14'
rightQuoteRightNoQuote rights adjustment, default forward adjustment. Can use enums from tigeropen.common.consts.QuoteRight
trade_sessionTradingSessionNoTrading session, can use enum constants from tigeropen.common.consts.TradingSession, default returns regular (normal trading session) data

Returns

pandas.DataFrame

Structure:

COLUMNTypeDescription
symbolstrSecurity code, e.g. AAPL
timeintMillisecond-precision timestamp, e.g. 1639386000000
pricefloatClosing price for the current minute
avg_pricefloatVolume-weighted average price up to the current time

Example

import pandas as pd
from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

timeline = quote_client.get_timeline_history(['AAPL', 'BABA'], '2021-04-11')

# Convert time to corresponding timezone datetime
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)

Return Example

    symbol           time   volume     price   avg_price 
0     AAPL  1649683800000  1569372  168.5000  168.749760
1     AAPL  1649683860000   323022  168.5800  168.739030 

get_stock_delay_briefs Get Delayed Stock Quotes

QuoteClient.get_stock_delay_briefs(symbols, lang=None)

Description

This interface provides free delayed quotes without requiring quote permissions. You can use it directly after opening a developer account. Currently only supports US stock delayed quotes, which are delayed by approximately 15 minutes compared to real-time quotes.

Request Frequency

For frequency limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist[str]YesList of security codes, currently only supports US stock delayed quotes. e.g. ['AAPL', 'MSFT'], maximum 50 per request
langLanguageNoSupported language, can use enum constants from tigeropen.common.consts.Language, default English

Returns

pandas.DataFrame

Structure:

ParameterTypeDescription
symbolstrSecurity code
pre_closefloatPrevious closing price
timeintLatest trade time, millisecond timestamp, e.g. 1639429200000
volumeintTrading volume
openfloatOpening price
highfloatHighest price
lowfloatLowest price
closefloatClosing price
haltedfloatSecurity status (0: Normal 3: Suspended 4: Delisted 7: New Stock 8: Changed)

Example

import pandas as pd
from tigeropen.quote.quote_client import QuoteClient
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_stock_delay_briefs(['AAPL'])
print(briefs)

# Convert time to corresponding timezone datetime
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')

Return Example

  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_trade_metas Get Stock Trading Information

QuoteClient.get_trade_metas(symbols)

Description

Query essential information for stock trading, such as shares per lot.

Request Frequency

For frequency limits, please refer to: API Request Limits

Parameters

ParameterTypeRequiredDescription
symbolslist[str]YesList of security codes, maximum 50

Returns

pandas.DataFrame

Structure:

COLUMNTypeDescription
symbolstrSecurity code
lot_sizeintShares per lot
min_tickfloatMinimum price movement
spread_scalefloatQuote precision

Example

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

trade_metas = quote_client.get_trade_metas(symbols=['00700', '00336'])

Return Example

  symbol  lot_size  min_tick  spread_scale
0  00700       100      0.20             0
1  00336      1000      0.01             0

get_capital_flow Get Stock Capital Flow Data

QuoteClient.get_capital_flow

Description

Get 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

ParameterTypeRequiredDescription
symbolstringYesStock code
periodCapitalPeriodYesData type, values (intraday:real-time, day:daily, week:weekly, month:monthly, year:yearly, quarter:quarterly, 6month:semi-annual)
marketMarketYesUS for US stocks, HK for Hong Kong stocks, CN for A-shares (real-time capital flow does not support A-shares)
begin_timeintNoStart time, default: -1, unit: milliseconds (ms), left-closed right-open interval, query results will include start time data, for weekly/monthly/yearly K-lines, will return data including current period (e.g., if start time is Wednesday, will return data from this Monday)
end_timeintNoEnd time, default: -1, unit: milliseconds (ms)
limitintNoNumber of records returned per request, default 200, limit cannot exceed 1200, if limit is set greater than 1200, only 1200 records will be returned
langLangNoLanguage support: zh_CN/zh_TW/en_US, default: en_US

Returns

pandas.DataFrame

FieldTypeDescription
symbolstringStock code
periodstringPeriod
timestringTime 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"
timestampint13-digit timestamp
net_inflowfloatNet inflow amount, negative numbers indicate outflow

Example

from tigeropen.quote.quote_client import QuoteClient
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_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]

Return Example

           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_capital_distribution Get Stock Capital Distribution

QuoteClient.get_capital_distribution

Description

Get stock capital distribution.

Parameters

ParameterTypeRequiredDescription
symbolstrYesStock code
marketMarketYesUS for US stocks, HK for Hong Kong stocks, CN for A-shares
langLangNoLanguage support: zh_CN/zh_TW/en_US, default: en_US

Returns

tigeropen.quote.domain.capital_distribution.CapitalDistribution

FieldTypeDescription
symbolstrStock code
net_inflowfloatNet inflow amount (total inflow - total outflow), negative numbers indicate outflow
in_allfloatTotal capital inflow (large + medium + small orders)
in_bigfloatLarge order inflow
in_midfloatMedium order inflow
in_smallfloatSmall order inflow
out_allfloatTotal capital outflow (large + medium + small orders)
out_bigfloatLarge order outflow
out_midfloatMedium order outflow
out_smallfloatSmall order outflow

Example

from tigeropen.quote.quote_client import QuoteClient
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_capital_distribution('JD', market=Market.US)
print(result)

Return Example

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_stock_broker Get Hong Kong Stock Broker Trading Seats

QuoteClient.get_stock_broker

Description

Get Hong Kong stock broker trading seats.

Parameters

ParameterTypeRequiredDescription
symbolstrYesStock symbol
limitintNoNumber of bid/ask seats returned per request, default is 40, limit cannot exceed 60, if limit is set greater than 60, only 60 records will be returned
langLangNoLanguage support: zh_CN/zh_TW/en_US, default: en_US

Returns

tigeropen.quote.domain.stock_broker.StockBroker

FieldTypeDescription
symbolstrStock symbol
bid_brokerLevelBrokerBid side price level array, refer to tigeropen.quote.domain.stock_broker.LevelBroker description
ask_brokerLevelBrokerAsk side price level array, refer to tigeropen.quote.domain.stock_broker.LevelBroker description

LevelBroker attributes:

fieldtypedesc
levelintPrice level
pricefloatPrice
broker_countintNumber of seats
brokerlistBroker trading seats list, refer to tigeropen.quote.domain.stock_broker.Broker description

Broker attributes:

fieldtypedesc
idstrbroker id
namestrbroker name

Example

from tigeropen.quote.quote_client import QuoteClient
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_stock_broker('01810', limit=5)
print(result)

Return example

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_broker_hold Get Hong Kong Stock Broker Holdings Market Value

QuoteClient.get_broker_hold

Description

Get Hong Kong stock broker holdings market value.

Parameters

ParameterTypeRequiredDescription
marketMarketYesOnly supports HK (Hong Kong stocks)
limitintNoNumber of records per page, default is 50, limit cannot exceed 500, if limit is set greater than 500, only 500 records will be returned
pageintNoPage number, starting from 0, default 0
order_bystrNoSort field, default "marketValue", optional values: marketValue/sharesHold/buyAmount/buyAmount5/buyAmount20/buyAmount60
directionstrNoSort direction, DESC descending/ASC ascending, default DESC
langLangNoLanguage support: zh_CN/zh_TW/en_US, default: en_US

Returns

pd.DataFrame

FieldTypeDescription
org_idstrBroker ID
org_namestrBroker name
datestrLatest trading day
shares_holdintShares held
market_valuefloatHoldings market value
buy_amountint1-day net buy amount
buy_amount5int5-day net buy amount
buy_amount20int20-day net buy amount
buy_amount60int60-day net buy amount
marketstrMarket

Example

from tigeropen.quote.quote_client import QuoteClient
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_broker_hold(market=Market.HK, limit=5, order_by='marketValue', direction=SortDirection.ASC, lang=Language.zh_CN)
print(result)

Return example

   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

get_trade_rank Popular Trading Rankings

QuoteClient.get_trade_rank(market, lang=Language.en_US)

Description

Get stock popular trading rankings, data is updated approximately every 20 seconds.

Parameters

ParameterTypeRequiredDescription
marketMarketYesUS stocks, HK Hong Kong stocks, SG Singapore stocks
langLangNoLanguage 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:

FieldTypeDescription
symbolstrStock symbol
marketstrMarket
namestrName
sec_typestrSecurity type
change_ratefloatIntraday change rate, if currently not in trading session, then it's the previous trading day's intraday change rate
sell_order_ratefloatSell 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_ratefloatBuy order ratio, calculation method same as above
hour_trading_trading_statusintPre-market/after-hours trading status (US stocks only)
hour_trading_trade_sessionstrPre-market/after-hours trading session, corresponding status (US stocks only)
hour_trading_change_ratefloatLatest pre-market/after-hours change rate (US stocks only)

Example

from tigeropen.quote.quote_client import QuoteClient
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_trade_rank(market=Market.US, lang=Lang.ZH_CN)
print(result)

Return example

   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