Tushare

Tushare is the first V1 provider adapter.

Install the optional dependency:

uv sync --extra tushare

Provide a token explicitly:

from bagelquant_data.datasource import TushareDataSource

source = TushareDataSource(token="your-token")

Or through the environment:

export TUSHARE_TOKEN=your-token

Supported V1 datasets:

Tushare dates are normalized to YYYYMMDD. Tokens are never included in describe() output.

When Tushare data is ingested into LocalDataLake, tables such as daily are stored under the tushare source namespace and partitioned by trade_date year/month/day.

Reference Resources

The Tushare All universe is sourced from stock_basic. Refreshes read list statuses L, D, and P, then de-duplicate by ts_code, so delisted and paused stocks remain available and survivorship bias is avoided. Asset ids are stored as tushare_<ts_code>, for example tushare_000300.SH.

Tushare table updates also use a local trading calendar from trade_cal. The default calendar reads cal_date and uses is_open == 1 for trading days. Reference resources are refreshed separately from normal table updates, so an incremental price refresh does not overwrite stock_basic or trade_cal.

Sources may define multiple universes. For example, an index workflow can add an index_basic universe and bind index-oriented tables to index_basic.ts_code instead of the default stock universe.

Update Strategy