GithubHelp home page GithubHelp logo

xiqicpt / implement-option-pricing-model-using-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hongwai1920/implement-option-pricing-model-using-python

0.0 0.0 0.0 20.9 MB

Simulated GBM using MC simulation, estimated option' Greeks using numerical methods such as finite difference, pathwise derivative estimate and likelihood ratio methods. Lastly, implemented binomial tree option pricing to price American option.

Python 0.76% Jupyter Notebook 99.24%

implement-option-pricing-model-using-python's Introduction

Implement Option Pricing Model using Python

This repository contains all my personal projects Option Pricing Model using Python.

This notebook is a simple Python's implemention of analytical formulas of vanilla options including European and America call and put options. It also contains formulas of binary put, call and forward contract.

We started with testing their consistencies to determine their correctness including put-call parity and relationship among all paramters in the Black-Scholes model.

Then we validated all formulas using the Monte Carlo method. The following is a plot of using Monte-Carlo method to price European put, call and binary put, call options.

We also implemented Euler-Maruyama method to simulate the dynamic of stock price under Geometric Brownian Motion Stochastic Differential Equation. The following is a plot its simulation.

This notebook performs sensitivity analysis on options' value by applying finite difference and Monte Carlo methods. We also implemented numerical methods such as pathwise derivative estimate and likelihood ratio methods to approximate option's greeks.

For example, to calculate delta of an European call option, pathwise derivative estimate asserts that

Therefore, to calculate the delta, one can apply Monte-Carlo method to calculate the final expectation.

On the other hand, the likelihood ratio method asserts that

Therefore, one can use the Monte-Carlo method again to calculate the final expectation.

This notebook uses various binomial trees simulation including CRR and discretize GBM to price options. The following plots contain convergence of CRR and GBM simulations for European and Binary call and put options. Green line is the analytical pricing obtained by Black-Scholes.

The parameters are spot = 100, strike = 100, volatility = 0.1, risk-free interest rate = 0.05, dividend = 0 and time to maturity = 2.

For BS price at both American call and put options, the green line corresponds to the respective European call and put option. Since dividend is zero, both American and European call should worth the same, which is illustrated in the American call plot below.

implement-option-pricing-model-using-python's People

Contributors

hongwai1920 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.