Files
etf/rotation/config_simple.yaml
aszerW adb83d8cd7 feat: 实现贪心分配模式(greedy)
- config_loader.py: 添加 etf_pool 字段和 GREEDY 枚举
- config_simple.yaml: 每个资产添加 etf_pool 列表
- simple_rotation.py:
  - 添加 _compute_greedy_weights 方法
  - _calculate_daily_return 支持 greedy 模式
  - 向后兼容原有 rank/equal 模式

贪心算法:按 ETF 池容量分配仓位,装不下的顺延给下一名
- 有色金属(1 ETF): 吸收25%,顺延75%
- 原油(3 ETF): 吸收75%
- 黄金(4 ETF): 吸收100%

回测对比 (select_num=3):
- rank: 326.60% 累计收益, 1.24 夏普
- greedy: 421.35% 累计收益, 1.03 夏普
2026-06-21 12:40:40 +08:00

132 lines
3.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

asset_pools:
assets:
399006.SZ:
description: 创业板指数
group: A
name: 创业板指
signal_source: 399006.SZ
trade_source: 159915.SZ
etf_pool: [159915.SZ, 159952.SZ, 159957.SZ, 159948.SZ]
931862.CSI:
description: 中证0-9个月国债指数久期<1年防御配置
group: BOND
name: 短债指数
signal_source: 931862.CSI
trade_source: 931862.CSI
etf_pool: [931862.CSI]
CL=F:
description: WTI原油期货2000年至今
group: COMMODITY
name: 原油
signal_source: CL=F
trade_source: 160723.SZ
etf_pool: [160723.SZ, 501018.SH, 161129.SZ]
GC=F:
description: COMEX黄金期货2000年至今
group: COMMODITY
name: 黄金
signal_source: GC=F
trade_source: 518880.SH
etf_pool: [518880.SH, 159937.SZ, 159934.SZ, 518800.SH]
GDAXI:
description: 德国DAX指数
group: EU
name: 德国DAX
signal_source: GDAXI
trade_source: 513030.SH
etf_pool: [159561.SZ, 513030.SH]
H30269.CSI:
description: 红利低波指数
group: A
name: 中证红利低波
signal_source: H30269.CSI
trade_source: 512890.SH
etf_pool: [512890.SH, 563020.SH, 159547.SZ, 560150.SH]
HG=F:
description: COMEX铜期货2000年至今
group: COMMODITY
name: 有色金属
signal_source: HG=F
trade_source: 159980.SZ
etf_pool: [159980.SZ]
HSI:
description: 恒生指数
group: HK
name: 恒生指数
signal_source: HSI
trade_source: 159920.SZ
etf_pool: [159920.SZ, 513600.SH, 159271.SZ, 513210.SH]
HSTECH.HK:
description: 恒生科技指数
group: HK
name: 恒生科技
signal_source: HSTECH.HK
trade_source: 513130.SH
etf_pool: [513180.SH, 513130.SH, 513010.SH, 159740.SZ]
N225:
description: 日经225指数
group: JP
name: 日经225
signal_source: N225
trade_source: 513520.SH
etf_pool: [513880.SH, 513520.SH, 513000.SH, 159866.SZ]
NDX:
description: 纳斯达克100指数
group: US
name: 纳指100
signal_source: NDX
trade_source: 513100.SH
etf_pool: [159941.SZ, 513100.SH, 513300.SH, 159501.SZ]
backtest:
start_date: '2020-01-10'
benchmark:
code: 000300.SH
name: 沪深300
data:
sources:
- enabled: true
timeout: 120
type: flask_api
url: ${FLASK_API_URL}
factor:
n_days: 25
type: slope_r2
metadata:
description: 全球资产大类轮动策略 V2 - 复现 V1 结果
last_updated: '2024-04-16'
strategy: rotation
version: 2.0.0
premium_control:
default_threshold: 0.1
enabled: false
market_overrides:
A:
enabled: false
COMMODITY:
enabled: false
HK:
enabled: true
threshold: 0.1
US:
enabled: true
threshold: 0.1
mode: filter
penalty_factor: 0.5
rebalance:
min_hold_days: 1
score_threshold: 0.0
trade_cost: 0.001
rotation:
diversified: true
select_num: 3
weight: rank
etf_max_weight: 0.25
threshold:
dynamic:
fallback_enabled: true
fallback_value: 0.0
ratio: 1.0
reference: 931862.CSI
fixed_value: 0.0
mode: dynamic