fix: correct WorldQuant daily alpha date filters
Deploy production / deploy (push) Successful in 52s

This commit is contained in:
yuxuanhui
2026-09-09 15:12:45 +08:00
parent 4debca7dbd
commit ff840ca140
3 changed files with 30 additions and 10 deletions
+6 -2
View File
@@ -350,9 +350,13 @@ class WqClient:
# Daily intervals are [UTC midnight, next midnight). Submitted dates
# use the actual submission time, independently of creation or stage.
field = "dateCreated" if submission == "UNSUBMITTED" else "dateSubmitted"
params.update({f"{field}>=": date_from, f"{field}<": date_to, "order": field})
# BRAIN treats the query separator '=' as part of its comparison
# syntax: a '>=' key adds an extra '=' and makes the date invalid.
# Both bounds are inclusive upstream; exclude the next UTC midnight.
upper = (datetime.fromisoformat(date_to) - timedelta(microseconds=1)).isoformat()
params.update({f"{field}>": date_from, f"{field}<": upper, "order": field})
if field == "dateCreated":
params["dateCreated<"] = min(before, date_to)
params["dateCreated<"] = min(before, upper)
return await self.get("/users/self/alphas", params)
async def alpha(self, alpha_id):