GithubHelp home page GithubHelp logo

antdvid / fastamericanoptionpricing Goto Github PK

View Code? Open in Web Editor NEW
37.0 6.0 14.0 82 KB

Fast American option pricing using spectral collocation method based on integral form. An independent Crank Nicolson method is included for comparison.

Python 100.00%
integral-equation collocation-method spectral-method fast american-option crank-nicolson

fastamericanoptionpricing's Introduction

Fast American Option Pricing

What is this project about?

This project is an implementation of american option pricing based on integral equation form. Taking advantage of exponentianl convergence of spectral method, this algorithm is about 6 orders of magnitude faster than the traditional finite difference method at comparable or better accuracy levels. The main steps of this algorithm are listed as follows:

  1. compute collocation points
  2. compute coefficients for Gaussian quadrature
  3. compute QD+ algorithm for initial guess: QDplusAmericanOptionSolver.py
  4. Newton iteration to find exercise boundary
  5. compute option price using the exercise boundary

How to use the solver?

The main solver is FastAmericanOptionSolverA.py and FastAmericanOptionSolverB.py. Solver A is much faster than Solver B, while Solver B is more stable in some cases. The users are recommended to follow the steps in testA.py and testB.py for testing. CrankNicolsonOptionSolver.py is a solver for American put option pricing and can be used independently or to compare with the spectral method. EuropeanOptionSolver.py is a solver for Europea option pricing. It is a component of the spectral method, but can also be used independently. Other tests are self-documented. Please feel free to contribute to this project.

How fast is the solver?

Comparing with the traditional trinomial tree and PDE method, the spectral method is about 6 orders of magnitude faster at comparable accuracy. The speed of the python version actually depends on the compiler. Without using JIT compiler, the spectral method takes about 1s per pricing. When I implement the code in c#, the pricing is 100 times faster. However, I can not share the code here since it is in production. You can get a sense based on the following figure:

About the paper

The algorithm is based on paper Leif Andersen, High Performance American Option Pricing, 2015, but the author only considered the put option. The code in this repository has already considered both call and put cases.

fastamericanoptionpricing's People

Contributors

antdvid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fastamericanoptionpricing's Issues

Call pricing

Hi,

Great work!

From the project's read-me: Extending to call option is not that straightforward and the call-put symmetry should not be used.

Why is this the case? In the paper they remark that this method can be extended to calls via the symmetry - but I currently know too little about this topic. ๐Ÿ˜„

Thanks!

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.