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

https://github.com/brayvid/option-pricing

Prices financial options using a multi-period binary tree model.
https://github.com/brayvid/option-pricing

binary-tree finance option-trading

Last synced: 3 months ago
JSON representation

Prices financial options using a multi-period binary tree model.

Awesome Lists containing this project

README

          

# Multi-Period Binomial Option Pricing

A set of MATLAB functions for calculating option prices, along with several examples of how the functions can be used.

Developed from theory presented in [Option Trading](http://a.co/d/b3Ki7BV "Option Trading at Amazon.com") by Euan Sinclair.

The function "permn.m" is copyright (c) 2016, Jos van der Geest: [permn - Mathworks.com](https://www.mathworks.com/matlabcentral/fileexchange/7147-permn-v-n-k "https://www.mathworks.com/matlabcentral/fileexchange/7147-permn-v-n-k").

### Initialization
```matlab
clear
clc
addpath(genpath('functions'))
```

### Adjusting parameters

```matlab
r = 0.03; % override defaults
sigma = 0.28;
run loadParams % run after setting parameters
```
```console
parameters =

6×1 table

Parameters
__________

periods 3
time 1
spot 100
strike 100
rate 0.03
sigma 0.28
```

### Example queries

```matlab
opt_tod = optionToday(o_prm, call);
fprintf('Call today:\n\n')
disp(opt_tod)
```
```console
Call today:

13.4163
```

```matlab
put_tod = optionToday(o_prm, put);
fprintf('Put today:\n\n')
disp(put_tod)
```
```console
Put today:

10.4609
```

```matlab
asset_tr = assetTree(s_prm);
fprintf('Asset tree:\n\n')
disp(asset_tr)
```
```console
Asset tree:

100.0000 117.5458 138.1702 162.4133
0 85.0732 100.0000 117.5458
0 0 100.0000 117.5458
0 0 72.3745 85.0732
0 0 0 117.5458
0 0 0 85.0732
0 0 0 85.0732
0 0 0 61.5713

```
*Trees are organized so that the element (i,j) in row i and column j branches into elements (2*i,j+1) and (2*i-1,j+1). Elements with i > 2^(j-1) are unused and ignored.*

### Example plots
![](/ExamplePlot.png)
*Call and put values plotted against a varying risk-free rate, strike price and spot price. Generated by ExamplePlot.m.*