Coder Social home page Coder Social logo

zoro20171002 / heston Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jcfrei/heston

0.0 1.0 0.0 96 KB

Option pricing function for the Heston model based on the implementation by Christian Kahl, Peter Jäckel and Roger Lord. Includes Black-Scholes-Merton option pricing and implied volatility estimation. No Financial Toolbox required.

License: MIT License

MATLAB 100.00%

heston's Introduction

Heston Option Pricing Calibration

Heston1993KahlJaeckelLordRev3 is the Heston option pricing function based on the implementation by Christian Kahl, Peter Jäckel and Roger Lord. The standard Heston formula exhibits a high numerical instability of the integral which is remedied in this implementation.

This function works for plain vanilla (European-style) put and call options and also implements an automatic estimation of the optimal alpha required for the integrand. A user generated alpha can also be used as an optional last argument.

Included are also a Black-Scholes-Merton (BSM) function (bsmec.m) to price European vanilla options and bsmivec.m for calculating the BSM implied volatilites - in case the Financial Toolbox is not available.

References

  • Roger Lord, Christian Kahl. Optimal Fourier inversion in semi-analytical option pricing. 2007
  • Roger Lord, Christian Kahl. Why the Rotation Count Algorithm Works. 2006
  • Christian Kahl, Peter Jäckl. Not-so-complex logarithms in the Heston model. 2009
  • Steven L. Heston. A Closed-Form Solution for Options with Stochastic Volatility with Applications to Bond and Currency Options. 1993

Usage

Run HestonCalibration.m to perform a sample calibration.

Usage of Heston1993KahlJaeckelLordRev3:

Input: (PC till q can be vectorized)

  •  PC: 1 for Calls, 2 for Puts
    
  •  S: Spot
    
  •  K: Strike
    
  •  T: Maturity
    
  •  t: start date
    
  •  r: interest rate
    
  •  q: dividend
    
  •  v0: initial variance
    
  •  theta: long run mean variance
    
  •  kappa: mean reversion speed of  volatility
    
  •  sigma: volatility of volatility
    
  •  rho: correlation between returns volatility
    
  •  (alpha:) vector of alphas. if unset function generates alphas
    

    Output:

  •  Price for each option
    
  •  (Alphas)
    

Tips

Smaller upper boundaries of [100 100 1-eps 100 100 ] instead of [Inf Inf 1-eps Inf Inf ] and trying different starting parameters might help if the calibration gets stuck in a local minimum.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

30/04/2016: added the bsmec.m and bsmivec.m functions

License

MIT

heston's People

Contributors

jcfrei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.