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

Overview

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.

Owner
sammuhrai
sammuhrai
A neural-based binary analysis tool

A neural-based binary analysis tool Introduction This directory contains the demo of a neural-based binary analysis tool. We test the framework using

Facebook Research 208 Dec 22, 2022
A set of tools to analyse the output from TraDIS analyses

QuaTradis (Quadram TraDis) A set of tools to analyse the output from TraDIS analyses Contents Introduction Installation Required dependencies Bioconda

Quadram Institute Bioscience 2 Feb 16, 2022
Open-source Laplacian Eigenmaps for dimensionality reduction of large data in python.

Fast Laplacian Eigenmaps in python Open-source Laplacian Eigenmaps for dimensionality reduction of large data in python. Comes with an wrapper for NMS

17 Jul 09, 2022
Average time per match by division

HW_02 Unzip matches.rar to access .json files for matches. Get an API key to access their data at: https://developer.riotgames.com/ Average time per m

11 Jan 07, 2022
PySpark Structured Streaming ROS Kafka ApacheSpark Cassandra

PySpark-Structured-Streaming-ROS-Kafka-ApacheSpark-Cassandra The purpose of this project is to demonstrate a structured streaming pipeline with Apache

Zekeriyya Demirci 5 Nov 13, 2022
Functional tensors for probabilistic programming

Funsor Funsor is a tensor-like library for functions and distributions. See Functional tensors for probabilistic programming for a system description.

208 Dec 29, 2022
Exploring the Top ML and DL GitHub Repositories

This repository contains my work related to my project where I scraped data on the most popular machine learning and deep learning GitHub repositories in order to further visualize and analyze it.

Nico Van den Hooff 17 Aug 21, 2022
Minimal working example of data acquisition with nidaqmx python API

Data Aquisition using NI-DAQmx python API Based on this project It is a minimal working example for data acquisition using the NI-DAQmx python API. It

Pablo 1 Nov 05, 2021
Codes for the collection and predictive processing of bitcoin from the API of coinmarketcap

Codes for the collection and predictive processing of bitcoin from the API of coinmarketcap

Teo Calvo 5 Apr 26, 2022
Catalogue data - A Python Scripts to prepare catalogue data

catalogue_data Scripts to prepare catalogue data. Setup Clone this repo. Install

BigScience Workshop 3 Mar 03, 2022
Toolchest provides APIs for scientific and bioinformatic data analysis.

Toolchest Python Client Toolchest provides APIs for scientific and bioinformatic data analysis. It allows you to abstract away the costliness of runni

Toolchest 11 Jun 30, 2022
MeSH2Matrix - A set of Python codes for the generation of biomedical ontologies from the MeSH keywords of the PubMed scholarly publications

A set of Python codes for the generation of biomedical ontologies from the MeSH keywords of the PubMed scholarly publications

SisonkeBiotik 6 Nov 30, 2022
Udacity-api-reporting-pipeline - Udacity api reporting pipeline

udacity-api-reporting-pipeline In this exercise, you'll use portions of each of

Fabio Barbazza 1 Feb 15, 2022
First steps with Python in Life Sciences

First steps with Python in Life Sciences This course material is part of the "First Steps with Python in Life Science" three-day course of SIB-trainin

SIB Swiss Institute of Bioinformatics 22 Jan 08, 2023
PyChemia, Python Framework for Materials Discovery and Design

PyChemia, Python Framework for Materials Discovery and Design PyChemia is an open-source Python Library for materials structural search. The purpose o

Materials Discovery Group 61 Oct 02, 2022
talkbox is a scikit for signal/speech processing, to extend scipy capabilities in that domain.

talkbox is a scikit for signal/speech processing, to extend scipy capabilities in that domain.

David Cournapeau 76 Nov 30, 2022
Fitting thermodynamic models with pycalphad

ESPEI ESPEI, or Extensible Self-optimizing Phase Equilibria Infrastructure, is a tool for thermodynamic database development within the CALPHAD method

Phases Research Lab 42 Sep 12, 2022
Utilize data analytics skills to solve real-world business problems using Humana’s big data

Humana-Mays-2021-HealthCare-Analytics-Case-Competition- The goal of the project is to utilize data analytics skills to solve real-world business probl

Yongxian (Caroline) Lun 1 Dec 27, 2021
Using Data Science with Machine Learning techniques (ETL pipeline and ML pipeline) to classify received messages after disasters.

Using Data Science with Machine Learning techniques (ETL pipeline and ML pipeline) to classify received messages after disasters.

1 Feb 11, 2022
A script to "SHUA" H1-2 map of Mercenaries mode of Hearthstone

lushi_script Introduction This script is to "SHUA" H1-2 map of Mercenaries mode of Hearthstone Installation Make sure you installed python=3.6. To in

210 Jan 02, 2023