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 () => { /> - - + + + +