Skip to main content

Option pricing using the Black Scholes Model

Project description

option-prices

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_prices

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

for using the greeks library you need to specify which of the greeks you want to calculate from option_pricings import greeks greeks.delta(S=50, K=40, T=1, r=6, sigma=25, option_type='call') greeks.gamma(S=50, K=40, T=1, r=6, sigma=25, option_type='call') greeks.vega(S=50, K=40, T=1, r=6, sigma=25, option_type='call') greeks.theta(S=50, K=40, T=1, r=6, sigma=25, option_type='call') greeks.rho(S=50, K=40, T=1, r=6, sigma=25, option_type='call')

Author

Shreenivas Dani

Emai: shreenivasdani@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

option_pricings-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

option_pricings-0.1.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file option_pricings-0.1.2.tar.gz.

File metadata

  • Download URL: option_pricings-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for option_pricings-0.1.2.tar.gz
Algorithm Hash digest
SHA256 991f9c87e3715975046eae9a9cda97226e39ec08dc5bf63787b2ce4f7e3baff3
MD5 d554a5b53d0bcd5453a877bcefdd9a50
BLAKE2b-256 0179fb64494efde45f0aad5764e28a28ff9cfb1eca0e8d2fb2e170582c1be123

See more details on using hashes here.

File details

Details for the file option_pricings-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for option_pricings-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1003f7814412daacd548976a4c104d1b1a78420c0f7ee499f89d7bdeb16fe20e
MD5 4fd5fb61a5ccee2f5ccbc1be5d0544ea
BLAKE2b-256 66d81d131b2d55d5877c578736edd0e484f972ea9de80973461657ad6bbddd4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page