简体   繁体   中英

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. 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.

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.
  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.

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

My Matlab Code is:

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. 1979. "Option Pricing: A Simplified Approach." Journal of Financial Economics 7: 229-263.

  • E. Georgiadis, "Binomial Options Pricing Has No Closed-Form Solution". Algorithmic Finance Forthcoming (2011).

  • Richard J. Rendleman, Jr. and Brit J. Bartter. 1979. "Two-State Option Pricing". Journal of Finance 24: 1093-1110. 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.

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 . (At least a reasonable value to be interpreted as probability!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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