Split OO budget per leg and size Call/Put independently.

Each half of the risk budget buys its own qty from ask; equal qty no longer forced.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-07 17:08:05 +08:00
parent 24943adf13
commit 24a860ad3f
11 changed files with 210 additions and 110 deletions
+10 -9
View File
@@ -152,16 +152,17 @@ def assess_open_capacity(
ca = float(snap.call.ask)
if pa is None and snap.put and snap.put.ask:
pa = float(snap.put.ask)
except Exception:
pass
cush = float(
ledger.get_setting_float("oo_budget_cushion", s.oo_budget_cushion)
or s.oo_budget_cushion
)
cush = min(1.0, max(0.5, cush))
except Exception:
pass
if ca is not None and pa is not None and ca > 0 and pa > 0:
# 与定仓一致:按预留后的权利金需求估资金门
premium_need = (ca + pa) * opt_qty * (1.0 + fee_rate) * cush
call_q = float(opt_qty)
put_q = float(
ledger.get_setting_float("oo_put_qty_eth", call_q) or call_q
)
# 与定仓一致:两腿各自权利金
premium_need = (
(ca * call_q + pa * put_q) * (1.0 + fee_rate)
)
else:
premium_need = None
margin_need = 0.0