American Option Pricing with Tilley’s Path Simulation Algorithm
Summary
The document presents a question about implementing Tilley’s algorithm for pricing American options through simulated asset paths. The shown R approach generates risk-neutral paths, works backward through exercise dates, sorts paths by asset value, estimates continuation values from groups of paths, and compares those values with immediate exercise payoffs. It then uses an exercise indicator to discount and average the realized payoffs.
The post asks for implementation examples and whether the method is widely used, and highlights uncertainty about the exercise-boundary calculation and the matrix tracking first exercise. It provides code but no validated output, correction, or comparison with another pricing method. The implementation should therefore be treated as an attempted example rather than a reliable recipe. The excerpt also does not explain Tilley’s assumptions or establish how the grouping choices affect accuracy, so readers would need further sources to assess convergence and suitability.
Key ideas
- The example simulates risk-neutral asset price paths and evaluates exercise decisions by backward induction.
- Continuation value is estimated by discounting future option values within groups of sorted paths.
- The exercise decision compares immediate payoff with estimated continuation value at each date.
- The author identifies uncertainty about the exercise boundary and first-exercise tracking, and supplies no validated price.
Tags
Full text
# Valuing American Options using Tilley algorithm
# Valuing American Options using Tilley algorithm
Hey I want to implement Tilley's algorithm (Valuing American Options in a Path Simulation Model by JA Tilley, 1993) to price american options. Where can I find implementation of this method in any programming language (Python preferable)? Is this method popular or rather not? I am not good programmer so some ready sources could be helpful.
I tried to do it but my result is wrong. Can anyone look at my code (in R)? I think that something must be wrong with step 6 or $z$ matrix.
```
S0 = 40
r = 0.07
sigma = 0.3
K = 45
n_steps_per_year = 252
dt = 1 / n_steps_per_year
T = 3
n_steps = n_steps_per_year * T
R = n_paths
Q = 70
P = 72
n_paths = P * Q
d = exp(-r * dt)
N = matrix(rnorm(n_paths * n_steps, mean = 0, sd = 1), n_paths, n_steps)
paths_S = matrix(nrow = n_paths, ncol = n_steps + 1, S0)
for(i in 1:n_paths){
for(j in 1:n_steps){
paths_S[i, j + 1] = paths_S[i, j] * exp((r - 0.5 * sigma ^ 2) * dt + sigma * sqrt(dt) * N[i, j])
}
}
I = matrix(nrow = n_paths, ncol = n_steps + 1) # Intristic value matrix
I[, n_steps + 1] = sapply(K - paths_S[, n_steps + 1], max, 0)
V = matrix(nrow = n_paths, ncol = n_steps + 1) # option value matrix
V[, n_steps + 1] = I[, n_steps + 1]
y = matrix(nrow = n_paths, ncol = n_steps + 1)
z = matrix(nrow = n_paths, ncol = n_steps + 1)
H = matrix(nrow = n_paths, ncol = n_steps + 1) # Holding value
# At moment T
for(k in 1:n_paths){
z[k, n_steps + 1] = ifelse(I[k, n_steps + 1] > 0, 1, 0)
}
### Backward-Induction ###
paths_S = as.data.frame(paths_S)
for(t in n_steps:2){
# sorting
o = order(paths_S[, t], decreasing = TRUE)
paths_S = paths_S[o, ]
H = H[o, ]
y = y[o, ]
V = V[o, ]
I = I[o, ]
# Intristic value
I[, t] = sapply(K - paths_S[, t], max, 0)
# holding value
for(k in 1:n_paths){
H[k, t] = d / P * sum(V[(floor((k - 1) / P) * P + 1):(floor((k - 1) / P) * P + P), t + 1])
}
x = as.integer(I[, t] > H[, t])
# Step 6 #
if(max(x) == 0){
k_star = n_paths + 1
}
else{
k_star = which.max(with(rle(x), rep(values * (lengths > c(tail(lengths, - 1), 0)), lengths)))
}
#
# k_star = which.max(with(rle(x), rep(values * (lengths > c(tail(lengths, - 1), 0)), lengths)))
for(k in 1:n_paths){
y[k, t] = ifelse(k >= k_star, 1, 0)
}
# value
for(k in 1:n_paths){
V[k, t] = ifelse(y[k, t] == 1, I[k, t], H[k, t])
}
}
# z matrix
for(k in 1:n_paths){
for(t in 2:(n_steps)){
z[k, t] = ifelse(y[k, t] == 1 & max(y[k, 2:(t - 1)]) == 0, 1, 0)
}
}
sum = 0
for(k in 1:n_paths){
for(t in 2:(n_steps + 1)){
sum = sum + z[k, t] * exp(-r * (t - 1) * dt) * I[k, t]
}
}
price = sum / n_paths
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.