Show option net P/L from bid recycle minus premium.

Rename floating P/L to net P/L, align ROI, and display bid depth as price/liquidity for only the levels needed to close.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-15 20:54:15 +08:00
parent da3975e42e
commit e15eca76f3
6 changed files with 114 additions and 23 deletions
+4 -1
View File
@@ -196,6 +196,7 @@ def test_estimate_close_by_bids_full_depth():
assert out["total_received"] == 0.488
assert out["avg_px"] == 12.2
assert out["estimated_pnl"] == 0.088
assert out["estimated_pnl_ratio_pct"] == 22.0
assert [x["sheets"] for x in out["levels"]] == [2, 2]
@@ -206,7 +207,9 @@ def test_estimate_close_by_bids_partial_depth():
assert out["covered_sheets"] == 1
assert out["uncovered_sheets"] == 2
assert out["total_received"] == 0.1
assert out["estimated_pnl"] == -0.1
# 净盈亏 = 回收 − 全部权利金(不按覆盖比例摊薄)
assert out["estimated_pnl"] == -0.5
assert out["estimated_pnl_ratio_pct"] == round(-0.5 / 0.6 * 100, 2)
def test_estimate_close_by_bids_empty():