feat(frontend): 终端化重构+策略管理(代码→实例→4运行)+撮合设计+回测参数 [nas]
CI/CD / test (push) Successful in 18s
CI/CD / nas-deploy (push) Failing after 17s
CI/CD / nas-verify (push) Has been skipped

- 终端化: 科幻色板(tokens/EP/reset/chips/echarts)+Layout(Cmd+K/时钟/状态灯)+mock全接口+Dashboard/Result/Monitor样板+6图表配色
- 策略管理: 策略库三层(代码→实例→4运行)+新建策略(组合/CTA模板+Monaco)+在线代码编辑(Monaco)+实例CRUD(参数反射/标的池type切/interval/match_session)
- 实例→运行关联: backtest/paper/live New页读instance预填
- 撮合设计: match_session(下一根K线开盘/收盘/集合竞价)+interval定频率+实走限日线/分钟走miniQMT
- 回测参数: 基准下拉+日期默认1年localStorage记忆+滑点/手续费UI
- 账户管理页+命名重整(模拟盘/实盘,消除撞名)
- spec §11-13(菜单/策略管理/撮合设计) + Monaco编辑器 + 策略实例删除/编辑入口 + 列表实例列
This commit is contained in:
2026-08-12 23:23:23 +08:00
parent 58b5d08280
commit 5c8a7e12c6
45 changed files with 3935 additions and 459 deletions
+4
View File
@@ -8,6 +8,9 @@ export interface CtaSubmit {
end: string
benchmark?: string
interval?: string
slippage?: number
commission_rate?: number
stamp_duty_rate?: number
}
export interface TaskStatus {
@@ -101,6 +104,7 @@ export interface TaskListItem {
symbol: string
start: string
end: string
instance?: string
}
export async function getTasks(type?: string): Promise<TaskListItem[]> {
+21 -1
View File
@@ -1,6 +1,7 @@
import axios, { AxiosError } from 'axios'
import axios, { AxiosError, type AxiosResponse } from 'axios'
import { useAuthStore } from '@/stores/auth'
import { router } from '@/router'
import { matchMock, MOCK_ON } from '@/mock'
export const apiClient = axios.create({
baseURL: '/api/v1',
@@ -12,6 +13,25 @@ apiClient.interceptors.request.use((config) => {
if (auth.token) {
config.headers.Authorization = `Bearer ${auth.token}`
}
// 样板 mock:命中假数据表的请求直接短路(自定义 adapter),不发网络。
// 接真实后端联调时,把 src/mock/index.ts 的 MOCK_ON 置 false 即可恢复全部真实请求。
if (MOCK_ON) {
const url = config.url ?? ''
const method = config.method ?? 'get'
const mock = matchMock(method, url)
if (mock !== undefined) {
const cfg = config
cfg.adapter = (): Promise<AxiosResponse> =>
Promise.resolve({
data: mock,
status: 200,
statusText: 'MOCK_OK',
headers: {},
config: cfg,
} as AxiosResponse)
}
}
return config
})
+1
View File
@@ -24,6 +24,7 @@ export interface LiveAccount {
latest_date?: string | null
total_return?: number | null
position_count?: number
instance?: string
}
export interface LiveCreateRequest {
+1
View File
@@ -36,6 +36,7 @@ export interface PaperAccount {
latest_equity?: number | null
latest_date?: string | null
total_return?: number | null
instance?: string
}
export interface BalancePoint {
+34
View File
@@ -19,3 +19,37 @@ export async function getParams(name: string): Promise<StrategyParams> {
const { data } = await apiClient.get<StrategyParams>(`/strategy/${name}/params`)
return data
}
// ----- 策略配置 CRUD(策略类+参数+标的 的可命名持久化配置)-----
export interface StrategyConfig {
id: number
name: string
strategy_class: string
params: Record<string, unknown>
symbol_or_pool: string
benchmark: string
interval: string
remark: string
created_at: string
updated_at?: string
}
export type StrategyConfigInput = Omit<StrategyConfig, 'id' | 'created_at' | 'updated_at'>
export async function getStrategyConfigs(): Promise<StrategyConfig[]> {
const { data } = await apiClient.get<{ strategies: StrategyConfig[] }>('/strategy/configs')
return data.strategies
}
export async function createStrategyConfig(req: StrategyConfigInput): Promise<number> {
const { data } = await apiClient.post<{ id: number }>('/strategy/configs', req)
return data.id
}
export async function updateStrategyConfig(id: number, req: StrategyConfigInput): Promise<void> {
await apiClient.put(`/strategy/configs/${id}`, req)
}
export async function deleteStrategyConfig(id: number): Promise<void> {
await apiClient.delete(`/strategy/configs/${id}`)
}