feat: add durable WorldQuant backtests with UI and AI confirmation

This commit is contained in:
yuxuanhui
2026-09-08 10:06:00 +08:00
parent 404a4d8a04
commit a4b93200c5
34 changed files with 4437 additions and 23 deletions
+6 -1
View File
@@ -16,8 +16,11 @@ from .schemas import AlphaDetail, AlphaPage, BulkUpdate, JobInput, JobOutput, Re
class Business:
def __init__(self, db):
def __init__(self, db, ai_context=None):
from .backtests.service import Backtests
self.db = db
self.backtests = Backtests(db, ai_context)
async def search_alphas(self, filters):
query = list_statement(filters)
@@ -196,6 +199,8 @@ class Business:
async def notify_job(runner, name, result):
"""Notify the in-process runner only after the transaction has committed."""
if name in ("start_backtest", "control_backtest"):
runner.backtests.wake.set()
if name == "cancel_job":
await runner.cancel(result["job_id"])
if name in ("create_sync_job", "retry_job"):