This python program can be used for pricing an option or determining implied volatility, with the Black Scholes model.
- 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
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
-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