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
+11 -2
View File
@@ -193,7 +193,7 @@ class Business:
async def create_sync_job(self, body: JobInput):
account = await self.db.scalar(select(Account).where(Account.id == 1).with_for_update())
if body.kind != "self_correlation" and (
if body.kind not in ("self_correlation", "self_correlation_recheck") and (
not account.password_encrypted or account.connection_status in ("disconnected", "error")
):
raise HTTPException(409, "请先连接 WorldQuant")
@@ -205,9 +205,18 @@ class Business:
for job in (
await self.db.scalars(select(Job).where(Job.kind == body.kind, Job.status.in_(ACTIVE)))
).all():
if body.kind == "pnl_backfill" or job.payload == payload:
if body.kind in ("pnl_backfill", "self_correlation_recheck") or job.payload == payload:
return JobOutput.model_validate(job).model_dump(mode="json")
job = Job(id=str(uuid4()), kind=body.kind, payload=payload)
if body.kind == "self_correlation_recheck":
# Freeze every qualifying target at click time, without the manual-ID batch limit.
ids = list((await self.db.scalars(
select(Alpha.id).where(Alpha.check_type.in_(("PRE_CHECK", "PASS"))).order_by(Alpha.id)
)).all())
job.payload = {"alpha_ids": ids}
job.total = len(ids)
if not ids:
job.status = "completed"
if body.kind == "pnl_backfill":
# Fix the full missing set on the server, independently of UI paging.
# The account lock above also serializes duplicate button clicks.