cir模型matlab代码,怎么用 CIR模型 进行利率定价

在CIR利率定价模型中,哪位知道 以下程序中  的各个参数分别是什么意思 (theta,kappa,sigma,lambda,dt,ratestart,months,tau)?

想要用CIR模型计算  一份以6年期纯贴现债券为标的,执行价格为0.80的两年期欧式看跌期权的价格,零息债券面值假设恒为 100元,相关参数如下:

function [Rt]=RateSimCIR(theta,kappa,sigma,lambda,dt,ratestart,months,tau)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% CIR term structure simulation, inputs below

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% clear all

% theta=0.10;

% kappa=0.05;

% sigma=0.075;

% lambda=-0.4;

% dt=1/12;

% months=120;

% ratestart=0.10;

% tau=[3/12,6/12,2,5];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Short Rate Dynamics

rt(1)=ratestart;

for i=1:months*4

rt(i+1)=rt(i)+kappa*(theta-rt(i))*dt/4+sqrt(rt(i))*sigma*sqrt(dt/4)*randn(1);

end

% Term Structure Dynamics

for i=1:months

rttemp=rt(i*4-3);

rttemp1(i)=rt(i*4-3);

for j=1:numel(tau)

AffineG=sqrt((kappa+lambda)^2+2*sigma^2);

AffineB=2*(exp(AffineG*tau(j))-1)/((AffineG+kappa+lambda)...

*(exp(AffineG*tau(j))-1)+2*AffineG);

AffineA=2*kappa*theta/(sigma^2)*log(2*AffineG*...

exp((AffineG+kappa+lambda)*tau(j)/2)/((AffineG+kappa+lambda)*...

(exp(AffineG*tau(j))-1)+2*AffineG));

A(j)=-AffineA/tau(j);

B(j)=AffineB/tau(j);

Rt(i,j)=A(j)+B(j)*rttemp;

end

end

Rt;

00.jpg

(4.45 KB, 下载次数: 2)

2015-4-14 13:52 上传

442a53943febe9465fc072b4fbe10813.gif

b2a5a3e0dcc7d508e00275fe42fce1b5.gif

65aa00eab73bcdaf7e84b27d5156eaa1.png

你可能感兴趣的:(cir模型matlab代码)