固定六个交易品种并修正 1/5/9 月合约轮换规则

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
fish
2026-05-03 16:09:50 +08:00
parent a1355d91aa
commit dc22799985
2 changed files with 49 additions and 6 deletions

View File

@@ -6,6 +6,9 @@ from typing import Optional
# exchange: tushare 合约后缀(交易所)
# active: 当月 -> (主力合约月, 年份偏移)
# 例 FG 12 月用次年 5 月,故 12 -> (5, 1)
# 允许前端选择的品种列表
SYMBOLS = ["FG", "SA", "RB", "MA", "CF", "M"]
ROLLOVER_RULES: dict[str, dict] = {
"FG": {
"exchange": "ZCE",
@@ -16,6 +19,46 @@ ROLLOVER_RULES: dict[str, dict] = {
12: (5, 1),
},
},
"SA": {
"exchange": "ZCE",
"active": {
1: (5, 0), 2: (5, 0), 3: (5, 0), 4: (5, 0),
5: (9, 0), 6: (9, 0), 7: (9, 0), 8: (9, 0),
9: (1, 1), 10: (1, 1), 11: (1, 1), 12: (1, 1),
},
},
"MA": {
"exchange": "ZCE",
"active": {
1: (5, 0), 2: (5, 0), 3: (5, 0), 4: (5, 0),
5: (9, 0), 6: (9, 0), 7: (9, 0), 8: (9, 0),
9: (1, 1), 10: (1, 1), 11: (1, 1), 12: (1, 1),
},
},
"CF": {
"exchange": "ZCE",
"active": {
1: (5, 0), 2: (5, 0), 3: (5, 0), 4: (5, 0),
5: (9, 0), 6: (9, 0), 7: (9, 0), 8: (9, 0),
9: (1, 1), 10: (1, 1), 11: (1, 1), 12: (1, 1),
},
},
"RB": {
"exchange": "SHF",
"active": {
1: (10, 0), 2: (10, 0), 3: (10, 0), 4: (10, 0), 5: (10, 0),
6: (1, 1), 7: (1, 1), 8: (1, 1), 9: (1, 1),
10: (5, 1), 11: (5, 1), 12: (5, 1),
},
},
"M": {
"exchange": "DCE",
"active": {
1: (5, 0), 2: (5, 0), 3: (5, 0), 4: (5, 0), 5: (5, 0),
6: (9, 0), 7: (9, 0), 8: (9, 0),
9: (1, 1), 10: (1, 1), 11: (1, 1), 12: (1, 1),
},
},
}