Add weekend open skip, expiry force-close, and Chinese trade labels.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
|
||||
EXIT_MODE_FIXED = "fixed_usdt"
|
||||
@@ -28,6 +29,20 @@ def resolve_exit_target(
|
||||
return float(net_profit_target), EXIT_MODE_FIXED
|
||||
|
||||
|
||||
def check_expiry_close(
|
||||
*,
|
||||
expiry_ms: int | None,
|
||||
now_ms: int | None = None,
|
||||
) -> ExitDecision:
|
||||
"""期权到期时刻(含)→ 强制全平。"""
|
||||
if expiry_ms is None:
|
||||
return ExitDecision(False, "", 0.0)
|
||||
now = int(time.time() * 1000) if now_ms is None else int(now_ms)
|
||||
if now >= int(expiry_ms):
|
||||
return ExitDecision(True, "expiry", 0.0)
|
||||
return ExitDecision(False, "", 0.0)
|
||||
|
||||
|
||||
def check_exits(
|
||||
*,
|
||||
net_pnl: float,
|
||||
|
||||
Reference in New Issue
Block a user