@@ -56,3 +56,77 @@ def test_gjrgarchmodel_process(gjrgarch_model_env):
5656 process = model .process ()
5757 assert process is not None
5858 assert isinstance (process , ql .GJRGARCHProcess )
59+
60+
61+ # =============================================================================
62+ # HestonModelHelper
63+ # =============================================================================
64+
65+
66+ @pytest .fixture
67+ def heston_helper_env ():
68+ """Environment for HestonModelHelper tests."""
69+ today = ql .Date (15 , ql .January , 2026 )
70+ ql .Settings .instance ().evaluationDate = today
71+
72+ dc = ql .Actual365Fixed ()
73+ risk_free = ql .FlatForward (today , 0.05 , dc )
74+ dividend = ql .FlatForward (today , 0.02 , dc )
75+ vol_quote = ql .SimpleQuote (0.20 )
76+
77+ return {
78+ "today" : today ,
79+ "risk_free" : risk_free ,
80+ "dividend" : dividend ,
81+ "vol_quote" : vol_quote ,
82+ }
83+
84+
85+ def test_hestonmodelhelper_construction_real_s0 (heston_helper_env ):
86+ """Test HestonModelHelper construction with Real spot price."""
87+ env = heston_helper_env
88+
89+ helper = ql .HestonModelHelper (
90+ maturity = ql .Period (1 , ql .Years ),
91+ calendar = ql .TARGET (),
92+ s0 = 100.0 ,
93+ strikePrice = 105.0 ,
94+ volatility = env ["vol_quote" ],
95+ riskFreeRate = env ["risk_free" ],
96+ dividendYield = env ["dividend" ],
97+ )
98+ assert helper is not None
99+ assert isinstance (helper , ql .base .BlackCalibrationHelper )
100+
101+
102+ def test_hestonmodelhelper_construction_handle_s0 (heston_helper_env ):
103+ """Test HestonModelHelper construction with Handle<Quote> spot price."""
104+ env = heston_helper_env
105+
106+ helper = ql .HestonModelHelper (
107+ maturity = ql .Period (1 , ql .Years ),
108+ calendar = ql .TARGET (),
109+ s0 = ql .QuoteHandle (ql .SimpleQuote (100.0 )),
110+ strikePrice = 105.0 ,
111+ volatility = ql .QuoteHandle (env ["vol_quote" ]),
112+ riskFreeRate = ql .YieldTermStructureHandle (env ["risk_free" ]),
113+ dividendYield = ql .YieldTermStructureHandle (env ["dividend" ]),
114+ )
115+ assert helper is not None
116+ assert isinstance (helper , ql .base .BlackCalibrationHelper )
117+
118+
119+ def test_hestonmodelhelper_maturity (heston_helper_env ):
120+ """Test HestonModelHelper maturity accessor."""
121+ env = heston_helper_env
122+
123+ helper = ql .HestonModelHelper (
124+ maturity = ql .Period (1 , ql .Years ),
125+ calendar = ql .TARGET (),
126+ s0 = 100.0 ,
127+ strikePrice = 105.0 ,
128+ volatility = env ["vol_quote" ],
129+ riskFreeRate = env ["risk_free" ],
130+ dividendYield = env ["dividend" ],
131+ )
132+ assert helper .maturity () == pytest .approx (1.0 , abs = 0.01 )
0 commit comments