merge: integrate alpha management with main and sequence migration 0005
This commit is contained in:
+128
-31
@@ -13,8 +13,10 @@ import zhCN from "@douyinfe/semi-ui-19/lib/es/locale/source/zh_CN";
|
||||
import { api, post } from "./api";
|
||||
import type { Account, Job } from "./types";
|
||||
import { AccountPage } from "./pages/AccountPage";
|
||||
import { DatasetPage } from "./pages/DatasetPage";
|
||||
import { AlphaPage } from "./pages/AlphaPage";
|
||||
import { JobPanel } from "./components/JobPanel";
|
||||
import { BacktestPage } from "./backtests/BacktestPage";
|
||||
import { ChatPanel } from "./ai/ChatPanel";
|
||||
import type { PageContext, UIAction } from "./ai/types";
|
||||
|
||||
@@ -23,8 +25,21 @@ export default function App() {
|
||||
const [account, setAccount] = useState<Account | null>(null);
|
||||
const [jobs, setJobs] = useState<Job[]>([]);
|
||||
const [page, setPage] = useState(
|
||||
location.hash === "#account" ? "account" : "alphas",
|
||||
location.hash === "#backtests"
|
||||
? "backtests"
|
||||
: location.hash === "#datasets"
|
||||
? "datasets"
|
||||
: location.hash === "#account"
|
||||
? "account"
|
||||
: "alphas",
|
||||
);
|
||||
const [visitedBacktests, setVisitedBacktests] = useState(
|
||||
page === "backtests",
|
||||
);
|
||||
useEffect(() => {
|
||||
if (page === "backtests") setVisitedBacktests(true);
|
||||
}, [page]);
|
||||
const [catalogModal, setCatalogModal] = useState(false);
|
||||
const [showJobs, setShowJobs] = useState(false);
|
||||
const [refreshKey, setRefreshKey] = useState(0);
|
||||
const [pollError, setPollError] = useState("");
|
||||
@@ -34,6 +49,9 @@ export default function App() {
|
||||
const [alphaContext, setAlphaContext] = useState<PageContext>({
|
||||
page: "alphas",
|
||||
});
|
||||
const [backtestContext, setBacktestContext] = useState<PageContext>({
|
||||
page: "backtests",
|
||||
});
|
||||
const [aiAction, setAIAction] = useState<UIAction | null>(null);
|
||||
const chatOffset = viewport >= 1440 && chatOpen ? chatWidth : 0;
|
||||
const focusBusiness = useCallback(() => {
|
||||
@@ -84,7 +102,15 @@ export default function App() {
|
||||
};
|
||||
window.addEventListener("session-expired", expired);
|
||||
const hash = () =>
|
||||
setPage(location.hash === "#account" ? "account" : "alphas");
|
||||
setPage(
|
||||
location.hash === "#backtests"
|
||||
? "backtests"
|
||||
: location.hash === "#datasets"
|
||||
? "datasets"
|
||||
: location.hash === "#account"
|
||||
? "account"
|
||||
: "alphas",
|
||||
);
|
||||
window.addEventListener("hashchange", hash);
|
||||
return () => {
|
||||
window.removeEventListener("session-expired", expired);
|
||||
@@ -154,7 +180,11 @@ export default function App() {
|
||||
/>
|
||||
) : (
|
||||
<div className="workspace">
|
||||
<aside className="sidebar" inert={chatOpen && viewport < 1440}>
|
||||
<aside
|
||||
className="sidebar"
|
||||
inert={(chatOpen && viewport < 1440) || catalogModal}
|
||||
aria-hidden={catalogModal || undefined}
|
||||
>
|
||||
<div className="brand">
|
||||
<span className="brand-mark">α</span>
|
||||
<div>Alpha 研究</div>
|
||||
@@ -167,6 +197,14 @@ export default function App() {
|
||||
>
|
||||
Alpha 管理
|
||||
</button>
|
||||
<button
|
||||
aria-label="数据集"
|
||||
className={`nav-item ${page === "datasets" ? "active" : ""}`}
|
||||
aria-current={page === "datasets" ? "page" : undefined}
|
||||
onClick={() => changePage("datasets")}
|
||||
>
|
||||
数据集
|
||||
</button>
|
||||
<button
|
||||
aria-label="个人信息"
|
||||
className={`nav-item ${page === "account" ? "active" : ""}`}
|
||||
@@ -175,6 +213,14 @@ export default function App() {
|
||||
>
|
||||
个人信息
|
||||
</button>
|
||||
<button
|
||||
aria-label="回测研究"
|
||||
className={`nav-item ${page === "backtests" ? "active" : ""}`}
|
||||
aria-current={page === "backtests" ? "page" : undefined}
|
||||
onClick={() => changePage("backtests")}
|
||||
>
|
||||
回测研究
|
||||
</button>
|
||||
<div className="sidebar-bottom">
|
||||
<div className="connection-line">
|
||||
<i
|
||||
@@ -190,7 +236,11 @@ export default function App() {
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
<div className="main-shell" inert={chatOpen && viewport < 1440}>
|
||||
<div
|
||||
className="main-shell"
|
||||
inert={(chatOpen && viewport < 1440) || catalogModal}
|
||||
aria-hidden={catalogModal || undefined}
|
||||
>
|
||||
<header className="topbar">
|
||||
<div className="breadcrumbs">研究工作空间</div>
|
||||
<div className="top-actions">
|
||||
@@ -234,7 +284,7 @@ export default function App() {
|
||||
</div>
|
||||
</header>
|
||||
<main
|
||||
className={`page-content ${page === "alphas" ? "bounded-page" : "account-page"}`}
|
||||
className={`page-content ${page !== "account" ? "bounded-page" : "account-page"}`}
|
||||
>
|
||||
{pollError && (
|
||||
<Banner
|
||||
@@ -249,6 +299,18 @@ export default function App() {
|
||||
onTask={taskCreated}
|
||||
/>
|
||||
</div>
|
||||
<div className="alpha-page-view" hidden={page !== "datasets"}>
|
||||
<DatasetPage
|
||||
account={account}
|
||||
jobs={jobs}
|
||||
active={page === "datasets"}
|
||||
version={`${refreshKey}:${completedVersion}`}
|
||||
suspended={showJobs || chatOpen}
|
||||
onTask={taskCreated}
|
||||
onModal={setCatalogModal}
|
||||
onChat={() => setChatOpen(true)}
|
||||
/>
|
||||
</div>
|
||||
<div className="alpha-page-view" hidden={page !== "alphas"}>
|
||||
<AlphaPage
|
||||
taskPanelOpen={showJobs}
|
||||
@@ -262,10 +324,32 @@ export default function App() {
|
||||
}
|
||||
chatOffset={chatOffset}
|
||||
onContext={setAlphaContext}
|
||||
action={aiAction}
|
||||
action={
|
||||
aiAction?.type === "open_alpha" ||
|
||||
aiAction?.type === "apply_filters"
|
||||
? aiAction
|
||||
: null
|
||||
}
|
||||
onOverlay={focusBusiness}
|
||||
/>
|
||||
</div>
|
||||
<div className="backtest-page-view" hidden={page !== "backtests"}>
|
||||
{visitedBacktests && (
|
||||
<BacktestPage
|
||||
active={page === "backtests"}
|
||||
suspended={showJobs || (viewport < 1440 && chatOpen)}
|
||||
chatOffset={chatOffset}
|
||||
timezone={account?.timezone}
|
||||
action={aiAction}
|
||||
onContext={setBacktestContext}
|
||||
onAction={(action) => {
|
||||
focusBusiness();
|
||||
changePage("alphas");
|
||||
setAIAction(action);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<JobPanel
|
||||
@@ -280,7 +364,7 @@ export default function App() {
|
||||
changePage("account");
|
||||
}}
|
||||
/>
|
||||
{!chatOpen && (
|
||||
{!chatOpen && !catalogModal && (
|
||||
<Button
|
||||
className="ai-launcher"
|
||||
aria-label="打开研究助手"
|
||||
@@ -298,30 +382,43 @@ export default function App() {
|
||||
onClick={() => setChatOpen(false)}
|
||||
/>
|
||||
)}
|
||||
<ChatPanel
|
||||
jobs={jobs}
|
||||
open={chatOpen}
|
||||
width={chatWidth}
|
||||
onWidth={setChatWidth}
|
||||
onClose={() => setChatOpen(false)}
|
||||
context={page === "alphas" ? alphaContext : { page: "account" }}
|
||||
timezone={account?.timezone}
|
||||
onSettings={() => {
|
||||
focusBusiness();
|
||||
changePage("account");
|
||||
requestAnimationFrame(() =>
|
||||
document
|
||||
.getElementById("model-settings")
|
||||
?.scrollIntoView({ block: "start" }),
|
||||
);
|
||||
}}
|
||||
onChanged={actionDone}
|
||||
onAction={(action) => {
|
||||
focusBusiness();
|
||||
changePage("alphas");
|
||||
setAIAction(action);
|
||||
}}
|
||||
/>
|
||||
<div inert={catalogModal && !chatOpen}>
|
||||
<ChatPanel
|
||||
jobs={jobs}
|
||||
open={chatOpen}
|
||||
width={chatWidth}
|
||||
onWidth={setChatWidth}
|
||||
onClose={() => setChatOpen(false)}
|
||||
context={
|
||||
page === "alphas"
|
||||
? alphaContext
|
||||
: page === "backtests"
|
||||
? backtestContext
|
||||
: { page: page === "datasets" ? "datasets" : "account" }
|
||||
}
|
||||
timezone={account?.timezone}
|
||||
onSettings={() => {
|
||||
focusBusiness();
|
||||
changePage("account");
|
||||
requestAnimationFrame(() =>
|
||||
document
|
||||
.getElementById("model-settings")
|
||||
?.scrollIntoView({ block: "start" }),
|
||||
);
|
||||
}}
|
||||
onChanged={actionDone}
|
||||
onAction={(action) => {
|
||||
focusBusiness();
|
||||
changePage(
|
||||
action.type === "open_backtest" ||
|
||||
action.type === "open_backtest_preview"
|
||||
? "backtests"
|
||||
: "alphas",
|
||||
);
|
||||
setAIAction(action);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</LocaleProvider>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
post,
|
||||
stateLabels,
|
||||
} from "../api";
|
||||
import { BacktestToolCard } from "../backtests/BacktestToolCard";
|
||||
import { PnlChart } from "../components/PnlChart";
|
||||
import type { Alpha, Job, Pnl, Research } from "../types";
|
||||
import { chatTransport } from "./transport";
|
||||
@@ -85,6 +86,8 @@ export function ChatPanel({
|
||||
"create_sync_job",
|
||||
"cancel_job",
|
||||
"retry_job",
|
||||
"start_backtest",
|
||||
"control_backtest",
|
||||
].includes(call.name) &&
|
||||
!seenWrites.current.has(call.id)
|
||||
) {
|
||||
@@ -434,9 +437,13 @@ export function ChatPanel({
|
||||
</div>
|
||||
<footer className="ai-composer" ref={input}>
|
||||
<div className="ai-context">
|
||||
{context.page === "account"
|
||||
? "上下文:个人信息页"
|
||||
: `上下文:${context.alpha_id ? `Alpha ${context.alpha_id}` : "Alpha 列表"}${context.selected_ids?.length ? ` · 已选 ${context.selected_ids.length} 条` : ""}`}
|
||||
{context.page === "backtests"
|
||||
? "上下文:回测研究"
|
||||
: context.page === "datasets"
|
||||
? "上下文:数据目录(未发送字段与备注)"
|
||||
: context.page === "account"
|
||||
? "上下文:个人信息页"
|
||||
: `上下文:${context.alpha_id ? `Alpha ${context.alpha_id}` : "Alpha 列表"}${context.selected_ids?.length ? ` · 已选 ${context.selected_ids.length} 条` : ""}`}
|
||||
</div>
|
||||
<TextArea
|
||||
aria-label="发送给研究助手"
|
||||
@@ -537,6 +544,9 @@ function BusinessCard({
|
||||
{labels[call.status] ?? call.status}
|
||||
</Tag>
|
||||
</div>
|
||||
{call.name.includes("backtest") && (
|
||||
<BacktestToolCard call={call} onAction={onAction} />
|
||||
)}
|
||||
{call.preview.targets?.map((target) => (
|
||||
<details
|
||||
key={target.alpha_id}
|
||||
|
||||
@@ -11,12 +11,20 @@ export type ModelSettings = {
|
||||
test_results: Record<string, { ok: boolean; message: string }>;
|
||||
};
|
||||
export type PageContext = {
|
||||
page: "alphas" | "account";
|
||||
page: "alphas" | "account" | "datasets" | "backtests";
|
||||
backtest_run_id?: string;
|
||||
backtest_preview_id?: string;
|
||||
backtest_draft_id?: string;
|
||||
alpha_id?: string | null;
|
||||
selected_ids?: string[];
|
||||
filters?: Record<string, unknown>;
|
||||
};
|
||||
export type AlphaUIAction =
|
||||
| { type: "open_alpha"; alpha_id: string; nonce: number }
|
||||
| { type: "apply_filters"; filters: Record<string, unknown>; nonce: number };
|
||||
export type UIAction =
|
||||
| { type: "open_backtest"; run_id: string; nonce: number }
|
||||
| { type: "open_backtest_preview"; preview_id: string; nonce: number }
|
||||
| { type: "open_alpha"; alpha_id: string; nonce: number }
|
||||
| { type: "apply_filters"; filters: Record<string, unknown>; nonce: number };
|
||||
export type ToolCard = {
|
||||
@@ -27,6 +35,9 @@ export type ToolCard = {
|
||||
targets?: { alpha_id: string; before: Research; after: Research }[];
|
||||
job?: Record<string, unknown>;
|
||||
operation?: Record<string, unknown>;
|
||||
backtest?: Record<string, unknown>;
|
||||
backtest_run?: Record<string, unknown>;
|
||||
action?: string;
|
||||
};
|
||||
result: Record<string, unknown> | null;
|
||||
};
|
||||
@@ -64,6 +75,15 @@ export const runLabels: Record<string, string> = {
|
||||
interrupted: "执行中断",
|
||||
};
|
||||
export const toolLabels: Record<string, string> = {
|
||||
get_backtest_capabilities: "读取回测能力",
|
||||
prepare_backtest: "准备回测预览",
|
||||
get_backtest_preview: "查看回测预览",
|
||||
start_backtest: "启动固定回测",
|
||||
list_backtests: "查询回测运行",
|
||||
get_backtest: "查看回测进度",
|
||||
get_backtest_results: "读取回测结果",
|
||||
control_backtest: "控制回测运行",
|
||||
prepare_backtest_rerun: "准备重跑预览",
|
||||
search_alphas: "查询 Alpha",
|
||||
get_alpha_facets: "查询筛选选项",
|
||||
get_alpha: "读取 Alpha",
|
||||
|
||||
@@ -82,6 +82,8 @@ export const stateOptions = Object.entries(stateLabels).map(
|
||||
([value, label]) => ({ value, label }),
|
||||
);
|
||||
export const jobLabels: Record<string, string> = {
|
||||
catalog_sync: "同步数据集目录",
|
||||
field_sync: "同步数据字段",
|
||||
full_sync: "全量同步 Alpha",
|
||||
daily_sync: "按天同步 Alpha",
|
||||
self_correlation: "本地自相关检测",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Button } from "@douyinfe/semi-ui-19";
|
||||
import type { ToolCard, UIAction } from "../ai/types";
|
||||
import { api } from "../api";
|
||||
import { controlLabels, labels } from "./types";
|
||||
import type { Run } from "./types";
|
||||
|
||||
export function BacktestToolCard({
|
||||
call,
|
||||
onAction,
|
||||
}: {
|
||||
call: ToolCard;
|
||||
onAction: (action: UIAction) => void;
|
||||
}) {
|
||||
const result = call.result || {};
|
||||
const preview =
|
||||
call.preview.backtest ||
|
||||
(typeof result.preview_id === "string" ? result : null);
|
||||
const runId =
|
||||
typeof result.backtest_run_id === "string"
|
||||
? result.backtest_run_id
|
||||
: typeof call.preview.backtest_run?.backtest_run_id === "string"
|
||||
? call.preview.backtest_run.backtest_run_id
|
||||
: null;
|
||||
const [run, setRun] = useState<Run | null>(null);
|
||||
const [error, setError] = useState("");
|
||||
useEffect(() => {
|
||||
if (!runId) return;
|
||||
let alive = true;
|
||||
const load = () =>
|
||||
api<Run>(`/backtests/runs/${runId}`)
|
||||
.then((r) => {
|
||||
if (alive) {
|
||||
setRun(r);
|
||||
setError("");
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
if (alive) setError(e.message);
|
||||
});
|
||||
void load();
|
||||
const timer = window.setInterval(load, 3000);
|
||||
return () => {
|
||||
alive = false;
|
||||
clearInterval(timer);
|
||||
};
|
||||
}, [runId]);
|
||||
return (
|
||||
<div className="backtest-tool-summary">
|
||||
{preview && (
|
||||
<>
|
||||
<p>
|
||||
{String(preview.name)} · {String(preview.total)} 条候选 ·{" "}
|
||||
{String(preview.batch_count)} 个批次
|
||||
</p>
|
||||
<p>重复提示 {String(preview.duplicate_count)} 条,确认后独立执行。</p>
|
||||
<Button
|
||||
onClick={() =>
|
||||
onAction({
|
||||
type: "open_backtest_preview",
|
||||
preview_id: String(preview.preview_id),
|
||||
nonce: Date.now(),
|
||||
})
|
||||
}
|
||||
>
|
||||
查看完整固定输入
|
||||
</Button>
|
||||
<details>
|
||||
<summary>本页候选及最终参数</summary>
|
||||
<pre>{JSON.stringify(preview.items, null, 2)}</pre>
|
||||
</details>
|
||||
</>
|
||||
)}
|
||||
{call.preview.action && (
|
||||
<p>
|
||||
{controlLabels[call.preview.action]} ·{" "}
|
||||
{String(call.preview.backtest_run?.name || "")}
|
||||
</p>
|
||||
)}
|
||||
{run && (
|
||||
<>
|
||||
<p>
|
||||
{run.name} · {labels[run.status]}
|
||||
</p>
|
||||
<p>
|
||||
已保存 {run.counts.persistence.saved || 0}/{run.total} · 平台失败{" "}
|
||||
{run.counts.platform.failed || 0}
|
||||
</p>
|
||||
<Button
|
||||
onClick={() =>
|
||||
onAction({
|
||||
type: "open_backtest",
|
||||
run_id: run.backtest_run_id,
|
||||
nonce: Date.now(),
|
||||
})
|
||||
}
|
||||
>
|
||||
打开回测详情
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{call.name === "get_backtest_capabilities" && (
|
||||
<p>
|
||||
支持 REGULAR /
|
||||
FASTEXPR。并发与批大小为本地配置;启动前展示固定候选供确认。
|
||||
</p>
|
||||
)}
|
||||
{call.name === "list_backtests" && Array.isArray(result.items) && (
|
||||
<>
|
||||
{result.items.map((value: Run) => (
|
||||
<Button
|
||||
key={value.backtest_run_id}
|
||||
onClick={() =>
|
||||
onAction({
|
||||
type: "open_backtest",
|
||||
run_id: value.backtest_run_id,
|
||||
nonce: Date.now(),
|
||||
})
|
||||
}
|
||||
>
|
||||
{value.name} · {labels[value.status]}
|
||||
</Button>
|
||||
))}
|
||||
<p>
|
||||
共 {String(result.total)} 条,本页 {result.items.length} 条
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{call.name === "get_backtest_results" && (
|
||||
<details>
|
||||
<summary>
|
||||
本页结果({Array.isArray(result.items) ? result.items.length : 0}/
|
||||
{String(result.total)})
|
||||
</summary>
|
||||
<pre>{JSON.stringify(result.items, null, 2)}</pre>
|
||||
</details>
|
||||
)}
|
||||
{error && <p className="error-text">进度暂时不可用:{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
.backtest-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
gap: 12px;
|
||||
}
|
||||
.backtest-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.backtest-toolbar .semi-select {
|
||||
min-width: 144px;
|
||||
}
|
||||
.backtest-spacer {
|
||||
flex: 1;
|
||||
}
|
||||
.backtest-sheet {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
.backtest-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px 16px;
|
||||
}
|
||||
.backtest-form-grid .semi-input-number {
|
||||
width: 100%;
|
||||
}
|
||||
.backtest-sheet pre {
|
||||
font-size: 12px;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
margin: 8px 0;
|
||||
}
|
||||
.backtest-sheet .semi-table-row-cell {
|
||||
font-weight: 400;
|
||||
}
|
||||
.backtest-sheet .semi-table-row-cell .semi-button-content {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.backtest-sheet .semi-table-row-cell .semi-button {
|
||||
max-width: 100%;
|
||||
}
|
||||
.backtest-attempt {
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding: 12px 0;
|
||||
}
|
||||
.backtest-attempt code {
|
||||
display: block;
|
||||
color: var(--muted);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.backtest-item-detail {
|
||||
border-top: 1px solid var(--line);
|
||||
padding-top: 12px;
|
||||
}
|
||||
.backtest-item-detail h3 {
|
||||
margin: 0;
|
||||
}
|
||||
.backtest-page-view {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.backtest-tool-summary {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.backtest-form-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.backtest-toolbar {
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
export type SimulationSettings = {
|
||||
instrumentType: "EQUITY";
|
||||
region: string;
|
||||
universe: string;
|
||||
delay: 0 | 1;
|
||||
decay: number;
|
||||
neutralization: string;
|
||||
truncation: number;
|
||||
pasteurization: "ON" | "OFF";
|
||||
unitHandling: "VERIFY";
|
||||
nanHandling: "ON" | "OFF";
|
||||
language: "FASTEXPR";
|
||||
visualization: boolean;
|
||||
maxTrade: "ON" | "OFF";
|
||||
};
|
||||
export const initialSettings: SimulationSettings = {
|
||||
instrumentType: "EQUITY",
|
||||
region: "",
|
||||
universe: "",
|
||||
delay: 1,
|
||||
decay: 0,
|
||||
neutralization: "INDUSTRY",
|
||||
truncation: 0.08,
|
||||
pasteurization: "ON",
|
||||
unitHandling: "VERIFY",
|
||||
nanHandling: "OFF",
|
||||
language: "FASTEXPR",
|
||||
visualization: false,
|
||||
maxTrade: "OFF",
|
||||
};
|
||||
export type Candidate = {
|
||||
client_item_id: string;
|
||||
expression: string;
|
||||
settings: SimulationSettings;
|
||||
alpha_type?: "REGULAR";
|
||||
};
|
||||
export type Source = {
|
||||
kind: string;
|
||||
reference?: string | null;
|
||||
batch_id?: string | null;
|
||||
template_input_id?: string | null;
|
||||
research_id?: string | null;
|
||||
parent_run_id?: string | null;
|
||||
};
|
||||
export type Draft = {
|
||||
id: string;
|
||||
version: number;
|
||||
name: string;
|
||||
source: Source;
|
||||
candidates: Candidate[];
|
||||
updated_at: string;
|
||||
};
|
||||
export type DraftSummary = Pick<
|
||||
Draft,
|
||||
"id" | "version" | "name" | "updated_at"
|
||||
> & { total: number };
|
||||
export type Page<T> = {
|
||||
items: T[];
|
||||
total: number;
|
||||
limit: number;
|
||||
offset: number;
|
||||
};
|
||||
export type Preview = Page<Candidate> & {
|
||||
preview_id: string;
|
||||
version: number;
|
||||
name: string;
|
||||
source: Source;
|
||||
digest: string;
|
||||
batch_count: number;
|
||||
batch_size: number;
|
||||
duplicate_count: number;
|
||||
has_more: boolean;
|
||||
};
|
||||
export type Scheduler = {
|
||||
concurrency: number;
|
||||
batch_size: number;
|
||||
version: number;
|
||||
blocked_reason: string | null;
|
||||
blocked_until: string | null;
|
||||
};
|
||||
export type Run = {
|
||||
backtest_run_id: string;
|
||||
preview_id: string;
|
||||
name: string;
|
||||
source: Source;
|
||||
control: string;
|
||||
status: string;
|
||||
version: number;
|
||||
total: number;
|
||||
counts: {
|
||||
platform: Record<string, number>;
|
||||
collection: Record<string, number>;
|
||||
persistence: Record<string, number>;
|
||||
};
|
||||
cursor: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
scheduler: Scheduler;
|
||||
};
|
||||
export type Item = {
|
||||
id: string;
|
||||
client_item_id: string;
|
||||
expression: string;
|
||||
settings: SimulationSettings;
|
||||
attempt_id: string;
|
||||
platform_status: string;
|
||||
collection_status: string;
|
||||
persistence_status: string;
|
||||
simulation_id: string | null;
|
||||
alpha_id: string | null;
|
||||
error: string | null;
|
||||
result: {
|
||||
snapshot: {
|
||||
is?: Record<string, unknown>;
|
||||
os?: Record<string, unknown>;
|
||||
checks?: unknown[];
|
||||
[key: string]: unknown;
|
||||
};
|
||||
observed_at: string;
|
||||
complete: boolean;
|
||||
} | null;
|
||||
};
|
||||
export type Attempt = {
|
||||
id: string;
|
||||
state: string;
|
||||
progress_url: string | null;
|
||||
children: string[];
|
||||
error: string | null;
|
||||
error_code: string | null;
|
||||
submit_count: number;
|
||||
poll_count: number;
|
||||
next_poll_at: string | null;
|
||||
};
|
||||
export const labels: Record<string, string> = {
|
||||
queued: "排队中",
|
||||
running: "执行中",
|
||||
paused: "已暂停推送",
|
||||
stopping: "停止中 · 收集已提交结果",
|
||||
stopped: "已停止",
|
||||
completed: "已完成",
|
||||
completed_with_errors: "部分失败",
|
||||
needs_review: "待核对",
|
||||
collection_failed: "结果补取失败",
|
||||
pending: "待处理",
|
||||
submitting: "正在提交",
|
||||
submitted: "平台执行中",
|
||||
collecting: "收集结果",
|
||||
failed: "失败",
|
||||
unknown: "待核对",
|
||||
skipped: "已跳过",
|
||||
saved: "已保存",
|
||||
complete: "完整",
|
||||
not_required: "无需处理",
|
||||
};
|
||||
export const controlLabels: Record<string, string> = {
|
||||
pause: "暂停推送",
|
||||
resume: "继续推送",
|
||||
stop: "停止剩余项",
|
||||
recover: "找回原结果",
|
||||
};
|
||||
@@ -71,6 +71,13 @@ export function JobPanel({
|
||||
{jobStateLabels[job.status] ?? job.status}
|
||||
</Tag>
|
||||
</div>
|
||||
{job.payload?.scope && (
|
||||
<p>
|
||||
{job.payload.dataset_id || "数据集目录"} ·{" "}
|
||||
{job.payload.scope.region} · {job.payload.scope.universe} · Delay{" "}
|
||||
{job.payload.scope.delay}
|
||||
</p>
|
||||
)}
|
||||
<p className="muted">{formatTime(job.created_at, timezone)}</p>
|
||||
{job.payload?.submission && (
|
||||
<p className="muted">
|
||||
|
||||
@@ -37,7 +37,7 @@ import type {
|
||||
} from "../types";
|
||||
import { AlphaDetail } from "../components/AlphaDetail";
|
||||
import { AlphaSyncDialog } from "../components/AlphaSyncDialog";
|
||||
import type { PageContext, UIAction } from "../ai/types";
|
||||
import type { PageContext, AlphaUIAction as UIAction } from "../ai/types";
|
||||
|
||||
const metricLabels = {
|
||||
sharpe: "Sharpe",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,144 @@
|
||||
.catalog-page,
|
||||
.catalog-layer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.catalog-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.catalog-page > .catalog-tools {
|
||||
padding: 0 0 12px;
|
||||
}
|
||||
.catalog-tools > .semi-input-wrapper {
|
||||
width: 240px;
|
||||
min-width: 120px;
|
||||
}
|
||||
.catalog-tools > .semi-select {
|
||||
min-width: 112px;
|
||||
max-width: 220px;
|
||||
}
|
||||
.catalog-tools > span {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.catalog-sheet .semi-sidesheet-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
.catalog-sheet .semi-sidesheet-body {
|
||||
min-height: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.catalog-sheet .semi-sidesheet-inner {
|
||||
box-shadow: none;
|
||||
border-left: 1px solid var(--line);
|
||||
}
|
||||
.catalog-sheet .semi-sidesheet-mask {
|
||||
background: #1f232926;
|
||||
}
|
||||
.catalog-layer > .catalog-tools {
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.catalog-table .semi-table-row-cell,
|
||||
.catalog-table .semi-button {
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
font-weight: 400;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.catalog-table .semi-table-row-cell {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.catalog-name {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.catalog-name .semi-button-content {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.catalog-details-body {
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
min-height: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.catalog-details-body > p,
|
||||
.catalog-details-body > h2 {
|
||||
margin-bottom: 12px;
|
||||
font-weight: 400;
|
||||
}
|
||||
.catalog-details-body dl {
|
||||
margin: 16px 0;
|
||||
}
|
||||
.catalog-details-body dl > div {
|
||||
display: grid;
|
||||
grid-template-columns: 80px minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.catalog-details-body dt {
|
||||
color: var(--muted);
|
||||
}
|
||||
.catalog-details-body dd {
|
||||
margin: 0;
|
||||
}
|
||||
.catalog-draft {
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding: 12px 0;
|
||||
}
|
||||
.catalog-draft details {
|
||||
margin: 8px 0;
|
||||
}
|
||||
.catalog-draft summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.catalog-tools {
|
||||
padding: 8px;
|
||||
}
|
||||
.catalog-tools > .semi-input-wrapper {
|
||||
flex: 1;
|
||||
}
|
||||
.catalog-layer .catalog-tools {
|
||||
max-height: 32%;
|
||||
overflow: auto;
|
||||
}
|
||||
.catalog-page > .catalog-tools {
|
||||
max-height: 28%;
|
||||
overflow: auto;
|
||||
}
|
||||
.catalog-page .library-panel > .catalog-tools {
|
||||
max-height: 32%;
|
||||
overflow: auto;
|
||||
}
|
||||
.catalog-layer .table-pagination {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.catalog-layer .table-pagination > span {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.catalog-sr-label {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -115,6 +115,13 @@ export type Job = {
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
payload: {
|
||||
scope?: {
|
||||
instrument_type: string;
|
||||
region: string;
|
||||
universe: string;
|
||||
delay: number;
|
||||
};
|
||||
dataset_id?: string;
|
||||
submission?: Submission;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
|
||||
Reference in New Issue
Block a user