1

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()
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
ql.user2511
  • 369
  • 2
  • 12
  • Your question does not seem really related to Options pricing etc. It seems just fundamental error of passing wrong parameter. You need to show which line is causing the error, and what is the method signature – Adrian Shum Jan 20 '21 at 06:50

1 Answers1

1

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

QuantLib Python Reference

David Duarte
  • 644
  • 4
  • 11