https://github.com/arsalan0c/optionspricing
Price an option or determine implied volatility with the Black Scholes model
https://github.com/arsalan0c/optionspricing
Last synced: 6 months ago
JSON representation
Price an option or determine implied volatility with the Black Scholes model
- Host: GitHub
- URL: https://github.com/arsalan0c/optionspricing
- Owner: arsalan0c
- Created: 2018-08-16T14:42:32.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-29T01:09:45.000Z (almost 7 years ago)
- Last Synced: 2024-10-25T08:18:06.072Z (7 months ago)
- Language: Python
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```bash
python3 BlackScholes.py -ot put -s 10 -x 10 -r 0.0.1 -v 0.3 -t 0.25
```
Call option implied volatility:
```bash
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```