Enumerating Price Paths in a Binomial Tree
Summary
The document concerns generating every sequence of up and down moves in a binomial price tree, motivated by pricing exotic options. It shows a tree construction that produces recombining node prices, then gives an alternative based on forming all length-three combinations of up and down multipliers.
Each sequence represents one possible path, and applying its moves successively to the starting price yields the prices along that path. This is a direct enumeration method, useful when an exotic payoff depends on the route taken rather than only the terminal node. The example is limited to a small tree and provides no discussion of computational cost, probability weighting, or how to value a path-dependent payoff. The number of paths grows exponentially with the number of steps, so full enumeration may become impractical for large trees.
Key ideas
- A recombining binomial tree stores shared price nodes, while path enumeration retains each distinct move sequence.
- All possible paths can be generated by taking products of the up and down moves over the chosen number of steps.
- Multiplying the successive moves by the starting price reconstructs the prices along each path.
- Explicit path generation is relevant when an exotic option payoff depends on the sequence of prices.
- The example does not address probability assignment or scaling to large trees.
Tags
Full text
# How to get all the paths of a binomial tree
# How to get all the paths of a binomial tree
I'm trying to implement a pricing method for exotic options based on binomial tree's. The problem i'm having is that i'm not being able to generate all the paths of the tree. I have the following code in python that generates the tree but haven't been able to extract all the paths from it.
```
import numpy as np
risk_free = 0.1
spot = 50
volatility = 0.4
T = 3/12
steps = 3
dt = T/steps
Up = np.exp(volatility*np.sqrt(dt))
Down = 1 / Up
p = (np.exp(risk_free*dt)-Down)/(Up-Down)
q = 1-p
dpowers = Down ** np.arange(steps,-1,-1)
upowers = Up ** np.arange(0,steps+1)
# steps + 1 because at the end we have steps + 1 prices
W = spot*dpowers*upowers
# backward valuation
for i in np.arange(steps, 0,-1):
Si = spot*dpowers[(steps-i+1):steps+1]*upowers[0:i]
W = np.vstack((np.append(np.repeat(0,steps-i+1),Si),W))
Tree = W.T
```
## Answer by Bob Jansen (score 0, accepted)
https://quant.stackexchange.com/a/53588
You can create all the moves you want with the following code, (taken from StackOverflow):
```
import itertools
import numpy as np
risk_free = 0.1
spot = 50
volatility = 0.4
T = 3/12
steps = 3
dt = T/steps
Up = np.exp(volatility*np.sqrt(dt))
Down = 1 / Up
paths = itertools.product([Up, Down], repeat=steps)
```
You can just loop over this list of list and multiply the current price to get the next price.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.