跳转至

Shadow Ingest Quick Start

Install

uv pip install git+ssh://git@github.com/Fund-Sapiens/shadow-ingest.git

No configuration required. The SDK connects to data.zhengxinfund.com by default.

First Query

import shadow_ingest as si

price_df = si.gather_daily_price(
    stock_codes=['000001.XSHE'],
    start_date='2024-01-02',
    end_date='2024-01-03',
    fields=['open', 'close', 'volume'],
)

print(price_df)

Discover Valid Inputs

If you don't know the valid dates, codes, or fields, use the helper APIs:

trade_dates = si.list_market_calendar(year=2024)
stock_codes = si.list_universe(date=trade_dates[-1])
price_fields = si.list_fields('gather_daily_price')

print(trade_dates[-3:])
print(stock_codes[:5])
print(price_fields[:5])

Hong Kong Query

Hong Kong market data uses separate APIs. Do not pass market="hk" into the A-share APIs, and do not pass any market parameter into the HK APIs.

import shadow_ingest as si

hk_dates = si.list_hk_market_calendar(year=2026)
hk_codes = si.list_hk_universe(date="2026-06-25")

hk_price_df = si.gather_hk_daily_price(
    stock_codes=["00700.XHKG"],
    start_date="2026-06-25",
    end_date="2026-06-25",
    fields=["open", "close"],
)

print([d.isoformat() for d in hk_dates[-3:]])
print(hk_codes[:5])
print(hk_price_df)

Pandas Users

The SDK returns polars.DataFrame by default. Convert after fetching:

pdf = price_df.to_pandas()