Skip used/residual expiries so ATM monitors the next day.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -59,6 +59,20 @@ def used_expiry_ymds_for_day(db: Any, now: datetime | None = None) -> set[str]:
|
||||
return out
|
||||
|
||||
|
||||
def pending_residual_expiry_ymds(db: Any) -> set[str]:
|
||||
"""待到期结算的残留期权到期日(YYMMDD);监控/下一组开仓应跳过这些档。"""
|
||||
rows = db.fetchall(
|
||||
"""SELECT DISTINCT expiry_ymd FROM residual_options
|
||||
WHERE status='pending' AND expiry_ymd IS NOT NULL AND TRIM(expiry_ymd) != ''"""
|
||||
)
|
||||
out: set[str] = set()
|
||||
for r in rows or []:
|
||||
y = str(r["expiry_ymd"] or "").strip()
|
||||
if y:
|
||||
out.add(y)
|
||||
return out
|
||||
|
||||
|
||||
def expiry_blocked_by_one_per_day(
|
||||
expiry_ymd: str | None,
|
||||
used: set[str],
|
||||
|
||||
Reference in New Issue
Block a user