簡體   English   中英

我的Matlab代碼是否正確實現了該給定算法?

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

我得到了一些錯誤的結果,而且我在代碼中找不到任何錯誤,因此我在考慮是否有人可以確定我是否正確實現了此Binomial-Lattice算法。 這是我得到的結果以及期望得到的結果:

實際結果:我從[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所示。

預期成績:

  1. p是概率,因此它不應大於1。即使我將nColumn增加到1000,在上述實際結果中p仍大於1。
  2. price應與S0相同,即我在第一列中的數字,即向后歸納后,即應該具有向后兼容性。

圖1:BLOV_lattice 在此處輸入圖片說明

我的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)));

參考文獻:

  • 考克斯,約翰·C,斯蒂芬·羅斯和馬克·魯賓斯坦。 1979年,“期權定價:一種簡化方法”。 金融經濟學雜志7:229-263。

  • E. Georgiadis,“二項期權定價沒有封閉式解決方案”。 《算法金融學》(2011年)。

  • 小理查德·雷德爾曼(Richard J. 1979年。“兩種狀態的期權定價”。 金融雜志24:1093-1110。 doi:10.2307 / 2327237

據我所知,您在引用中的任何地方都沒有定義(顯然如此)將pp=(exp(r.*del_T)-d)./(ud)

從代碼中推斷出要評估的選項不是那么簡單。

我能得到的最接近的解釋是p (在您的情況下)簡單地歸結為p= (1- d)/ (u- d) ,其中您的參數為0.49934 (至少一個合理的值可以解釋為概率!)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM