de43444ad4
Batch download now pulls baostock's preclose, turn, pctChg, tradestatus, isST, and peTTM/pbMRQ/psTTM/pcfNcfTTM on top of OHLCV+amount, plus a derived daily VWAP (amount/volume). VWAP is raw-price scale and not comparable with adjusted OHLC under qfq/hfq — documented in the schema. Richer fields live only in the batch path (download_daily_batch -> download_universe); single-symbol download_daily keeps the legacy 8-column schema that test_downloader.py pins. Also flags intraday/L1-L2 microstructure data as a future phase in the README roadmap. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
"""Column contracts for pipeline parquet files."""
|
|
|
|
from typing import Final
|
|
|
|
# Required columns for data parquet files (daily bars, alternative data, etc.)
|
|
DATA_COLUMNS: Final[list[str]] = [
|
|
"symbol_id", # str: internal code like 'sh600000'
|
|
"symbol_name", # str: stock name like '浦发银行'
|
|
"date", # date
|
|
"open", # float64
|
|
"high", # float64
|
|
"low", # float64
|
|
"close", # float64
|
|
"preclose", # float64: previous trading day's close
|
|
"volume", # float64 (shares)
|
|
"amount", # float64 (turnover in yuan, raw/unadjusted)
|
|
"vwap", # float64: daily VWAP = amount / volume. NB raw price scale —
|
|
# NOT comparable with adjusted OHLC under qfq/hfq.
|
|
"turn", # float64: turnover rate (%)
|
|
"pctChg", # float64: daily % change
|
|
"tradestatus", # int: 1 = traded, 0 = suspended
|
|
"isST", # int: 1 = ST/special-treatment, 0 = normal
|
|
"peTTM", # float64: trailing-12m P/E
|
|
"pbMRQ", # float64: P/B (most recent quarter)
|
|
"psTTM", # float64: trailing-12m P/S
|
|
"pcfNcfTTM", # float64: P/CF (net cash flow, TTM)
|
|
]
|
|
|
|
# Required columns for alpha parquet files.
|
|
# Alphas are position WEIGHTS: positive=long, negative=short.
|
|
ALPHA_COLUMNS: Final[list[str]] = [
|
|
"symbol_id", # str: matches DATA_COLUMNS symbol_id
|
|
"date", # date: aligned with data dates
|
|
"alpha_name", # str: identifies which alpha (e.g. 'reversal_5d')
|
|
"weight", # float64: position weight, signed
|
|
]
|
|
|
|
# Required columns for combo parquet files.
|
|
COMBO_COLUMNS: Final[list[str]] = [
|
|
"symbol_id", # str
|
|
"date", # date
|
|
"combo_name", # str: identifies which combo (e.g. 'equal_weight')
|
|
"weight", # float64: combined weight, signed
|
|
]
|