跳转至

Shadow Ingest API Reference

shadow-ingest exposes thirteen stable public Python APIs.

The SDK is intentionally split into:

  • three task-oriented APIs for fetching core market and financial tables
  • three general-purpose APIs for discovering valid inputs
  • three industry APIs for taxonomy lookup and industry membership queries
  • four Hong Kong APIs for HK market-data discovery and daily price queries

Task-Oriented APIs

API Use it for Return type
gather_daily_price(...) daily price history over trade_date x stock_code polars.DataFrame
gather_daily_snapshot(...) one-date cross-sectional market snapshot polars.DataFrame
gather_financial_snapshot(...) latest financial snapshot by statement type polars.DataFrame

General-Purpose APIs

API Use it for Return type
list_fields(...) discovering supported fields values for gather_daily_price(...) list[str]
list_market_calendar(...) discovering valid trading dates list[datetime.date]
list_universe(...) discovering valid stock codes for a specific date list[str]

Industry APIs

API Use it for Return type
get_industry_standards() listing the available industry classification standards list[str]
get_industry_mapping(...) mapping stock codes to industry rows for one standard and date polars.DataFrame
get_industry_members(...) mapping an industry code or name to member stock rows polars.DataFrame

Hong Kong APIs

API Use it for Return type
list_hk_market_calendar(...) discovering valid Hong Kong trading dates list[datetime.date]
list_hk_universe(...) discovering valid Hong Kong stock codes for a date list[str]
gather_hk_daily_price(...) Hong Kong daily price history polars.DataFrame
gather_hk_daily_snapshot(...) one-date Hong Kong daily snapshot rows polars.DataFrame

If you are not sure what to query yet, use the APIs in this order:

  1. list_market_calendar(...)
  2. list_universe(...)
  3. list_fields(...) when you are querying daily prices
  4. get_industry_standards() if you need a taxonomy such as sws or citics
  5. one of the dataframe-returning APIs

For Hong Kong data, use the HK-specific flow:

  1. list_hk_market_calendar(...)
  2. list_hk_universe(...)
  3. list_fields(si.gather_hk_daily_price) when you are querying HK daily prices
  4. gather_hk_daily_price(...) or gather_hk_daily_snapshot(...)

Which API Should I Use?

Pandas Users

The SDK is dataframe-first with polars.DataFrame as the default return type for the table APIs.

If you prefer pandas:

pdf = df.to_pandas()