Option pricing using the Black Scholes Model
Project description
This is an simple python package to calculate greeks like theta,vega,gamma,delta and rho as well as to calculate option prices using binomial tree method and black scholes method.
Dependencies
Numpy
Scipy
How to install
pip install option-pricings
How to import
import option_pricings
Or import specific modules
from option_pricings import bsm for black scholes
from option_pricings import binomial for binomial tree
from option_pricings import greeks for greeks
using the package
| Symbol | Meaning | Note |
|---|---|---|
| S | Spot Price | |
| K | Strike Price | |
| T | Time to Maturity | |
| r | Interest Rate | To be entered in the scale of 1-100 |
| sigma | Volatility | To be entered in the scale of 1-100 |
| u | Up Factor | |
| d | Down Factor |
black scholes
from option_pricings import bsm
price = bsm(S=50,K=40,T=1,r=6,sigma=25,option_type="call")
print(price)
The option type can be either call or put
binomial
from option_pricings import binomial
price = binomial(S=50,K=52,r=5,T=2,u=1.2,d=0.8,option_type="put",n_steps=2)
print(price)
you can give either u and d or sigma and the u and d will be calculated based on that similarly you can give either time_step or n_step and the other will be calculated like wise Note:
greeks
from option_pricings import greeks
first you need to instantiate the classs
price = greeks(S=50, K=40, T=1, r=6, sigma=25, option_type='call')
then specify which greek you want to calculate
greeks.delta()
greeks.gamma()
greeks.vega()
greeks.theta()
greeks.rho()
there also an option which will calculate all the options in one go
greeks.all()
Author
Shreenivas Dani
Emai: shreenivasdani@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file option_pricings-0.1.3.tar.gz.
File metadata
- Download URL: option_pricings-0.1.3.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb22c509f74c56492c1360d662168f3fe41f2d4f69d69ef5e6c6661144d82237
|
|
| MD5 |
f33722cb18baca4cdbf565b821109fb3
|
|
| BLAKE2b-256 |
e87a24b69149aa7a46d55b3aebcd0154d3c1f8258e5ac13f6bba27d4e0e18fd7
|
File details
Details for the file option_pricings-0.1.3-py3-none-any.whl.
File metadata
- Download URL: option_pricings-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c892ab80172e94d8f4bc02438d26f87dec5ea1ef7ff1e48dfabaafefb17244e
|
|
| MD5 |
e4537c0aff1921542660a4d000c39398
|
|
| BLAKE2b-256 |
b641bae1ae85a2d4b137f7a054a467de9f562f054302edf69fe8cb6d26c16354
|