Pricing American Options
Use Matlab to write a computer code which takes as inputs:
• The initial stock price S0
• The payoff function g(ST )
• The interest rate r
• The length of the period h
• The up and down factors u and d
• The number of periods T
and which calculates the American option price as well as the composition of the replicating portfolio at every node of the tree and also determines the optimal exercise dates.
Apply your code to compute the initial value of an American put and an American call with strike K = 10 in a binomial model with r = 0.01, u = erh+0.15 h,
u=exp(r*h+0.15*sqrt(h));
d=exp(r*h-0.15*sqrt(h));
h = 1/365, S0 = 10, and T = 250 periods.