Jimmy on a random walk
function [C] = BLM(n, S_0, K, u, d, p, T) C = mean(max([mean(cumprod((u-d) .*(rand(n, T) < p) + d,2), 2) * S_0 - K, zeros(n,1)])); end
Fully vectorized for performance.
No comments:
Post a Comment