212ad6426d
- Task 加 raw_result 字段;orchestrator get_raw_result(内存存 FactorReport)
- 路由 /factor/list、/task/{id}/ic-summary、/task/{id}/report/{factor}(query token 给 iframe)
- analyzer cfg=None 时加载 data_platform.yaml(修 API 路径 read_db_daily 崩)
- get_status 返回 error_msg(调试+前端 failed 展示)
- 前端 投研-新建(多因子/多标的/日期)+ 结果页(IC 表 + tears iframe)
- factor 冒烟通过:ma5 → IC 1D/5D/10D 真实数据
90 lines
2.6 KiB
Vue
90 lines
2.6 KiB
Vue
<script setup lang="ts">
|
|
import { ref, computed, onMounted } from 'vue'
|
|
import { useRoute } from 'vue-router'
|
|
import { ElMessage } from 'element-plus'
|
|
import { getIcSummary, reportUrl } from '@/api/factor'
|
|
|
|
interface IcStats {
|
|
mean?: number
|
|
std?: number
|
|
icir?: number
|
|
t_stat?: number
|
|
count?: number
|
|
error?: string
|
|
}
|
|
interface FactorInfo {
|
|
status?: string
|
|
ic?: Record<string, IcStats>
|
|
error?: string
|
|
}
|
|
|
|
const route = useRoute()
|
|
const taskId = String(route.params.id)
|
|
const loading = ref(true)
|
|
const icSummary = ref<Record<string, FactorInfo>>({})
|
|
|
|
const rows = computed(() => {
|
|
const out: Array<Record<string, unknown>> = []
|
|
for (const [factor, info] of Object.entries(icSummary.value)) {
|
|
const ic = info?.ic || {}
|
|
for (const [period, s] of Object.entries(ic)) {
|
|
out.push({ factor, period, ...s })
|
|
}
|
|
}
|
|
return out
|
|
})
|
|
|
|
const factors = computed(() => Object.keys(icSummary.value))
|
|
|
|
function fmt(v: unknown): string {
|
|
if (typeof v === 'number') return (Math.round(v * 10000) / 10000).toString()
|
|
return v == null ? '' : String(v)
|
|
}
|
|
|
|
onMounted(async () => {
|
|
try {
|
|
icSummary.value = (await getIcSummary(taskId)) as Record<string, FactorInfo>
|
|
} catch {
|
|
ElMessage.error('IC 摘要加载失败')
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div v-loading="loading">
|
|
<el-card>
|
|
<template #header>
|
|
<h3>IC 统计</h3>
|
|
</template>
|
|
<el-table :data="rows" stripe size="small" empty-text="无 IC 数据">
|
|
<el-table-column prop="factor" label="因子" width="120" />
|
|
<el-table-column prop="period" label="周期" width="80" />
|
|
<el-table-column label="IC 均值">
|
|
<template #default="{ row }">{{ fmt(row.mean) }}</template>
|
|
</el-table-column>
|
|
<el-table-column label="IC 标准差">
|
|
<template #default="{ row }">{{ fmt(row.std) }}</template>
|
|
</el-table-column>
|
|
<el-table-column label="ICIR">
|
|
<template #default="{ row }">{{ fmt(row.icir) }}</template>
|
|
</el-table-column>
|
|
<el-table-column label="t 统计">
|
|
<template #default="{ row }">{{ fmt(row.t_stat) }}</template>
|
|
</el-table-column>
|
|
<el-table-column label="样本数">
|
|
<template #default="{ row }">{{ row.count }}</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
|
|
<el-card v-for="f in factors" :key="f" style="margin-top: 16px">
|
|
<template #header>
|
|
<h3>tears 报告 — {{ f }}</h3>
|
|
</template>
|
|
<iframe :src="reportUrl(taskId, f)" style="width: 100%; height: 600px; border: 0" />
|
|
</el-card>
|
|
</div>
|
|
</template>
|