Fix 期期 sheets bias: split total 2n from same-sheets, not n.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-19 15:33:00 +08:00
parent e3cd2a75de
commit 7938628485
10 changed files with 54 additions and 26 deletions
+13 -8
View File
@@ -243,9 +243,12 @@ def suggest_oo_sheets(
return _fail("缺少有效卖一价,无法建议张数")
pair = cost_a + cost_b
n_same = int(math.floor(budget / pair + 1e-12)) if pair > 0 else 0
n_same = _cap_sheets_by_ask_depth(n_same, ask_sz_a)
n_same = _cap_sheets_by_ask_depth(n_same, ask_sz_b)
n_pair = int(math.floor(budget / pair + 1e-12)) if pair > 0 else 0
# 与同张数一致:先按预算得 n,再各自深度封顶后取 min
n_same = min(
_cap_sheets_by_ask_depth(n_pair, ask_sz_a),
_cap_sheets_by_ask_depth(n_pair, ask_sz_b),
)
if m == "same_sheets":
n_a = n_same
@@ -262,11 +265,13 @@ def suggest_oo_sheets(
return _fail(err)
major_is_call = m == "long_bias"
if split_by == "sheets":
if n_same < 2:
return _fail("同张数规模不足 2,无法按比例拆分")
major_n = int(round(n_same * ratio))
major_n = max(1, min(major_n, n_same - 1))
minor_n = n_same - major_n
# 总张数 = 同张数两侧合计(每腿 n → 共 2n),再按比例拆到 Call/Put
total = int(n_same) * 2
if total < 2:
return _fail("同张数总规模不足 2,无法按比例拆分")
major_n = int(round(total * ratio))
major_n = max(1, min(major_n, total - 1))
minor_n = total - major_n
n_call = major_n if major_is_call else minor_n
n_put = minor_n if major_is_call else major_n
else:
@@ -301,4 +301,4 @@
</div>
</div>
</div>
<script src="/static/hedge_plan.js?v=23"></script>
<script src="/static/hedge_plan.js?v=24"></script>