Try all OTM strikes in offset when nearest fails leverage.

Closest Call@1920 at 152x no longer blocks 1930/1940 that already clear 200x.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-08 14:52:26 +08:00
parent 5ea54db43b
commit 6f983ed2ab
3 changed files with 110 additions and 52 deletions
+8 -1
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
from app.strategy.selection import pick_otm_strike
from app.strategy.selection import list_otm_strikes, pick_otm_strike
from app.strategy.semi_auto import (
REASON_PERP_NET,
REASON_POINTS,
@@ -98,3 +98,10 @@ def test_pick_otm_within_offset() -> None:
# Put 虚值
k2 = pick_otm_strike(strikes, 1830, option_side="put", max_offset=30)
assert k2 == 1825.0
def test_list_otm_strikes_near_to_far() -> None:
# 现价 1917 → Call 虚值 1920/1930/1940(偏离≤25),近→远
strikes = [1910.0, 1920.0, 1930.0, 1940.0, 1950.0]
ks = list_otm_strikes(strikes, 1917.0, option_side="call", max_offset=25)
assert ks == [1920.0, 1930.0, 1940.0]