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 @@ + + + + +