An open API service indexing awesome lists of open source software.

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

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```