Gate opens when ATM-spot offset exceeds configurable max (default 3).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-25 12:32:36 +08:00
parent a4bcc3ab0d
commit ee0ec57f89
12 changed files with 93 additions and 13 deletions
+9
View File
@@ -74,3 +74,12 @@ def test_eligible_skips_short_ttm() -> None:
def test_option_leverage() -> None:
assert abs((option_leverage(1850, 18.5) or 0) - 100) < 1e-9
assert option_leverage(1850, 0) is None
def test_atm_allows_open_offset() -> None:
from app.strategy.selection import atm_allows_open, atm_open_offset
assert atm_open_offset(1850, 1852.5) == 2.5
assert atm_allows_open(1850, 1852.5, max_offset=3) is True
assert atm_allows_open(1850, 1854, max_offset=3) is False
assert atm_allows_open(1850, 1860, max_offset=3) is False