From 36b429993441b9bd0b4cc4e9120c08ae3c14d63b Mon Sep 17 00:00:00 2001 From: claude_dev Date: Tue, 7 Jul 2026 12:50:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E6=A8=A1=E6=8B=9F=E7=9B=98?= =?UTF-8?q?=E5=89=8D=E7=AB=AF(=E7=82=B9=E4=BA=AE=E5=85=A5=E5=8F=A3+router+?= =?UTF-8?q?New/Result=E9=A1=B5+=E5=BD=92=E5=9B=A0/=E6=8B=92=E5=8D=95?= =?UTF-8?q?=E5=B1=95=E7=A4=BA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/paper.ts | 80 +++++++++++++++++++++++++++++ frontend/src/router/index.ts | 2 + frontend/src/views/Layout.vue | 4 +- frontend/src/views/paper/New.vue | 76 +++++++++++++++++++++++++++ frontend/src/views/paper/Result.vue | 62 ++++++++++++++++++++++ 5 files changed, 222 insertions(+), 2 deletions(-) create mode 100644 frontend/src/api/paper.ts create mode 100644 frontend/src/views/paper/New.vue create mode 100644 frontend/src/views/paper/Result.vue diff --git a/frontend/src/api/paper.ts b/frontend/src/api/paper.ts new file mode 100644 index 0000000..03ac63c --- /dev/null +++ b/frontend/src/api/paper.ts @@ -0,0 +1,80 @@ +import { apiClient } from './client' + +export interface StrategyCfg { + name: string + params: Record + match_session: string + symbol: string + listing_days?: number +} + +export interface PaperCreate { + mode: string + interval: string + symbols: string[] + strategies: StrategyCfg[] + initial_capital: number + start: string + end: string +} + +export interface PaperAccount { + id: number + name: string + mode: string + interval: string + status: string +} + +export interface BalancePoint { + date: string + cash: number + market_value: number + total_equity: number + is_checkpoint: number +} + +export interface PaperTrade { + strategy_id: string + symbol: string + direction: string + price: number + volume: number + commission: number + rejected: number + reject_reason: string + bar_date: string +} + +export interface StrategySummary { + strategy_id: string + total_orders: number + filled: number + rejected: number + commission: number +} + +export async function createPaper(req: PaperCreate): Promise { + const { data } = await apiClient.post<{ account_id: number }>('/paper/create', req) + return data.account_id +} + +export async function getPaper(aid: number): Promise { + const { data } = await apiClient.get(`/paper/${aid}`) + return data +} + +export async function getEquity(aid: number): Promise { + const { data } = await apiClient.get(`/paper/${aid}/equity`) + return data +} + +export async function getTrades(aid: number): Promise { + const { data } = await apiClient.get(`/paper/${aid}/trades`) + return data +} + +export async function getStrategies(aid: number): Promise { + const { data } = await apiClient.get(`/paper/${aid}/strategies`) + return data +} diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 4ea7229..0c29e99 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -16,6 +16,8 @@ const routes: RouteRecordRaw[] = [ { path: 'factor/new', name: 'fc-new', component: () => import('@/views/factor/New.vue') }, { path: 'factor/progress/:id', name: 'fc-progress', component: () => import('@/views/backtest/Progress.vue') }, { path: 'factor/result/:id', name: 'fc-result', component: () => import('@/views/factor/Result.vue') }, + { path: 'paper/new', name: 'paper-new', component: () => import('@/views/paper/New.vue') }, + { path: 'paper/result/:id', name: 'paper-result', component: () => import('@/views/paper/Result.vue') }, ], }, ] diff --git a/frontend/src/views/Layout.vue b/frontend/src/views/Layout.vue index 769737d..60550e7 100644 --- a/frontend/src/views/Layout.vue +++ b/frontend/src/views/Layout.vue @@ -29,8 +29,8 @@ function onLogout(): void { 🔬 投研 - - 🧪 模拟 (C 期) + + 🧪 模拟 💰 实盘 (D 期 · 国金 QMT) diff --git a/frontend/src/views/paper/New.vue b/frontend/src/views/paper/New.vue new file mode 100644 index 0000000..5776abb --- /dev/null +++ b/frontend/src/views/paper/New.vue @@ -0,0 +1,76 @@ + + + diff --git a/frontend/src/views/paper/Result.vue b/frontend/src/views/paper/Result.vue new file mode 100644 index 0000000..c97c22e --- /dev/null +++ b/frontend/src/views/paper/Result.vue @@ -0,0 +1,62 @@ + + + + +