Extend semi-auto with ITM/ATM/OTM, offset, and 1:4 sizing.

Moneyness and perp:option units are plan-only; OTM enforces leverage >=180.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-08 11:42:57 +08:00
parent 4585dba3c3
commit 457838ef64
17 changed files with 428 additions and 41 deletions
+8
View File
@@ -369,6 +369,10 @@ class StrategyEngine:
out["semi_perp_exit_unit"] = sp.get("perp_exit_unit")
out["semi_min_option_hours"] = sp.get("min_option_hours")
out["semi_min_option_leverage"] = sp.get("min_option_leverage")
out["semi_moneyness"] = sp.get("moneyness")
out["semi_otm_max_offset"] = sp.get("otm_max_offset")
out["semi_perp_unit"] = sp.get("perp_unit")
out["semi_option_unit"] = sp.get("option_unit")
out["semi_net_exit_target"] = float(sp["perp_exit_unit"]) * k_eff
except Exception:
logger.exception("semi params for state() failed")
@@ -1361,6 +1365,10 @@ class StrategyEngine:
view_side=str(sp_lock["view_side"]),
option_move_points=float(sp_lock["option_move_points"]),
perp_exit_unit=float(sp_lock["perp_exit_unit"]),
moneyness=str(sp_lock.get("moneyness") or "otm"),
otm_max_offset=float(sp_lock.get("otm_max_offset") or 25),
perp_unit=float(sp_lock.get("perp_unit") or 1),
option_unit=float(sp_lock.get("option_unit") or 4),
)
self._set_state(phase="open", last_error=None)
try: