Revise strategy: TTM+ATM+leverage option pick, % exit, perp leverage/margin.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-25 08:38:03 +08:00
parent 7db4c9c8a3
commit 3957a83761
16 changed files with 532 additions and 261 deletions
+9
View File
@@ -385,6 +385,7 @@ class Matcher:
"option_upl": 0.0,
"index_px": None,
"move_points": 0.0,
"move_pct": 0.0,
"premium_gap": None,
}
gw = get_gateway()
@@ -428,8 +429,12 @@ class Matcher:
entry_idx = float(pos["entry_index_px"] or 0)
move = abs(float(index_px) - entry_idx) if index_px is not None and entry_idx else 0.0
move_pct = (move / entry_idx * 100.0) if entry_idx > 0 else 0.0
initial_premium = float(pos["initial_premium"] or 0)
premium_gap = initial_premium - perp_upl
leverage = self.ledger.get_setting_float("leverage", s.leverage)
notional = abs(perp_entry * perp_qty)
margin = notional / leverage if leverage > 0 else None
group_id = pos.get("group_id")
g = (
@@ -454,6 +459,9 @@ class Matcher:
"perp_entry_px": perp_entry,
"perp_qty_eth": perp_qty,
"perp_mark_px": float(mark) if mark is not None else None,
"perp_notional": notional,
"perp_margin": margin,
"leverage": leverage,
"option_inst_id": pos.get("option_inst_id"),
"option_entry_px": float(pos["option_entry_px"] or 0),
"option_qty_eth": float(pos["option_qty_eth"] or 0),
@@ -466,6 +474,7 @@ class Matcher:
"index_px": index_px,
"entry_index_px": entry_idx,
"move_points": move,
"move_pct": move_pct,
"initial_premium": initial_premium,
"premium_gap": premium_gap,
"status": pos.get("status"),