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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user