Giter Club home page Giter Club logo

binomial_option_pricing_calculator's Introduction

Binomial Option Pricing Calculator

Option Pricing Calculator using the Binomial Pricing Method (No Libraries Required)

Background

A derivative is a financial instrument that derives its value from the price of an underlying asset. An option gives the owner the ability to buy or sell the underlying asset at pre-determined price. An option that allows the holder to buy the asset at the pre-determined price (also known as the exercise or strike price) is called a call option. An option that lets the owner sell the underlying asset at the strike price is called a put option. There are three key types of options, a European option allows the holder to exercise ('redeem') the option only at maturity of the option. An American option can be exercised any time before maturity. A Bermudan option is exercisable at pre-deteremined dates decided at the creation of the option.

The binomial pricing method is one of the three most common methods used to value options - the others being the Black-Scholes model and a Monte Carlo simulation. The method predicts the price of the underlying asset at intervals (branches) between now and maturity of the option contract. This creates a tree showing the price movements of the asset, which can be used to find the fair value of the option. Unlike Black-Scholes, the binomial method allows the intrinsic value of the option to be calculated prior to maturity, better representing the value of American and Bermudan options which have the option of early exercise.

Pricing options using this method is done by:

  1. Determining the magnitude that stock prices will rise or fall between each branch.
  2. Calculating the probability that the stock price will move upwards or downward.
  3. Forming the binomial stock price tree with the specified number of branches.
  4. Calculate the payoff of the option at maturity.
  5. Working backwards, value the option by discounting the value of the option at the following nodes using. If the option is American or Bermudan and exercisible at that branch, then the value of the option if it was exercised is calculated, if it is greater than the discoutned value, it becomes the calculated value of the branch.
  6. The value derived at the top of the tree is the fair value of the option today.

Features of the Script

  • Does not require any libraries - it will work in base python3 and immune to changes in libraries
  • Option type is specified as a parameter allowing easy implementations
  • Returns and displays the calculated stock tree

The following assumptions are made by the model:

  • No dividends are paid across the option's life
  • Risk-Free rate is constant across the option's life
  • The price will move up or down each period

Variables and Paramaters

The variables required are:

Name Symbol Description
Stock Price s The current price of the underlying asset (time 0)
Exercise Price x The strike price of the option contract
Time to Maturity t The time until maturity of the option contract (in years)
Risk-Free Rate r The current risk-free rate
Branches/Steps b The number of branches used to value the option
Volatility v The volatility of the price movements in the underlying asset

Optional variables are:

Name Symbol Description
Option Nationality nat 'A' for American (default), 'B' for Bermudan, 'E' for European
Option Type typ 'C' for Call (default), 'P' for Put
Print Results prnt True to enable printing (default), False to disable
Exercisible Periods exP The branches that a Bermudan option can be exercised

Related Projects

Beta calculator with stock data downloader: https://github.com/sammuhrai/beta-calculator

Disclaimer

Script is for educational purposes and is not to be taken as financial advice.

binomial_option_pricing_calculator's People

Contributors

sammuharem avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

aizwellenstan

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.