From dc22799985fbea9d685e734860e7907e5a5ab2ab Mon Sep 17 00:00:00 2001 From: fish Date: Sun, 3 May 2026 16:09:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=85=AD=E4=B8=AA=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E5=93=81=E7=A7=8D=E5=B9=B6=E4=BF=AE=E6=AD=A3=201/5/9?= =?UTF-8?q?=20=E6=9C=88=E5=90=88=E7=BA=A6=E8=BD=AE=E6=8D=A2=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- tushare/src/contracts.py | 43 ++++++++++++++++++++++++++++++ web/frontend/src/views/RunView.vue | 12 ++++----- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/tushare/src/contracts.py b/tushare/src/contracts.py index 2c82982..998d44c 100644 --- a/tushare/src/contracts.py +++ b/tushare/src/contracts.py @@ -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), + }, + }, } diff --git a/web/frontend/src/views/RunView.vue b/web/frontend/src/views/RunView.vue index 2c15e63..f00927e 100644 --- a/web/frontend/src/views/RunView.vue +++ b/web/frontend/src/views/RunView.vue @@ -4,6 +4,8 @@ import { ElMessage } from 'element-plus' import { listContracts } from '@/api/scores' import { runPipeline, type RunResponse } from '@/api/run' +const SYMBOLS = ['FG', 'SA', 'RB', 'MA', 'CF', 'M'] + const form = reactive<{ ts_code: string symbol: string @@ -83,12 +85,10 @@ onMounted(async () => { /> - - + + + +