From 5850a6056175c61c20395bbdafae22f41b50b7f4 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Fri, 14 Aug 2026 08:29:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(api+web):=20=E4=BB=BB=E5=8A=A1=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=AE=A1=E7=90=86(=E9=AA=8C=E6=94=B6=E5=9B=9B?= =?UTF-8?q?=E8=BD=AE=E6=89=B91):=E5=8E=86=E5=8F=B2=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E2=86=92=E4=BB=BB=E5=8A=A1=E5=88=97=E8=A1=A8=E6=94=B9=E5=90=8D?= =?UTF-8?q?;DELETE=20/task/{id}=E5=8D=95/=E6=89=B9=E5=88=A0=E9=99=A4(?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=E6=8B=92=E5=88=A0);GET=20/task/{id}?= =?UTF-8?q?/params=E5=8F=82=E6=95=B0=E5=9B=9E=E6=94=BE+=E7=82=B9=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1ID=E8=B7=B3=E5=8F=82=E6=95=B0=E9=A1=B5=E9=A2=84?= =?UTF-8?q?=E5=A1=AB;=E7=9C=9F=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4+?= =?UTF-8?q?=E8=80=97=E6=97=B6=E5=88=97(=E6=8F=90=E4=BA=A4=E5=8D=B3?= =?UTF-8?q?=E8=AE=B0,=E8=BF=9B=E8=A1=8C=E4=B8=AD=E6=B4=BB=E8=AE=A1?= =?UTF-8?q?=E6=97=B6);=E8=BF=9B=E8=A1=8C=E4=B8=AD=E7=A6=81=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B;=E7=BB=84=E5=90=88=E4=BB=BB=E5=8A=A1params=E5=85=A8?= =?UTF-8?q?=E9=87=8F=E5=AD=98=20[nas]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/backtest.ts | 24 +++ frontend/src/views/Dashboard.vue | 2 +- frontend/src/views/Layout.vue | 6 +- frontend/src/views/backtest/History.vue | 154 ++++++++++++++-- frontend/src/views/backtest/New.vue | 19 +- .../src/views/backtest/PortfolioBacktest.vue | 28 ++- sanguo_api/routes.py | 93 +++++++++- sanguo_orchestrator/portfolio_worker.py | 12 +- sanguo_orchestrator/runner.py | 14 ++ tests/api/test_task_list_management.py | 174 ++++++++++++++++++ 10 files changed, 499 insertions(+), 27 deletions(-) create mode 100644 tests/api/test_task_list_management.py diff --git a/frontend/src/api/backtest.ts b/frontend/src/api/backtest.ts index 725b92d..82a77f8 100644 --- a/frontend/src/api/backtest.ts +++ b/frontend/src/api/backtest.ts @@ -105,6 +105,9 @@ export interface TaskListItem { start: string end: string instance?: string + created_at?: string + finished_at?: string + duration_s?: number | null } export async function getTasks(type?: string): Promise { @@ -112,6 +115,27 @@ export async function getTasks(type?: string): Promise { return data.tasks } +export interface TaskParamsInfo { + task_id: string + type: string + status: string + strategy: string + symbol: string + params: Record + start: string + end: string +} + +export async function getTaskParams(taskId: string): Promise { + const { data } = await apiClient.get(`/task/${taskId}/params`) + return data +} + +export async function deleteTask(taskId: string): Promise<{ deleted: number }> { + const { data } = await apiClient.delete<{ deleted: number }>(`/task/${taskId}`) + return data +} + export interface OptimizeSubmit { symbol: string strategy: string diff --git a/frontend/src/views/Dashboard.vue b/frontend/src/views/Dashboard.vue index f26d5ad..78179b6 100644 --- a/frontend/src/views/Dashboard.vue +++ b/frontend/src/views/Dashboard.vue @@ -33,7 +33,7 @@ const quickActions = [ { label: '新建回测', desc: 'CTA 策略历史回测', path: '/backtest/new', mark: 'BT' }, { label: '因子分析', desc: 'IC / 分层回测', path: '/factor/new', mark: 'FA' }, { label: '新建模拟盘', desc: '回放 / 实盘模式', path: '/paper/new', mark: 'PA' }, - { label: '历史任务', desc: '全部回测记录', path: '/backtest/history', mark: 'HI' }, + { label: '任务列表', desc: '全部回测记录', path: '/backtest/history', mark: 'HI' }, ] as const function go(path: string): void { diff --git a/frontend/src/views/Layout.vue b/frontend/src/views/Layout.vue index 3ae0122..5cc6cad 100644 --- a/frontend/src/views/Layout.vue +++ b/frontend/src/views/Layout.vue @@ -25,7 +25,7 @@ const PAGE_TITLE: Array<{ match: RegExp; group: string; title: string }> = [ { match: /^\/backtest\/new$/, group: '回测', title: '个股回测' }, { match: /^\/backtest\/portfolio$/, group: '回测', title: '组合回测' }, { match: /^\/backtest\/optimize$/, group: '回测', title: '参数优化' }, - { match: /^\/backtest\/history$/, group: '回测', title: '历史任务' }, + { match: /^\/backtest\/history$/, group: '回测', title: '任务列表' }, { match: /^\/backtest\/progress\//, group: '回测', title: '任务进度' }, { match: /^\/backtest\/result\//, group: '回测', title: '回测结果' }, { match: /^\/factor\/new$/, group: '投研', title: '因子分析' }, @@ -64,7 +64,7 @@ const CMD_ITEMS: CmdItem[] = [ { label: '个股回测', group: '回测', path: '/backtest/new' }, { label: '组合回测', group: '回测', path: '/backtest/portfolio' }, { label: '参数优化', group: '回测', path: '/backtest/optimize' }, - { label: '历史任务', group: '回测', path: '/backtest/history' }, + { label: '任务列表', group: '回测', path: '/backtest/history' }, { label: '因子分析', group: '投研', path: '/factor/new' }, { label: '模拟盘列表', group: '模拟', path: '/paper' }, { label: '新建模拟盘', group: '模拟', path: '/paper/new' }, @@ -164,7 +164,7 @@ function onLogout(): void { 个股回测 组合回测 参数优化 - 历史任务 + 任务列表 diff --git a/frontend/src/views/backtest/History.vue b/frontend/src/views/backtest/History.vue index f457d70..2ec6fee 100644 --- a/frontend/src/views/backtest/History.vue +++ b/frontend/src/views/backtest/History.vue @@ -1,20 +1,25 @@