Skip to main content
TQX provides market, reference, financial, and market-factor data for Hong Kong and US stocks. Hong Kong symbols use .HK, for example 0700.HK. US symbol formats depend on the interface: some Qube methods use a .NB suffix, for example AAPL.NB, while the local package’s documented examples use AAPL.

Install tqx_data

Download the tqx-data package from PyPI:
The API-Key build of tqx-data requires Python 3.10 or later. Follow the tqx_data.md shipped inside the installed package for its exact dependency constraints.
The local data package uses an API key with data access permission. It is separate from the Qube research client and trading APIs. Contact Audrey at audrey@tqx.ai to request data access.

Initialize with an API key

Pass the key and service base URL before calling a data method:
You can instead set TQX_API_KEY and TQX_API_BASE_URL, then call tqx_data.init(). The explicit api_key takes precedence over the environment variable. Never put the key in source files or repositories.

Use tqx-data with a coding agent

Copy the following prompt into your coding agent:
The agent asks for the API key only when it is not already saved and does not repeat it in output.

Qube and the PyPI package

The methods on these pages follow the tqx_data built into Qube. The local API-Key package differs in these ways:
  • Pages and methods marked Qube only are not in the local package: minute bars, live minute bars, latest tick snapshots, indicator calculation, factors, and index components.
  • The local package documents these methods: get_hk_daily, get_us_daily, get_stock_detail, get_trading_calendar, get_currency, get_event_devidend, get_event_capital_market, get_event_corporate_actions, get_event_fina_disclosure, get_event_investor_relation_activities, get_company_concentration, get_company_top_concentration, get_company_investor, get_company_insider_transaction, get_company_shareholder_report, get_company_price_vol, get_company_oper_metrics, get_company_current, get_company_imed, get_consensus_nonperiod, get_consensus_recommend, and get_financial_statement.
  • The local package also documents TickStreamClient for real-time tick delivery. Its tqx_data.md file is the allowlist for supported method names, parameters, and fields.
  • Source files may contain readers that are not in tqx_data.md; those readers are not documented or supported for users.

Use the data in backtests

  • Daily bars aren’t adjusted for dividends or splits, and alt_close equals close. To build an adjusted or total-return series, apply the events from get_event_devidend.
  • Data marked Latest data only has no history. Don’t use it for historical signals in a backtest, because it would leak later information into earlier dates.
  • Use an event only from its announcement date onward.