tushare-duckdb
Local DuckDB cache layer for Tushare Pro data with integrated concept sector data from jquant_data_sync.
Quick Start
Read Data (no network, concurrent-safe)
from tushare_db import DataReader
reader = DataReader(db_path="tushare.db")
# Single stock with forward adjustment
df = reader.get_stock_daily('000001.SZ', '20240101', adj='qfq')
# Multiple stocks
df = reader.get_multiple_stocks_daily(['000001.SZ', '600519.SH'], '20240101')
# Concept sector constituents (from jquant_data_sync)
df = reader.get_concept_stocks('20240115', concept_name='人工智能')
# Stock's concept sectors
df = reader.get_stock_concepts('20240115', ts_code='000001.SZ')
# Trade calendar
df = reader.get_trade_calendar('20240101', '20241231')
# Stock list
df = reader.get_stock_basic(list_status='L')
# Custom SQL
df = reader.query("SELECT * FROM daily WHERE ts_code = ?", ['000001.SZ'])
reader.close()
Download Data (requires TUSHARE_TOKEN env var)
from tushare_db import DataDownloader
downloader = DataDownloader(db_path="tushare.db", rate_limit_profile="standard")
# Basic data
downloader.download_trade_calendar()
downloader.download_stock_basic()
# Daily data for all stocks
downloader.download_all_stocks_daily(start_date='20200101')
# Daily update (single date)
downloader.download_daily_data_by_date('20241218')
downloader.close()
Concept Sector Data (jquant_data_sync)
External concept sector data integrated via DataReader:
from tushare_db import DataReader
reader = DataReader(db_path="tushare.db")
# Get concept constituents for a specific date (PIT)
df = reader.get_concept_stocks('20240115', concept_name='人工智能')
# Returns: ts_code, concept_name, in_date, out_date
# Get all concept sectors for a stock
df = reader.get_stock_concepts('20240115', ts_code='000001.SZ')
# Returns: concept_code, concept_name, in_date, out_date
# Get full cross-section for a date
df = reader.get_concept_cross_section('20240115')
# Returns all concept-stock relationships for the date
# Search concept sectors
df = reader.search_concepts('芯片') # Fuzzy search
# List all concept sectors
df = reader.get_all_concepts() # concept_code, concept_name
# Force refresh data from GitHub
reader.refresh_concept_data()
# Check cache status
info = reader.get_concept_cache_info()
reader.close()
Data Characteristics:
- Source: jquant_data_sync GitHub Releases
- Format: SCD (Slowly Changing Dimension) with in_date/out_date
- Update: Daily auto-download with local caching
- Cache Location:
.concept_cache/all_concepts_pit_scd.csv
Point-in-Time (PIT) Queries
For backtesting, always use PIT queries to avoid look-ahead bias:
from tushare_db import DataReader
reader = DataReader(db_path="tushare.db")
# ❌ Wrong: Current snapshot (causes look-ahead bias)
df = reader.get_index_member_all(l1_code='801010.SI', is_new='Y')
# ✅ Correct: PIT query as of historical date
df = reader.get_index_member_all(
l1_code='801010.SI',
trade_date='20230115' # Only stocks in sector on this date
)
# ✅ Correct: Concept sector PIT query
df = reader.get_concept_stocks('20230115', concept_name='人工智能')
Correct SQL for PIT joins:
-- For index_member_all
SELECT *
FROM my_data d
JOIN index_member_all im ON d.ts_code = im.ts_code
WHERE im.in_date <= d.trade_date
AND (im.out_date IS NULL OR im.out_date > d.trade_date)
-- For concept sectors (from jquant_data_sync)
SELECT *
FROM my_data d
JOIN concept_data c ON d.ts_code = c.ts_code
WHERE c.in_date <= d.trade_date
AND c.out_date >= d.trade_date
Manual PIT data backfill:
# If database lacks historical out_date data
python scripts/backfill_index_member_pit.py
Key Notes
- Date format:
YYYYMMDD string (e.g., '20240101')
- Adjustment types:
adj_factor table stores raw Tushare adjustment factors
qfq (forward): price * (factor / latest_factor) — latest price = market price
hfq (backward): price * factor — historical prices stay fixed
- DataReader handles calculation automatically via
adj='qfq' or adj='hfq'
- Rate limit profiles:
'trial', 'standard', 'pro'
Implemented Tables
External Data Sources
| Data Source |
Type |
Access |
Update |
Description |
concept_data |
External |
DataReader.get_concept_*() |
Daily auto-download |
A-share concept sectors from jquant_data_sync |
基础信息表(静态数据)
| Table |
Tushare API |
Primary Keys |
官方最早日期 |
说明 |
trade_cal |
trade_cal |
exchange, cal_date |
19910404 |
交易日历,exchange='SSE' |
stock_basic |
stock_basic |
ts_code |
- |
股票列表 |
stock_company |
stock_company |
ts_code |
- |
上市公司信息 |
index_basic |
index_basic |
ts_code |
- |
指数列表 |
index_classify |
index_classify |
industry_code |
- |
申万行业分类,src='SW2021' |
index_member_all |
index_member_all |
ts_code, l3_code, in_date |
- |
申万行业成分股(PIT支持) |
hs_const |
hs_const |
ts_code, in_date |
20141117 |
沪深港通成分 |
ths_index |
ths_index |
ts_code |
- |
同花顺板块列表 (见下方说明) |
ths_member |
ths_member |
ts_code, con_code |
- |
同花顺板块成分股 |
日频时间序列表
| Table |
Tushare API |
Primary Keys |
官方最早日期 |
说明 |
daily |
daily |
ts_code, trade_date |
19910404 |
日线行情 |
adj_factor |
adj_factor |
ts_code, trade_date |
19910403 |
复权因子 |
daily_basic |
daily_basic |
ts_code, trade_date |
19910404 |
每日指标(PE/PB/市值) |
index_daily |
index_daily |
ts_code, trade_date |
19901219 |
指数日线 |
moneyflow |
moneyflow |
ts_code, trade_date |
20100104 |
个股资金流向 |
cyq_perf |
cyq_perf |
ts_code, trade_date |
20180102 |
筹码分布绩效 |
stk_factor_pro |
stk_factor_pro |
ts_code, trade_date |
20050104 |
技术因子(MACD/KDJ等) |
limit_list_d |
limit_list_d |
ts_code, trade_date, limit |
20200102 |
涨跌停统计 (U/D/Z) |
margin_detail |
margin_detail |
ts_code, trade_date |
20100331 |
融资融券明细 |
sw_daily |
sw_daily |
ts_code, trade_date |
20210104 |
申万指数日线 (SW2021版) |
ths_daily |
ths_daily |
ts_code, trade_date |
20180102 |
同花顺板块日行情 |
moneyflow_dc |
moneyflow_dc |
ts_code, trade_date |
20230911 |
个股资金流(东财) |
moneyflow_ind_dc |
moneyflow_ind_dc |
trade_date, ts_code |
20230912 |
行业资金流(东财) |
dc_index |
dc_index |
ts_code, trade_date |
20241220 |
龙虎榜个股明细 |
dc_member |
dc_member |
ts_code, trade_date, con_code |
20241220 |
龙虎榜机构席位 |
kpl_concept |
kpl_concept |
ts_code, trade_date |
20241014 |
开盘啦题材列表 |
kpl_concept_cons |
kpl_concept_cons |
ts_code, con_code, trade_date |
20241014 |
开盘啦题材成分 |
index_weight |
index_weight |
index_code, trade_date, con_code |
20050930 |
指数成分权重(月度) |
财务数据表(季度更新)
| Table |
Tushare API |
Primary Keys |
官方最早日期 |
说明 |
fina_indicator_vip |
fina_indicator_vip |
ts_code, end_date |
19901231 |
财务指标 |
income |
income_vip |
ts_code, end_date, report_type |
19941231 |
利润表 |
balancesheet |
balancesheet_vip |
ts_code, end_date, report_type |
19891231 |
资产负债表 |
cashflow |
cashflow_vip |
ts_code, end_date, report_type |
19980331 |
现金流量表 |
dividend |
dividend |
ts_code, end_date |
19901231 |
分红送股 |
基金数据表
| Table |
Tushare API |
Primary Keys |
官方最早日期 |
说明 |
fund_basic |
fund_basic |
ts_code |
- |
基金列表 (E=场内 O=场外) |
fund_daily |
fund_daily |
ts_code, trade_date |
20050104 |
场内基金日线行情 |
fund_nav |
fund_nav |
ts_code, nav_date |
20000101 |
基金净值 (单位/累计/复权) |
fund_div |
fund_div |
ts_code, ann_date |
19991231 |
基金分红 |
fund_portfolio |
fund_portfolio |
ts_code, end_date, symbol |
20000101 |
基金持仓 (十大重仓股) |
fund_share |
fund_share |
ts_code, trade_date |
20050104 |
基金份额变动 |
fund_manager |
fund_manager |
ts_code, begin_date, name |
19991231 |
基金经理 |
fund_adj |
fund_adj |
ts_code, trade_date |
20050104 |
基金复权因子 |
沪深港通数据表
| Table |
Tushare API |
Primary Keys |
官方最早日期 |
说明 |
moneyflow_hsgt |
moneyflow_hsgt |
trade_date |
20141117 |
沪深港通资金流向 (北向/南向) |
hsgt_top10 |
hsgt_top10 |
trade_date, ts_code, market_type |
20141117 |
沪深股通十大成交股 |
ggt_top10 |
ggt_top10 |
trade_date, ts_code, market_type |
20141117 |
港股通十大成交股 |
ggt_daily |
ggt_daily |
trade_date |
20141117 |
港股通每日成交统计 |
hk_hold |
hk_hold |
code, trade_date, exchange |
20141117 |
沪深港通持股明细 |
同花顺板块说明
ths_index 表包含以下类型的板块指数,本项目仅实现部分类型:
| 类型 |
说明 |
数量 |
实现状态 |
| I |
行业板块 |
1077 |
✅ 已实现 |
| N |
概念板块 |
411 |
✅ 已实现 |
| R |
地域板块 |
33 |
✅ 已实现 |
| BB |
宽基指数 |
46 |
✅ 已实现 |
| S |
特色指数 |
126 |
❌ 未实现 (技术面筛选,使用少) |
| ST |
风格指数 |
21 |
❌ 未实现 (可用其他方式构建) |
| TH |
同花顺特色 |
10 |
❌ 未实现 (专有指数,可替代性强) |
For column details and parameter meanings, invoke /tushare-finance <api_name>.
Special Notes
Update Frequency
| Table |
Frequency |
Notes |
concept_data |
Daily |
Auto-downloaded from GitHub Release, cached locally |
index_weight |
Monthly |
Updated on the last trading day of each month; query using month-end dates |
fina_indicator_vip |
Quarterly |
Financial indicator data; use end_date as the reporting period (e.g., 20231231) |
income |
Quarterly |
Income statement data; use end_date as the reporting period |
balancesheet |
Quarterly |
Balance sheet data; use end_date as the reporting period |
cashflow |
Quarterly |
Cash flow statement data; use end_date as the reporting period |
dividend |
Quarterly/Annual |
Dividend data; use end_date as the reporting period |
fund_portfolio |
Quarterly |
Fund holdings data; use end_date as the reporting period |
trade_cal |
Static |
Trading calendar; query using cal_date field |
Date Field Notes
- Daily data tables: Use
trade_date field for queries
- Financial data tables: Use
end_date field (reporting period), not announcement date
- Fund NAV tables: Use
nav_date field
- Membership tables (
hs_const, index_member_all): Contains in_date/out_date fields for tracking historical changes
- Concept sectors: Use PIT queries with
in_date/out_date range
Important Query Tips
- index_weight: Only query for month-end dates (e.g., 20240131, 20240229); daily data is not available
- Financial reports: When querying quarterly data, use the period-end date (e.g., 20240331 for Q1 2024)
- trade_cal: Use
is_open='1' to filter trading days only
- hs_const: Contains historical records; filter by
in_date and out_date to get valid constituents for a specific date
- Concept sectors: Always use PIT queries (e.g.,
get_concept_stocks('20240115', concept_name='AI')) to avoid look-ahead bias
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: tushare-duckdb3description: Query Chinese stock data from local DuckDB cache. Includes Tushare Pro data and jquant_data_sync concept sector data. Use when this capability is needed.4---56<!--7INSTALLATION:8 Global: cp -r docs/skills/tushare-duckdb ~/.claude/skills/9 Project: cp -r docs/skills/tushare-duckdb .claude/skills/10-->1112# tushare-duckdb1314Local DuckDB cache layer for Tushare Pro data with integrated concept sector data from jquant_data_sync.1516## Quick Start1718### Read Data (no network, concurrent-safe)1920```python21from tushare_db import DataReader2223reader = DataReader(db_path="tushare.db")2425# Single stock with forward adjustment26df = reader.get_stock_daily('000001.SZ', '20240101', adj='qfq')2728# Multiple stocks29df = reader.get_multiple_stocks_daily(['000001.SZ', '600519.SH'], '20240101')3031# Concept sector constituents (from jquant_data_sync)32df = reader.get_concept_stocks('20240115', concept_name='人工智能')3334# Stock's concept sectors35df = reader.get_stock_concepts('20240115', ts_code='000001.SZ')3637# Trade calendar38df = reader.get_trade_calendar('20240101', '20241231')3940# Stock list41df = reader.get_stock_basic(list_status='L')4243# Custom SQL44df = reader.query("SELECT * FROM daily WHERE ts_code = ?", ['000001.SZ'])4546reader.close()47```4849### Download Data (requires TUSHARE_TOKEN env var)5051```python52from tushare_db import DataDownloader5354downloader = DataDownloader(db_path="tushare.db", rate_limit_profile="standard")5556# Basic data57downloader.download_trade_calendar()58downloader.download_stock_basic()5960# Daily data for all stocks61downloader.download_all_stocks_daily(start_date='20200101')6263# Daily update (single date)64downloader.download_daily_data_by_date('20241218')6566downloader.close()67```6869## Concept Sector Data (jquant_data_sync)7071External concept sector data integrated via `DataReader`:7273```python74from tushare_db import DataReader7576reader = DataReader(db_path="tushare.db")7778# Get concept constituents for a specific date (PIT)79df = reader.get_concept_stocks('20240115', concept_name='人工智能')80# Returns: ts_code, concept_name, in_date, out_date8182# Get all concept sectors for a stock83df = reader.get_stock_concepts('20240115', ts_code='000001.SZ')84# Returns: concept_code, concept_name, in_date, out_date8586# Get full cross-section for a date87df = reader.get_concept_cross_section('20240115')88# Returns all concept-stock relationships for the date8990# Search concept sectors91df = reader.search_concepts('芯片') # Fuzzy search9293# List all concept sectors94df = reader.get_all_concepts() # concept_code, concept_name9596# Force refresh data from GitHub97reader.refresh_concept_data()9899# Check cache status100info = reader.get_concept_cache_info()101reader.close()102```103104**Data Characteristics:**105- **Source**: [jquant_data_sync](https://github.com/tycallen/jquant_data_sync) GitHub Releases106- **Format**: SCD (Slowly Changing Dimension) with in_date/out_date107- **Update**: Daily auto-download with local caching108- **Cache Location**: `.concept_cache/all_concepts_pit_scd.csv`109110## Point-in-Time (PIT) Queries111112For backtesting, always use PIT queries to avoid look-ahead bias:113114```python115from tushare_db import DataReader116117reader = DataReader(db_path="tushare.db")118119# ❌ Wrong: Current snapshot (causes look-ahead bias)120df = reader.get_index_member_all(l1_code='801010.SI', is_new='Y')121122# ✅ Correct: PIT query as of historical date123df = reader.get_index_member_all(124 l1_code='801010.SI',125 trade_date='20230115' # Only stocks in sector on this date126)127128# ✅ Correct: Concept sector PIT query129df = reader.get_concept_stocks('20230115', concept_name='人工智能')130```131132**Correct SQL for PIT joins:**133```sql134-- For index_member_all135SELECT *136FROM my_data d137JOIN index_member_all im ON d.ts_code = im.ts_code138WHERE im.in_date <= d.trade_date139 AND (im.out_date IS NULL OR im.out_date > d.trade_date)140141-- For concept sectors (from jquant_data_sync)142SELECT *143FROM my_data d144JOIN concept_data c ON d.ts_code = c.ts_code145WHERE c.in_date <= d.trade_date146 AND c.out_date >= d.trade_date147```148149**Manual PIT data backfill:**150```bash151# If database lacks historical out_date data152python scripts/backfill_index_member_pit.py153```154155## Key Notes156157- **Date format**: `YYYYMMDD` string (e.g., `'20240101'`)158- **Adjustment types**:159 - `adj_factor` table stores raw Tushare adjustment factors160 - `qfq` (forward): `price * (factor / latest_factor)` — latest price = market price161 - `hfq` (backward): `price * factor` — historical prices stay fixed162 - DataReader handles calculation automatically via `adj='qfq'` or `adj='hfq'`163- **Rate limit profiles**: `'trial'`, `'standard'`, `'pro'`164165## Implemented Tables166167### External Data Sources168169| Data Source | Type | Access | Update | Description |170|-------------|------|--------|--------|-------------|171| `concept_data` | External | `DataReader.get_concept_*()` | Daily auto-download | A-share concept sectors from jquant_data_sync |172173### 基础信息表(静态数据)174175| Table | Tushare API | Primary Keys | 官方最早日期 | 说明 |176|-------|-------------|--------------|-------------|------|177| `trade_cal` | trade_cal | exchange, cal_date | 19910404 | 交易日历,exchange='SSE' |178| `stock_basic` | stock_basic | ts_code | - | 股票列表 |179| `stock_company` | stock_company | ts_code | - | 上市公司信息 |180| `index_basic` | index_basic | ts_code | - | 指数列表 |181| `index_classify` | index_classify | industry_code | - | 申万行业分类,src='SW2021' |182| `index_member_all` | index_member_all | ts_code, l3_code, in_date | - | 申万行业成分股(PIT支持) |183| `hs_const` | hs_const | ts_code, in_date | 20141117 | 沪深港通成分 |184| `ths_index` | ths_index | ts_code | - | 同花顺板块列表 (见下方说明) |185| `ths_member` | ths_member | ts_code, con_code | - | 同花顺板块成分股 |186187### 日频时间序列表188189| Table | Tushare API | Primary Keys | 官方最早日期 | 说明 |190|-------|-------------|--------------|-------------|------|191| `daily` | daily | ts_code, trade_date | 19910404 | 日线行情 |192| `adj_factor` | adj_factor | ts_code, trade_date | 19910403 | 复权因子 |193| `daily_basic` | daily_basic | ts_code, trade_date | 19910404 | 每日指标(PE/PB/市值) |194| `index_daily` | index_daily | ts_code, trade_date | 19901219 | 指数日线 |195| `moneyflow` | moneyflow | ts_code, trade_date | **20100104** | 个股资金流向 |196| `cyq_perf` | cyq_perf | ts_code, trade_date | **20180102** | 筹码分布绩效 |197| `stk_factor_pro` | stk_factor_pro | ts_code, trade_date | **20050104** | 技术因子(MACD/KDJ等) |198| `limit_list_d` | limit_list_d | ts_code, trade_date, limit | **20200102** | 涨跌停统计 (U/D/Z) |199| `margin_detail` | margin_detail | ts_code, trade_date | **20100331** | 融资融券明细 |200| `sw_daily` | sw_daily | ts_code, trade_date | **20210104** | 申万指数日线 (SW2021版) |201| `ths_daily` | ths_daily | ts_code, trade_date | **20180102** | 同花顺板块日行情 |202| `moneyflow_dc` | moneyflow_dc | ts_code, trade_date | **20230911** | 个股资金流(东财) |203| `moneyflow_ind_dc` | moneyflow_ind_dc | trade_date, ts_code | **20230912** | 行业资金流(东财) |204| `dc_index` | dc_index | ts_code, trade_date | **20241220** | 龙虎榜个股明细 |205| `dc_member` | dc_member | ts_code, trade_date, con_code | **20241220** | 龙虎榜机构席位 |206| `kpl_concept` | kpl_concept | ts_code, trade_date | **20241014** | 开盘啦题材列表 |207| `kpl_concept_cons` | kpl_concept_cons | ts_code, con_code, trade_date | **20241014** | 开盘啦题材成分 |208| `index_weight` | index_weight | index_code, trade_date, con_code | **20050930** | 指数成分权重(月度) |209210### 财务数据表(季度更新)211212| Table | Tushare API | Primary Keys | 官方最早日期 | 说明 |213|-------|-------------|--------------|-------------|------|214| `fina_indicator_vip` | fina_indicator_vip | ts_code, end_date | **19901231** | 财务指标 |215| `income` | income_vip | ts_code, end_date, report_type | **19941231** | 利润表 |216| `balancesheet` | balancesheet_vip | ts_code, end_date, report_type | **19891231** | 资产负债表 |217| `cashflow` | cashflow_vip | ts_code, end_date, report_type | **19980331** | 现金流量表 |218| `dividend` | dividend | ts_code, end_date | **19901231** | 分红送股 |219220### 基金数据表221222| Table | Tushare API | Primary Keys | 官方最早日期 | 说明 |223|-------|-------------|--------------|-------------|------|224| `fund_basic` | fund_basic | ts_code | - | 基金列表 (E=场内 O=场外) |225| `fund_daily` | fund_daily | ts_code, trade_date | **20050104** | 场内基金日线行情 |226| `fund_nav` | fund_nav | ts_code, nav_date | **20000101** | 基金净值 (单位/累计/复权) |227| `fund_div` | fund_div | ts_code, ann_date | **19991231** | 基金分红 |228| `fund_portfolio` | fund_portfolio | ts_code, end_date, symbol | **20000101** | 基金持仓 (十大重仓股) |229| `fund_share` | fund_share | ts_code, trade_date | **20050104** | 基金份额变动 |230| `fund_manager` | fund_manager | ts_code, begin_date, name | **19991231** | 基金经理 |231| `fund_adj` | fund_adj | ts_code, trade_date | **20050104** | 基金复权因子 |232233### 沪深港通数据表234235| Table | Tushare API | Primary Keys | 官方最早日期 | 说明 |236|-------|-------------|--------------|-------------|------|237| `moneyflow_hsgt` | moneyflow_hsgt | trade_date | **20141117** | 沪深港通资金流向 (北向/南向) |238| `hsgt_top10` | hsgt_top10 | trade_date, ts_code, market_type | **20141117** | 沪深股通十大成交股 |239| `ggt_top10` | ggt_top10 | trade_date, ts_code, market_type | **20141117** | 港股通十大成交股 |240| `ggt_daily` | ggt_daily | trade_date | **20141117** | 港股通每日成交统计 |241| `hk_hold` | hk_hold | code, trade_date, exchange | **20141117** | 沪深港通持股明细 |242243### 同花顺板块说明244245`ths_index` 表包含以下类型的板块指数,本项目**仅实现部分类型**:246247| 类型 | 说明 | 数量 | 实现状态 |248|------|------|------|----------|249| **I** | 行业板块 | 1077 | ✅ 已实现 |250| **N** | 概念板块 | 411 | ✅ 已实现 |251| **R** | 地域板块 | 33 | ✅ 已实现 |252| **BB** | 宽基指数 | 46 | ✅ 已实现 |253| S | 特色指数 | 126 | ❌ 未实现 (技术面筛选,使用少) |254| ST | 风格指数 | 21 | ❌ 未实现 (可用其他方式构建) |255| TH | 同花顺特色 | 10 | ❌ 未实现 (专有指数,可替代性强) |256257For column details and parameter meanings, invoke `/tushare-finance <api_name>`.258259## Special Notes260261### Update Frequency262263| Table | Frequency | Notes |264|-------|-----------|-------|265| `concept_data` | **Daily** | Auto-downloaded from GitHub Release, cached locally |266| `index_weight` | **Monthly** | Updated on the last trading day of each month; query using month-end dates |267| `fina_indicator_vip` | **Quarterly** | Financial indicator data; use `end_date` as the reporting period (e.g., 20231231) |268| `income` | **Quarterly** | Income statement data; use `end_date` as the reporting period |269| `balancesheet` | **Quarterly** | Balance sheet data; use `end_date` as the reporting period |270| `cashflow` | **Quarterly** | Cash flow statement data; use `end_date` as the reporting period |271| `dividend` | **Quarterly/Annual** | Dividend data; use `end_date` as the reporting period |272| `fund_portfolio` | **Quarterly** | Fund holdings data; use `end_date` as the reporting period |273| `trade_cal` | **Static** | Trading calendar; query using `cal_date` field |274275### Date Field Notes276277- **Daily data tables**: Use `trade_date` field for queries278- **Financial data tables**: Use `end_date` field (reporting period), not announcement date279- **Fund NAV tables**: Use `nav_date` field280- **Membership tables** (`hs_const`, `index_member_all`): Contains `in_date`/`out_date` fields for tracking historical changes281- **Concept sectors**: Use PIT queries with `in_date`/`out_date` range282283### Important Query Tips2842851. **index_weight**: Only query for month-end dates (e.g., 20240131, 20240229); daily data is not available2862. **Financial reports**: When querying quarterly data, use the period-end date (e.g., 20240331 for Q1 2024)2873. **trade_cal**: Use `is_open='1'` to filter trading days only2884. **hs_const**: Contains historical records; filter by `in_date` and `out_date` to get valid constituents for a specific date2895. **Concept sectors**: Always use PIT queries (e.g., `get_concept_stocks('20240115', concept_name='AI')`) to avoid look-ahead bias290291---292> Converted and distributed by [TomeVault](https://tomevault.io/claim/tycallen) — claim your Tome and manage your conversions.293<!-- tomevault:4.0:skill_md:2026-04-11 -->