⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 brownianbridge.m

📁 An example case is considered to price an option at a maturity of T years - prices are simulated for
💻 M
字号:
clear all;
global sigma;

%demonstrates simulation of Brownian bridge 
%an example case is considered to price an option at a maturity
%MC is used to simulate prices for 2*T maturity 
%and brownian bridge is used to obtain prices at T maturity
%finally option prices are compared to BS values to verify results

%%%%%%%%% parameters setting  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
S0=100; %underlying price 1
K=98; %strike
T=1; %maturity
sigma=0.125; %volatility
r=0.08; %risk free rate
nsimulations=100000;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function Wt=GetBridgeValue(t1,Wt1,t2,Wt2,t,n)
	global sigma;
	Wt_mean=((t2-t)*Wt1+(t-t1)*Wt2)/(t2-t1);
	Wt_var=(t2-t)*(t-t1)/(t2-t1);
	Wt=Wt_mean+sigma*Wt_var^0.5*randn(n,1);
endfunction


Wt1=zeros(nsimulations,1);

% simulate stock process for T*2
tmpT=T*2;
vsqrdt=sigma*tmpT^0.5;
drift=(r-sigma^2/2)*tmpT;
Wt2=drift+vsqrdt*randn(nsimulations,1);

%get stock prices for T maturity using Brownian bridge
Wt=GetBridgeValue(0,Wt1,tmpT,Wt2,T,nsimulations);

%verify result with BS values
St=S0.*exp(Wt);
payoffvec=max(St-K,0);
MC_callprice=exp(-r*T)*mean(payoffvec)
analytical_price=BlackScholesPrice('c',S0,K,T,r,sigma)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -