Tree Models in Finance

Overview


Tree models are used to model the evolution of a stock price or some other time series in a discrete way. Each level of the tree represents a point in time, and each node a sample point at that time. Tree models can generally be classified by how many points are reachable in the next time period from the current node. The standard model is the binary tree, from which two nodes are available from any given node, but other trees are sometimes used as well.

Binomial Tree


The binomial tree is the workhorse of the tree models in finance. This is because it is the simplest tree model, but also because it is the tree model that most closely models the brownian motion used in the continuous time models.

The binomial tree starts at a single node, representing a price or some other variable. Each level of the tree represents a new point in time. At each point in time, the variable being modeled can take one of two values in the next time period.

copy

The generated here used the binomial tree api

Risk Neutral Tree


the binomial tree can be used to value plain vanilla options. This is typically done by calculating risk neutral probabilities, and then calculating an expectation

{% p = (e^{r \Delta t} - d)/ (u - d) %}

where d is the down factor, and u is the up factor.


let bt = await import('/lib/finance/tree-models/binomial/v1.0.0/binomial-tree.mjs');

let r = 0.1;
let u = 2;
let d = 0.5;
let t = 1;
let prob = (Math.exp(r*t) - d)/ (u-d)
let tree = bt.binomial(100, 5, u, d, prob);
let sum = 0;
for(let item of tree[tree.length-1]){
  sum += item.probability * Math.max(0, item.value - 100);			
}
					
Try it!


Contents