feat: backfill missing PnL for submitted alphas

This commit is contained in:
yuxuanhui
2026-09-09 20:10:20 +08:00
parent 3d85b073a4
commit 6b4990f100
9 changed files with 179 additions and 12 deletions
+1
View File
@@ -89,6 +89,7 @@ export const jobLabels: Record<string, string> = {
self_correlation: "本地自相关检测",
alpha_refresh: "导入 / 刷新 Alpha",
pnl_refresh: "获取 PnL",
pnl_backfill: "检查已提交 Alpha 的 PnL",
connect: "连接 WorldQuant",
verify: "继续人工验证",
profile: "刷新个人资料",
+7
View File
@@ -93,6 +93,13 @@ export function JobPanel({
{job.checkpoint.dates_completed} / {job.checkpoint.dates_total} 天
</p>
)}
{job.kind === "pnl_backfill" && (
<p className="muted">
{job.total === 0
? "已提交 Alpha 的 PnL 已齐全,无需补取"
: `仅补取缺失的 PnL${job.checkpoint?.alpha_id ? ` · ${job.checkpoint.alpha_id}` : ""}`}
</p>
)}
{job.kind === "self_correlation" && job.checkpoint?.alpha_id && (
<p className="muted">
{job.checkpoint.alpha_id} ·{" "}
+15 -1
View File
@@ -33,6 +33,7 @@ import type {
Alpha,
AlphaPage as Page,
Facets,
Job,
Submission,
} from "../types";
import { AlphaDetail } from "../components/AlphaDetail";
@@ -313,13 +314,15 @@ export function AlphaPage({
async function newTask(kind: string, ids: string[] = []) {
setBusy(kind);
try {
await post("/sync-jobs", {
const job = await post<Job>("/sync-jobs", {
kind,
alpha_ids: ids,
...(kind === "full_sync" ? { submission: "SUBMITTED" } : {}),
});
setImporting(false);
setIdText("");
if (kind === "pnl_backfill" && job.total === 0)
Toast.success("已提交 Alpha 的 PnL 已齐全,无需补取");
onTask();
} catch (e) {
Toast.error((e as Error).message);
@@ -966,6 +969,17 @@ export function AlphaPage({
>
按天同步
</Button>
{submission === "SUBMITTED" && (
<Button
size="small"
loading={busy === "pnl_backfill"}
disabled={!connected || Boolean(busy)}
title="补取全部本地已提交 Alpha 缺失的 PnL,不受筛选和分页影响"
onClick={() => void newTask("pnl_backfill")}
>
检查pnl
</Button>
)}
{submission === "SUBMITTED" && (
<Button
size="small"