贴一个最简单的欧式期权的定价程序,matlab写的
% BlsMC.m
function [Price,CI]=BlsMC(S0,X,r,T,sigma,NRepl)
nuT=(r-0.5*sigma^2)*T;
siT=sigma*sqrt(T);
DiscPayoff=exp(-r*T)*max(0,S0*exp(nuT+siT*randn(NRepl,1))-X);
[Price,VarPrice,CI]=normfit(DiscPayoff);
Let us price a European call with initial,asset price S(0)=$50,strike price X=52,expiring in five months,when the annual,risk-free rate is 10% and the volatility is 40%
>>randn('seed',0)
>>[price,CI]=BlsMC(50,52,0.1,5/12,0.4,1000)
>> price=5.4445,CI=4.8776 6.0115
>>randn('seed',0)
>>[price,CI]=BlsMC(50,52,0.1,5/12,0.4,200000)
>> price=5.1780,CI=5.1393 5.2167
其实不一定模拟期权,只要是路径的模拟,都可以用Monte Carlo法,比如利率的期限结构