修正期期盈亏比口径:按总权利金计算,残值按本合约

盈利腿触发改为盈利金额/总权利金;亏损腿残值20%仍相对该合约自身权利金。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-11 16:51:50 +08:00
parent c5d3d9d6c1
commit a1bf760a28
8 changed files with 58 additions and 35 deletions
+10 -10
View File
@@ -454,7 +454,8 @@ def build_options_options_preview(
) -> dict[str, Any]:
"""期期情景:盈亏比达标 / 到期现价 / 最大保费损耗.
新口径优先 profit_rr(盈利金额/初始权利金);若未传则兼容旧上/下破目标价.
新口径优先 profit_rr(盈利金额/权利金);若未传则兼容旧上/下破目标价.
残值按亏损腿本合约权利金的 20% 计.
"""
def _leg_pnl(leg: dict[str, Any], spot: float) -> float:
@@ -474,13 +475,12 @@ def build_options_options_preview(
# 新:盈亏比情景(不依赖指数上下破价)
if rr is not None and rr > 0:
# 盈利腿达 RR:盈利 = rr × 该腿权利金;亏损腿按全亏 / 残值20%回收两种
a_win = rr * prem_a
b_win = rr * prem_b
a_at_a = a_win
# 盈利腿达 RR:盈利金额 = rr × 权利金;亏损腿按全亏 / 本合约残值20%回收
win_profit = rr * prem
a_at_a = win_profit
b_at_a_full = -prem_b
b_at_a_res = -prem_b * 0.8 # 回收 20%
b_at_b = b_win
b_at_a_res = -prem_b * 0.8 # 本合约回收 20%
b_at_b = win_profit
a_at_b_full = -prem_a
a_at_b_res = -prem_a * 0.8
@@ -506,7 +506,7 @@ def build_options_options_preview(
"leg_a_pnl": round(a_at_a, 4),
"leg_b_pnl": round(b_at_a_full, 4),
"total": round(a_at_a + b_at_a_full, 4),
"note": "盈利腿按盈亏比兑现;亏损腿权利金全亏",
"note": "盈利=总权利金×盈亏比;亏损腿本合约全亏",
},
{
"id": "rr_leg_b_full",
@@ -515,7 +515,7 @@ def build_options_options_preview(
"leg_a_pnl": round(a_at_b_full, 4),
"leg_b_pnl": round(b_at_b, 4),
"total": round(a_at_b_full + b_at_b, 4),
"note": "盈利腿按盈亏比兑现;亏损腿权利金全亏",
"note": "盈利=总权利金×盈亏比;亏损腿本合约全亏",
},
{
"id": "rr_leg_a_residual",
@@ -524,7 +524,7 @@ def build_options_options_preview(
"leg_a_pnl": round(a_at_a, 4),
"leg_b_pnl": round(b_at_a_res, 4),
"total": round(a_at_a + b_at_a_res, 4),
"note": "亏损腿买一回收约初始权利金20%",
"note": "亏损腿买一回收约本合约权利金20%",
},
{
"id": "expiry_flat",