For a PhD research paper, I need to calibrate Heston. So far, I use

Dale Roberts R-Code: https://github.com/daleroberts/heston/blob/master/heston.r

for computing prices from which I invert IV using

PyVolLib: https://github.com/vollib/py_vollib

Heston IV surface

As can be seen from the plotted smile, (deep) OTM data is not good. The problem can be traced down to the numerical instability of the Heston pricer which returns slightly negative and/or oscillating prices.

Hence, I am looking for software that

  • prices Heston accurately also for OTM options
  • should be free (poor PhD student in MathFinance)
  • ideally in Python as the rest of my code is in Python

QuantLib (https://www.quantlib.org) seems like a solution but

  1. there is a ton of boilerplate code even for simple tasks and the documentation is not exactly friendly
  2. I need time to maturity as an input variable but it seems QuantLib only takes exact calendar days for the maturity.

I am also aware of Premia's (https://www.rocq.inria.fr/mathfi/Premia/index.html) available software but they also don't provide Python bindings.

  • 3
    $\begingroup$ Appreciate you are looking to cut a corner to expedite your research - but this isn't such a big corner to cut and self-implementation of Heston is a valuable lesson for anyone interested in option pricing. Seems a shame to pass up this opportunity. At least improve the public code you have been using for others to benefit from. $\endgroup$ – James Spencer-Lavan May 14 '18 at 18:05
  • $\begingroup$ I couldn't agree more with @JamesSpencer-Lavan comment. I suggest you have a look at the Fang and Oosterlee COS method which tends to be more stable in the wings. $\endgroup$ – LocalVolatility May 14 '18 at 18:24
  • $\begingroup$ I second Fourier cosine methods. I implemented it in VBA to begin with, writing my own complex class to boot. Efficient, non-tricky and easy to extend to different payoffs & dimensions $\endgroup$ – James Spencer-Lavan May 14 '18 at 20:22
  • 1
    $\begingroup$ @LocalVolatility, thanks for suggesting the COS Method, I wasn't aware of it. I agree that implementing Heston might be a worthwhile exercise. On the other hand, reading the paper, implementing, debugging and crosschecking the implementation (and I don't have a reference method at hand) is a too time-consuming task for a non-essential part of a paper of a PhD student that is soon running out of funding. I will try to get QuantLib working instead. $\endgroup$ – sbm May 16 '18 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.