feat: add scoped alpha sync and local self-correlation

This commit is contained in:
yuxuanhui
2026-09-08 10:40:49 +08:00
parent 404a4d8a04
commit d2ccd94721
28 changed files with 1656 additions and 69 deletions
+20 -2
View File
@@ -45,7 +45,7 @@ def sample(index):
"selection": {"code": "self_correlation < 0.5"} if super_alpha else None,
"combo": {"code": "alpha"} if super_alpha else None,
"settings": {
"region": ["USA", "CHN", "EUR"][index % 3],
"region": ["USA", "CHN", "EUR"][(index // 3) % 3],
"universe": "TOP3000",
"language": language,
"delay": 1,
@@ -64,7 +64,10 @@ def sample(index):
"checks": [{"name": "LOW_SHARPE", "result": "PASS", "value": 2.1, "limit": 1.58}],
},
"os": {"sharpe": 1.1} if index % 3 == 0 else None,
"dateCreated": (datetime(2025, 1, 1, tzinfo=timezone.utc) + timedelta(days=index)).isoformat(),
"dateCreated": (datetime(2025, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=index)).isoformat(),
"dateSubmitted": (datetime(2025, 2, 1, tzinfo=timezone.utc) + timedelta(days=index % 2)).isoformat()
if index % 3 == 0
else None,
}
@@ -141,6 +144,21 @@ def create_test_app():
matched = [
r for r in records if (r["status"] == "UNSUBMITTED") == unsubmitted and r["hidden"] == hidden
]
for field in ("dateCreated", "dateSubmitted"):
for suffix in (">=", "<"):
boundary = request.url.params.get(field + suffix)
if boundary:
bound = datetime.fromisoformat(boundary).replace(tzinfo=timezone.utc)
matched = [
r
for r in matched
if r.get(field)
and (
datetime.fromisoformat(r[field]) >= bound
if suffix == ">="
else datetime.fromisoformat(r[field]) < bound
)
]
offset, limit = (
int(request.url.params.get("offset", 0)),
int(request.url.params.get("limit", 100)),