简体   繁体   English

我的Matlab代码是否正确实现了该给定算法?

[英]Is my Matlab code correctly implementing this given algorithm?

I am getting some wrong results and I couldn't locate any mistake in my code, so I was thinking if any of you can figure out if I am implementing this Binomial-Lattice algorithm correctly or not. 我得到了一些错误的结果,而且我在代码中找不到任何错误,因此我在考虑是否有人可以确定我是否正确实现了此Binomial-Lattice算法。 Here's what I am getting as results and what I expect from as my results: 这是我得到的结果以及期望得到的结果:

Actual Results: I start with [S0,K,sigma,r,T,nColumn]=[1.5295e+009,6e+008,0.0023,0.12,20,15] and I get p=32.5955 , price=-6.0e+18 and BLOV_lattice as shown in figure 1. 实际结果:我从[S0,K,sigma,r,T,nColumn]=[1.5295e+009,6e+008,0.0023,0.12,20,15] ,我得到p=32.5955price=-6.0e+18BLOV_lattice如图1所示。

Expected Results: 预期成绩:

  1. p is probability, so it should not be greater than 1. Even if I increase the nColumn to 1000, still the p is greater than 1 in the above actual results. p是概率,因此它不应大于1。即使我将nColumn增加到1000,在上述实际结果中p仍大于1。
  2. price should come out to be same as S0 , the number I start with in the first column, after backward induction ie there should be backwards-compatibility. price应与S0相同,即我在第一列中的数字,即向后归纳后,即应该具有向后兼容性。

Figure 1: BLOV_lattice 图1:BLOV_lattice 在此处输入图片说明

My Matlab Code is: 我的Matlab代码是:

function [price,BLOV_lattice]=BLOV_general(S0,K,sigma,r,T,nColumn)

% BLOV stands for Binomial Lattice Option Valuation

%% Constant parameters
del_T=T./nColumn; % where n is the number of columns in binomial lattice
u=exp(sigma.*sqrt(del_T));
d=1./u;
p=(exp(r.*del_T)-d)./(u-d);
a=exp(-r.*del_T);

%% Initializing the lattice
Stree=zeros(nColumn+1,nColumn+1);
BLOV_lattice=zeros(nColumn+1,nColumn+1);

%% Developing the lattice

%# Forward induction

for i=0:nColumn
    for j=0:i
        Stree(j+1,i+1)=S0.*(u.^j)*(d.^(i-j));
    end
end
for i=0:nColumn
    BLOV_lattice(i+1,nColumn+1)=max(Stree(i+1,nColumn+1)-K,0);
end

%# Backward induction

for i=nColumn:-1:1
    for j=0:i-1
        BLOV_lattice(j+1,i)=a.*(((1-p).*BLOV_lattice(j+1,i+1))+(p.*BLOV_lattice(j+2,i+1)));
    end
end
price=BLOV_lattice(1,1);

%% Converting the lattice of upper traingular matrix to a tree format

N = size(BLOV_lattice,1);  %# The size of the rows and columns in BLOV_lattice
BLOV_lattice = full(spdiags(spdiags(BLOV_lattice),(1-N):2:(N-1),zeros(2*N-1,N)));

References: 参考文献:

  • Cox, John C., Stephen A. Ross, and Mark Rubinstein. 考克斯,约翰·C,斯蒂芬·罗斯和马克·鲁宾斯坦。 1979. "Option Pricing: A Simplified Approach." 1979年,“期权定价:一种简化方法”。 Journal of Financial Economics 7: 229-263. 金融经济学杂志7:229-263。

  • E. Georgiadis, "Binomial Options Pricing Has No Closed-Form Solution". E. Georgiadis,“二项期权定价没有封闭式解决方案”。 Algorithmic Finance Forthcoming (2011). 《算法金融学》(2011年)。

  • Richard J. Rendleman, Jr. and Brit J. Bartter. 小理查德·雷德尔曼(Richard J. 1979. "Two-State Option Pricing". 1979年。“两种状态的期权定价”。 Journal of Finance 24: 1093-1110. 金融杂志24:1093-1110。 doi:10.2307/2327237 doi:10.2307 / 2327237

As far as I can see, your formulation of p as p=(exp(r.*del_T)-d)./(ud) is not defined (clearly as such) anywhere in your references. 据我所知,您在引用中的任何地方都没有定义(显然如此)将pp=(exp(r.*del_T)-d)./(ud)

From your code it's not so straightforward to deduce what kind of options you are trying to valuate. 从代码中推断出要评估的选项不是那么简单。

Closest I can get is to interpret that p (in your case) simply boils down to be p= (1- d)/ (u- d) , which with your parameters will be 0.49934 . 我能得到的最接近的解释是p (在您的情况下)简单地归结为p= (1- d)/ (u- d) ,其中您的参数为0.49934 (At least a reasonable value to be interpreted as probability!) (至少一个合理的值可以解释为概率!)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM