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.
- Host: GitHub
- URL: https://github.com/brayvid/option-pricing
- Owner: brayvid
- Created: 2018-12-09T01:39:08.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-17T01:21:13.000Z (almost 7 years ago)
- Last Synced: 2025-02-28T22:19:36.336Z (7 months ago)
- Topics: binary-tree, finance, option-trading
- Language: MATLAB
- Homepage:
- Size: 829 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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

*Call and put values plotted against a varying risk-free rate, strike price and spot price. Generated by ExamplePlot.m.*