Black Derman Toy model tree error

조회 수: 3 (최근 30일)
SBC
SBC 2019년 7월 25일
댓글: SBC 2019년 9월 3일
clc; clear all
%Connect to Bloomberg
c = blp;
c.DataReturnFormat = 'table';
% Variables
startdate = 'Jul-25-2019';
enddates = datemnth(startdate,6:6:60)';
% Interpolate the curve and create a rate spec
curvedata = getdata(c,'YCGT0025 Index','curve_tenor_rates');
maturitydates = getdata(c, curvedata.curve_tenor_rates{1,1}.TenorTicker,'maturity');
rates = spline(maturitydates.maturity(1:8,1),curvedata.curve_tenor_rates{1,1}.BidYield(1:8,1)/100,enddates);
ratespec = intenvset('ValuationDate',startdate,'StartDates',startdate,...
'EndDates',enddates,'Rates',rates);
% Calculate Volatility
volatility = rates(2:end)./rates(1:end-1)/2;
volatility = [volatility(1);volatility(:)];
%volatility = mean(volatility) * ones(size(volatility))
% Create the time and vol specs
vs = bdtvolspec(startdate,enddates,volatility);
ts = bdttimespec(startdate,enddates,2);
bdttree = bdttree(vs,ratespec,ts);
bdttreenew = cvtree(bdttree);
% Gather Bond Info
cpnrate = 0.0225;
settledt = '08/05/2019';
maturity = '08/05/2024';
optiontype = 'call';
strike = 100;
exercisedate = '09/05/2020';
price = 100;
% Compute OAS
OAS = oasbybdt(bdttree,price,cpnrate,settledt,maturity,optiontype,strike,...
exercisedate,'Period',2)
This is the output. However, if we uncomment %volatility = mean(volatility) * ones(size(volatility))... it'll run. However, this makes the assumption that all volatilities are the same, in real life, they are not. I can break this model in many ways, either by changing the number of rates we have, changing the volatility number, or changing the bond in which I'm trying to compute OAS for bond info such as maturity date or exercise date.
--------------------------------------------------- OUTPUT -------------------------------------------------
Warning: Not all cash flows are aligned with the tree. Result will be approximated.
> In checktree (line 292)
In bdtprice (line 85)
In optembndeng (line 141)
In optembndbybdt (line 81)
In oasbytree>finderr (line 86)
In oasbytree>@(x)finderr(x,pricefcn,treefcn,MktPrice,Tree,IsCir,varargin{:}) (line 76)
In fzero (line 303)
In oasbytree>findOAS (line 76)
In oasbytree (line 44)
In oasbybdt (line 69)
In blackdermantoy (line 38)
Warning: Bonds are valued at BDT Tree ValuationDate rather than Settle
> In bondbybdt (line 193)
In bdtprice (line 161)
In optembndeng (line 141)
In optembndbybdt (line 81)
In oasbytree>finderr (line 86)
In oasbytree>@(x)finderr(x,pricefcn,treefcn,MktPrice,Tree,IsCir,varargin{:}) (line 76)
In fzero (line 303)
In oasbytree>findOAS (line 76)
In oasbytree (line 44)
In oasbybdt (line 69)
In blackdermantoy (line 38)
Warning: OptBonds are valued at BDT Tree ValuationDate rather than Settle
> In optbndbybdt (line 100)
In bdtprice (line 442)
In optembndeng (line 141)
In optembndbybdt (line 81)
In oasbytree>finderr (line 86)
In oasbytree>@(x)finderr(x,pricefcn,treefcn,MktPrice,Tree,IsCir,varargin{:}) (line 76)
In fzero (line 303)
In oasbytree>findOAS (line 76)
In oasbytree (line 44)
In oasbybdt (line 69)
In blackdermantoy (line 38)
Error using bdttree (line 135)
Tree building failed to converge for level 3 of BDT Tree
Error in oasbytree>shiftTreeRateSpec (line 95)
ShiftedTree = treefcn(Tree.VolSpec, RS, Tree.TimeSpec);
Error in oasbytree>finderr (line 85)
NewTree = shiftTreeRateSpec(Tree, treefcn, x);
Error in oasbytree>@(x)finderr(x,pricefcn,treefcn,MktPrice,Tree,IsCir,varargin{:}) (line 76)
[oas,err,exitflag] = fzero(@(x) finderr(x, pricefcn, treefcn, MktPrice, Tree, IsCir, varargin{:}), 0, o);
Error in fzero (line 363)
a = x - dx; fa = FunFcn(a,varargin{:});
Error in oasbytree>findOAS (line 76)
[oas,err,exitflag] = fzero(@(x) finderr(x, pricefcn, treefcn, MktPrice, Tree, IsCir, varargin{:}), 0, o);
Error in oasbytree (line 44)
[oas(idx), err(idx)] = findOAS(pricefcn, treefcn, MktPrice(idx), Tree, invars{:});
Error in oasbybdt (line 69)
[oas, oad, oac, err] = oasbytree(BDTTree, MktPrice, varargin{:});
Error in blackdermantoy (line 38)
OAS = oasbybdt(bdttree,price,cpnrate,settledt,maturity,optiontype,strike,...
Here is the Bloomberg data. Basically the 2M-treasury to the 30-year treasury. Get maturity dates and bid rates for each treasury then interpolate a curve simiannually between the 2M - 30Y treasury. In the code above we limit the interpolation(spline) to the 5y maturity. So, that give us 10 rates. We have 10 end dates, and 10 vol numbers. A tree is created and OAS should be computed. We aren't sure where the issue is happening.
BID yields from the treasury 1m, 2m, 3m, 6m, 1y, 2y, 3y, 5y, 7y, 10y, 30y
2.09500000000000
2.15700000000000
2.10800000000000
2.09000000000000
1.98800000000000
1.86800000000000
1.83400000000000
1.86200000000000
1.96000000000000
2.08400000000000
2.61000000000000

채택된 답변

Mayeda Reyes-Kattar
Mayeda Reyes-Kattar 2019년 8월 30일
The issue is basically that the initial rates in the curve are low. The rates are shifted during the iterative process for finding the OAS, and one of the shifts ends up setting the rates in the negative territory. BDT does not work with negative rates, which makes the creation of the trees impossible.
I would recommend to use a different model like Black-Karasinski (BK) or a model that will tolerate negative rates, such as Hull-White (HW).
  댓글 수: 1
SBC
SBC 2019년 9월 3일
That's exactly the information we were looking for. Many derivative models are broken by negative interest rates, which is now a real possibility in the United States.
Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Price Fixed-Income Instruments에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by