bdttree - Tree building failed to converge for level 5 of BDT Tree
Ältere Kommentare anzeigen
I am trying to build a 5-year BDT tree (monthly step) using bdttree function. The risk free rate and volatility assumptions are in the attached file. I am getting a warning saying "Tree building failed to converge for level 5 of BDT Tree". If I use quarterly step, there is no problem. However, I have to use monthly step to capture optionality of the instrument I am trying to value, but it does not work. I have pasted my code below. Could anyone help me understand what the problem is and how to fix it? Thanks!
if true
% code
%%Contractual Terms
valDate = datenum('4/13/2017');
IssueDate = datenum('4/13/2017');
FirstCouponDate = datenum('5/5/2017');
MaturityDate = datenum('4/13/2022');
freq = 12;
%%Risk-free rates & Vols
data = csvread('bdttree inputs.csv',1,0);
data_rates = data(:,2)/100;
data_vols = data(:,3)/100;
data_term = data(:,1);
data_rates = freq*((1+data_rates).^(1/freq)-1);
%%Construct BDT tree
bdtDates = cfdates(valDate, MaturityDate, freq, 1,1,IssueDate,FirstCouponDate)';
t = yearfrac(valDate,bdtDates,1);
Rates = interp1(data_term, data_rates, t,'linear');
Vols = spline(data_term, data_vols, t);
BDTVolSpec = bdtvolspec(valDate, bdtDates, Vols);
RateSpec = intenvset('Compounding', freq,...
'ValuationDate', valDate,...
'StartDates', valDate,...
'EndDates', bdtDates,...
'Rates', Rates);
BDTTimeSpec = bdttimespec(valDate, bdtDates, freq);
BDTTree = bdttree(BDTVolSpec, RateSpec, BDTTimeSpec);
end
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Dates and Time finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!