Pricing of Asian Option using the Heston Model using QuantLib Python

Question:

I am trying to price an Asian option with a Geometric average type using QuantLib. However, I can’t seem to be able to compute the NPV or any Greek. I get the following error

RuntimeError: wrong argument type

Please find the codes below.

The line causing the error is this one

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()
Asked By: ql.user2511

||

Answers:

The AnalyticHestonEngine is not appropriate to price Asian options.
Try one of the engines listed here:

QuantLib Python Reference

Answered By: David Duarte
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.