feat(paper/live): 生命周期管理补全: paper停止/恢复(实走20:30 step跳过stopped)/删除(连带净值成交持仓挂单)/编辑(名称标的资金); live删除(运行中拒绝)/编辑(stopped才可改); 前端列表+结果页按钮/编辑弹窗/删除确认 [vps]
This commit is contained in:
@@ -124,3 +124,21 @@ export async function getLiveStatus(aid: number): Promise<LiveStatus> {
|
||||
const { data } = await apiClient.get<LiveStatus>(`/live/${aid}/status`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deleteLive(aid: number): Promise<{ account_id: number; deleted: boolean }> {
|
||||
const { data } = await apiClient.delete(`/live/${aid}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export interface LiveUpdateReq {
|
||||
name?: string
|
||||
account?: string
|
||||
vt_symbol?: string
|
||||
strategy_name?: string
|
||||
interval?: string
|
||||
}
|
||||
|
||||
export async function updateLive(aid: number, req: LiveUpdateReq): Promise<{ updated: boolean }> {
|
||||
const { data } = await apiClient.put(`/live/${aid}`, req)
|
||||
return data
|
||||
}
|
||||
|
||||
@@ -124,3 +124,29 @@ export async function getPending(aid: number): Promise<PendingOrder[]> {
|
||||
const { data } = await apiClient.get<PendingOrder[]>(`/paper/${aid}/pending`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function stopPaper(aid: number): Promise<{ account_id: number; status: string }> {
|
||||
const { data } = await apiClient.post(`/paper/${aid}/stop`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function resumePaper(aid: number): Promise<{ account_id: number; status: string }> {
|
||||
const { data } = await apiClient.post(`/paper/${aid}/resume`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function deletePaper(aid: number): Promise<{ account_id: number; deleted: boolean }> {
|
||||
const { data } = await apiClient.delete(`/paper/${aid}`)
|
||||
return data
|
||||
}
|
||||
|
||||
export interface PaperUpdateReq {
|
||||
name?: string
|
||||
symbols?: string[]
|
||||
initial_capital?: number
|
||||
}
|
||||
|
||||
export async function updatePaper(aid: number, req: PaperUpdateReq): Promise<{ updated: boolean }> {
|
||||
const { data } = await apiClient.put(`/paper/${aid}`, req)
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user