feat: add local correlation filters and full recheck action
Deploy production / deploy (push) Successful in 54s

This commit is contained in:
yuxuanhui
2026-09-13 00:03:17 +08:00
parent bbf0e37130
commit 2080f812b4
13 changed files with 309 additions and 15 deletions
+9 -3
View File
@@ -69,6 +69,9 @@ class PreferencesInput(Contract):
class AlphaFilters(Contract):
local_correlation_status: Literal["not_cached", "stale", "low", "high", "partial", "insufficient_data"] | None = None
local_correlation_min: float | None = Field(default=None, ge=-1, le=1)
local_correlation_max: float | None = Field(default=None, ge=-1, le=1)
submission_blocked: bool | None = None
submission: Submission | None = None
source: str | None = Field(default=None, max_length=100)
@@ -125,7 +128,7 @@ class AlphaFilters(Contract):
@model_validator(mode="after")
def range_order(self):
for key in (
"sharpe", "fitness", "returns", "turnover", "margin", "drawdown",
"local_correlation", "sharpe", "fitness", "returns", "turnover", "margin", "drawdown",
"sub_universe_sharpe", "robust_universe_sharpe", "two_year_sharpe", "prod_correlation", "pnl",
):
lo, hi = getattr(self, f"{key}_min"), getattr(self, f"{key}_max")
@@ -188,7 +191,7 @@ class BulkUpdate(BulkInput):
class JobInput(Contract):
kind: Literal["full_sync", "daily_sync", "alpha_refresh", "pnl_refresh", "pnl_backfill", "self_correlation"]
kind: Literal["full_sync", "daily_sync", "alpha_refresh", "pnl_refresh", "pnl_backfill", "self_correlation", "self_correlation_recheck"]
alpha_ids: list[str] = Field(default_factory=list)
submission: Submission | None = None
date_from: date | None = None
@@ -196,7 +199,10 @@ class JobInput(Contract):
@model_validator(mode="after")
def validate_ids(self):
if self.kind == "pnl_backfill":
if self.kind == "self_correlation_recheck":
if self.alpha_ids or self.submission is not None or self.date_from is not None or self.date_to is not None:
raise ValueError("重检自相关覆盖全部预检通过和检查通过的 Alpha,不接受 ID、分组或日期范围")
elif self.kind == "pnl_backfill":
if self.alpha_ids or self.submission is not None or self.date_from is not None or self.date_to is not None:
raise ValueError("检查 PnL 自动覆盖全部本地已提交 Alpha,不接受 ID、分组或日期范围")
elif self.kind in ("full_sync", "daily_sync"):