情景测算按到期实值反推盈亏比达标现货价

达标情景现货价按权利金价值与行权价反推,便于对照到期后效果。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-11 17:01:21 +08:00
parent a1bf760a28
commit 38e3e00fe9
2 changed files with 66 additions and 6 deletions
+5
View File
@@ -114,6 +114,11 @@ class TestHedgePlanCalc(unittest.TestCase):
self.assertEqual(len(p["scenarios"]), 5)
self.assertEqual(p["scenarios"][0]["id"], "rr_leg_a_full")
self.assertEqual(p["scenarios"][1]["id"], "rr_leg_b_full")
# 到期实值反推:Call 盈利20 → 价值25 → 每币2500 → spot=3300+2500
self.assertEqual(p["scenarios"][0]["spot"], 5800.0)
# Put 盈利20 → spot=3100-2500
self.assertEqual(p["scenarios"][1]["spot"], 600.0)
self.assertEqual(p["scenarios"][2]["spot"], 5800.0) # 残值情景同腿A反推
def test_oo_legacy_single_target_still_works(self):
a = {"opt_type": "C", "strike": 3300, "sheets": 1, "ct_mult": 0.01, "premium_paid": 5}