5c8a7e12c6
- 终端化: 科幻色板(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编辑器 + 策略实例删除/编辑入口 + 列表实例列
52 lines
1.8 KiB
Vue
52 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|
import { ref, onMounted, watch } from 'vue'
|
|
import type { EChartsCoreOption } from 'echarts'
|
|
import { useChart } from '@/composables/useChart'
|
|
import { darkTitle, darkTooltip, darkGrid, darkAxis } from '@/utils/echartsDark'
|
|
|
|
// 净值曲线(独立组件)。数据源 equity-curve 接口 = BacktestResult.equity_curve,
|
|
// 不依赖 *_metrics.json(CTA 引擎当前未生成该文件,致 BenchmarkCurve 等图全空)。
|
|
// 零成交时净值是 N 天平线(初始资金不变),也要画出而非空白。
|
|
//
|
|
// 模板总渲染 chart-box(无 v-if): 否则数据异步到达时 v-else 切换 + watch 默认 pre
|
|
// flush 时机下 el.value 尚未绑定 → ensureChart 跳过 → echarts 永不 init → 净值图空白。
|
|
// watch 加 flush:'post' 进一步保证 DOM patch 后再 render。
|
|
const props = defineProps<{ dates: string[]; equity: number[] }>()
|
|
const el = ref<HTMLDivElement>()
|
|
const { setOption } = useChart(el)
|
|
|
|
function render(): void {
|
|
if (!props.dates.length || !props.equity.length) return
|
|
const option: EChartsCoreOption = {
|
|
title: darkTitle('净值曲线'),
|
|
tooltip: darkTooltip(),
|
|
grid: darkGrid(),
|
|
xAxis: { type: 'category', data: props.dates, ...darkAxis() },
|
|
yAxis: { type: 'value', scale: true, name: '净值(元)', ...darkAxis() },
|
|
series: [
|
|
{
|
|
type: 'line',
|
|
name: '净值',
|
|
smooth: true,
|
|
showSymbol: false,
|
|
lineStyle: { color: '#00e5ff', width: 1.6 },
|
|
areaStyle: { color: '#00e5ff', opacity: 0.12 },
|
|
data: props.equity,
|
|
},
|
|
],
|
|
}
|
|
setOption(option)
|
|
}
|
|
|
|
onMounted(render)
|
|
watch(() => [props.dates, props.equity], render, { deep: true, flush: 'post' })
|
|
</script>
|
|
|
|
<template>
|
|
<div ref="el" class="chart-box" />
|
|
</template>
|
|
|
|
<style scoped>
|
|
.chart-box { width: 100%; height: 320px; }
|
|
</style>
|