All problems
Binomial American Option Step
Problem
Take one backward-induction step for an American put in a binomial tree.
With up and down factors u, d, risk-neutral probability p, rate r, and step dt, the continuation value is exp(-r * dt) * (p * max(K - S * u, 0) + (1 - p) * max(K - S * d, 0)) and the exercise value is max(K - S, 0). Return [exercise, continuation, max(exercise, continuation)].
Hint
Early exercise has value when the immediate payoff exceeds the discounted continuation.
Test cases
case 1
in: [100,100,1.1,0.9,0.05,1,0.5]
expected: [0,4.75614712250357,4.75614712250357]
case 2
in: [80,100,1.1,0.9,0.05,1,0.5]
expected: [20,19.02458849001428,20]
case 3
in: [120,100,1.1,0.9,0.05,1,0.5]
expected: [0,0,0]
Starter codePython
def binomial_american_step(S, K, u, d, r, dt, p):
# Returns [exercise, continuation, value]
# Your code here
pass3 test cases · run your code against them in the editor