Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ flowchart LR

下游接入时不改它们的接口。模拟配置继续指向一个含 `position_scale` 的 JSON。组合配置继续在策略条目上填写 `position_scale`。

仓位模型可以是原来的三档规则,也可以是波动率目标、时间序列动量或均线趋势。风格可以按动量、估值差、盈利修正或拥挤度倾斜,并限制相对等权的偏离。现金可以用收益率或债券价格的涨跌,股票预算也可以用股指期货调到目标 beta。单日调仓幅度和回撤线在决策前生效。冲击成本和固定费用一起扣在下一根 K 线上。

真实指数对照:

```powershell
python tools/fetch_public_indices.py --futures-only --offline
python -m quant_timing compare --config configs/market_comparison.yaml --out studies/market_comparison
```

修正后的十二组公开对照保存在 `studies/market_comparison/model_comparison.csv`,所有模型统一从 2019-03-08 开始。期货序列可由已提交的单合约收盘价和独立交易日历离线重建,上市前及数据覆盖前不会生成价格。公开成交量只用于行业相对权重,不推算人民币容量;表中的容量及参与率保持空值。旧版对照数字已替换,完整数据口径见 `data/public/SOURCE.md`。这些固定参数下的研究结果不构成收益承诺。

外部 regime 有两种读法,不能同时用:

- `regime.snapshot`:只封顶最新一次发布,不回放成历史。
Expand Down
109 changes: 109 additions & 0 deletions configs/market_comparison.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
market: hs300
run_id: market-comparison
input:
path: ../data/public/indices.csv
format: wide
date_col: date
start: "2019-03-08"
signals:
path: ../data/public/signals.csv
costs:
bps: 5
impact_coef: 0.1
cash:
mode: price
yield_column: bond_etf
futures:
path: ../data/public/futures.csv
activity:
path: ../data/public/amounts.csv
unit: volume
overlay:
mode: futures
contracts: [IF, IC, IM]
margin_rate: 0.12
beta_window: 60
valuation:
column: hs300_peg
lookback: 252
expensive_percentile: 0.2
scale_cap: 0.6
constraints:
max_daily_change: 0.05
drawdown_line: 0.15
drawdown_floor: 0.2
validation:
train_size: 500
test_size: 120
step_size: 120
embargo: 20
style:
return_window: 60
tilt: 0.7
threshold: 0.0
pairs:
- name: size
left: csi1000
right: csi500
group_weight: 0.2
signal: momentum
- name: cni_style
left: cni_value
right: cni_growth
group_weight: 0.2
signal: momentum
- name: value_growth
left: csi300_value
right: csi300_growth
group_weight: 0.2
signal: valuation_spread
signal_column: value_growth
- name: dividend_cycle
left: dividend
right: cyclical
group_weight: 0.2
signal: momentum
groups:
- name: industry
members: [bank, broker, pharma, electronics]
group_weight: 0.2
signal: crowding
max_active_deviation: 0.04
benchmark: amount_share
amount_window: 60
models:
rules:
vol_window: 20
vol_lookback: 120
vol_percentile_threshold: 0.8
return_window: 60
risk_off_return: -0.08
high_vol_scale: 0.5
risk_off_scale: 0.3
risk_on_scale: 1.0
vol_target:
target_vol: 0.15
vol_window: 20
floor: 0.0
cap: 1.0
tsmom:
return_window: 252
floor: 0.0
cap: 1.0
moving_average:
fast_window: 50
slow_window: 200
floor: 0.0
cap: 1.0
comparison:
models: [rules, vol_target, tsmom, moving_average]
books:
- name: position_hs300
drop_style: true
overlay_mode: cash
- name: style
drop_style: false
overlay_mode: cash
- name: futures_hs300
drop_style: true
overlay_mode: futures
52 changes: 52 additions & 0 deletions data/public/SOURCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Public snapshot

Downloaded 2026-09-29.

Index and bond ETF bars are the latest 2500 daily closes and volumes from
Sina `CN_MarketData.getKLineData`. `futures.csv` is a back-adjusted IF, IC, and IM
series: each day's return uses the dominant quarterly contract's own previous
close, rolled five trading days before the third Friday. IM before listing falls
back to IF inside the study. `bond_etf` is SSE 511010 and is only a cash/bond
total-return proxy. `amounts.csv` is Sina volume, used only for the industry
volume-share benchmark. It is not CNY turnover and cannot support monetary
participation or capacity estimates. That benchmark is not the
official historical industry weight of the CSI 300.

`signals.csv` column `value_growth` is CSI 300 Growth published `peg` minus
CSI 300 Value `peg` (000918 minus 000919). A positive number means value is
cheaper on that published field. Those closes also come from the CSI feed
because Sina's copies stop updating. Industry columns are 20-day average
volumes, a crowding proxy. `revision` is the 60-day change in close divided by
the published peg for CSI 300 value minus the same change for CSI 300 growth.
It is an implied-earnings proxy, not an analyst revision feed.
Dividend is SSE 000015 and the cyclical sleeve is CSI Energy 000928.
The Eastmoney mutual-deal report publishes gross turnover and a text quota
flag, not a signed northbound flow, so it is not used as a macro rule.

## Corrected futures snapshot (2026-09-29)

`contracts/` contains the 82 non-empty individual-contract close series returned
by Sina `InnerFuturesNewService.getDailyKLine?symbol=<contract>` during the refresh.
Missing historical contract responses remain unavailable, not flat prices. The
IF and IC indexes first become available on 2019-03-08; IM on 2022-07-25. These are
source coverage dates, not claims about the exchange's original listing dates.
No internal missing observations occur after these respective start dates.

`trading_sessions.csv` is a separately frozen XSHG session calendar from
exchange-calendars, covering 2015-01-05 through 2026-12-31. It is the exchange-session
proxy for this research snapshot, independent of the price panel's end date.
Nominal third-Friday expiries advance to the next session on holidays. Extending
this snapshot requires extending and checking this calendar before fetching new bars.

Rebuild without network access:

```powershell
python tools/fetch_public_indices.py --futures-only --offline
```

The comparison explicitly starts on 2019-03-08 for all twelve book/model rows,
so cash and futures use the same source-covered window. Earlier index observations
remain in the raw snapshot. Costs use the configured turnover-based impact model;
`capacity` and `median_participation` are unavailable. The previous comparison table
used fabricated flat pre-coverage futures prices and incorrect capacity units and
has been replaced, not carried forward as a valid result.
Loading
Loading