使用 QuantLib Python 使用 Heston 模型的亚式期权定价

Pricing of Asian Option using the Heston Model using QuantLib Python

我正在尝试使用 QuantLib 为具有几何平均类型的亚洲期权定价。但是,我似乎无法计算 NPV 或任何希腊语。我收到以下错误:RuntimeError: wrong argument type.

请在下面找到我的代码。

导致错误的行是这一行:“AsianOptionHeston.NPV()”

valuationDate = ql.Date(30, 6, 2020)
ql.Settings.instance().evaluationDate = valuationDate
maturityDate = ql.Date(30, 9, 2022)
calendar = ql.UnitedStates()
dayConvention = ql.Actual360()
businessConvention = ql.Following
optionType = ql.Option.Call
strike = 125
s0 = 110
volatility = 0.2
dividendYield = 0.0368
averageType = ql.Average.Geometric
dividendTermStructure = ql.YieldTermStructureHandle(ql.FlatForward(valuationDate, dividendYield, dayConvention))
discountingTermStructure = ql.YieldTermStructureHandle(ql.FlatForward(valuationDate, 0.03, dayConvention))
exerciseType = ql.EuropeanExercise(maturityDate)
payoff = ql.PlainVanillaPayoff(optionType, strike)
AsianOptionHeston = ql.DiscreteAveragingAsianOption(averageType, 0, 1, [ql.Date(31, 3, 2021)], payoff, exerciseType)
v0 = 0.2 * 0.2 # Spot variance
kappa = 0.1
sigma = 0.015 # Volatility of volatility
correlation = -0.75
spotHandleHeston = ql.QuoteHandle(ql.SimpleQuote(s0))
hestonProcess = ql.HestonProcess(discountingTermStructure, dividendTermStructure, spotHandleHeston, v0, kappa, v0, sigma, correlation)
engineHeston = ql.AnalyticHestonEngine(ql.HestonModel(hestonProcess), 0.01, 1000)
AsianOptionHeston.setPricingEngine(engineHeston)
AsianOptionHeston.NPV()

AnalyticHestonEngine 不适用于亚洲期权定价。 尝试此处列出的引擎之一:

QuantLib Python Reference