Skip to content

Price an option or determine implied volatility with the Black Scholes model

Notifications You must be signed in to change notification settings

arsalan0c/OptionsPricing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

OptionsPricing

This python program can be used for pricing an option or determining implied volatility, with the Black Scholes model.

Assumptions

  • No transaction fees in purchase of option
  • Option can only be exercised at expiration
  • Periodic daily rate of return can be modelled by Brownian motion
  • No arbitrage opportunity exists

Example Usage

Put option pricing:

python3 BlackScholes.py -ot put -s 10 -x 10 -r 0.0.1 -v 0.3 -t 0.25 

Call option implied volatility:

python3 BlackScholes.py -m impliedvolatility -s 10 -x 10 -r 0.01 -t 0.25 -mp 5.70  

Arguments

-s (float) stock price, required

-x (float) strike price, required

-r (float) risk-free interest rate, required

-v (float) volatility, standard deviation of log returns, required if pricing an option

-mp (float) market price of the option, required if determining implied volatility

-t (float) tau, time to expiry expressed as fraction of year, required. Alternative: -ed

-ed (str) expiry date of option in dd/mm/yyyy format, required. Alternative: -t

-ot (str) option type, call or put. Default: call

-m (str) mode, optionprice or impliedvolatility. Default: optionprice

-p (float) precision, in calculating implied volatility, threshold below which to accept volatility estimate. Default: 1e-4

-i (int) iterations, in calculating implied volatility, the maximum number of times to run the Newton-Raphson method of successive approximations. Default: 100

About

Price an option or determine implied volatility with the Black Scholes model

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages