主要内容

Pricing Mortgage Backed Securities Using the Black-Derman-Toy Model

This example illustrates how the Financial Toolbox™ and Financial Instruments Toolbox™ are used to price a level mortgage backed security using the BDT model.

加载存储在数据文件中的BDT树

loadmbsexample.mat

观察利率树

Visualize the interest rate evolution along the tree by looking at the output structureBDTTree.BDTTreereturns an inverse discount tree, which you can convert into an interest-rate tree with theCVTree.function.

BDTTREER = CVTREE(BDTTREE);

看看树的上分支和下分支路径:

OldFormat = get(0,'格式');格式short%Rate at root node:RateRoot = treepath(BDTTreeR.RateTree, 0)
RateRoot = 0.0399
%Rates along upper branch:RatePathUp =.treepath(BDTTreeR.RateTree, [1 1 1 1 1])
RatePathUp =.6×10.0399 0.0397 0.0391 0.0383 0.0373 0.0360
%Rates along lower branch:Raperpathdown =.treepath(BDTTreeR.RateTree, [2 2 2 2 2])
Raperpathdown =.6×10.0399 0.0470 0.0550 0.0638 0.0734 0.0841

Compute the Price Tree for the Non-Prepayable Mortgage

让我们说,我们有三年10000美元的预付贷款,抵押贷款利率为4.64%的半年复合。

mortgageamount = 10000;佣金= 0.0464;期间= 2;安顿='01-Jan-2007'; Maturity='01-Jan-2010'; Compounding = BDTTree.TimeSpec.Compounding; formatbank

使用功能缓冲在金融工具箱™中计算贷款(MP),利息和主要成分以及未偿还的本金余额。

numperiods = date2time(定居,成熟,复合)';[校长,有股,未完成的禁令,MP] =摊销(优惠变换/期间,NumPeriods,MortGageamount);%显示主管,兴趣和未结余额principalamount =Principal'
principalamount =6×11572.59 1609.07 1646.40 1684.601723.68 1763.67
InterestPaymentAmount = InterestPayment'
InterestPaymentAmount =6×1232.00 195.52 158.19 119.99 80.91 40.92
OfferningBalanceamount = OfferentBalance'
OfferningBalanceamount =6×18427.41 6818.34 5171.94 3487.35 1763.67 0.00
CFlowAmounts = MP*ones(1,NumPeriods);%clowdate与树级日期相同CFlowDates= {'01-Jul-2007','01-jan-2008','01-Jul-2008','01-jan-2009','01-Jul-2009','01-Jan-2010'};% Calculate the price of the non-prepayable mortgage[PricenonPrepayableMortgage,pricetreenonprepayablemortgage] = cfbybdt(bdttree,cflowamounts,cflowdates,setten);forinlevel = 2:长度(pricetreenonprepayablemortgage.ptree)pricetreenonprepayablemortgage.ptree {inlevel}(:,:) = pricetreenonprepayablemortgage.ptree {inlevel}(:,) -  mp;end% Look at the price of the mortgage today tObs = 0PriceNonPrepayableMortgage
PriceNonPrepayableMortgage = 10017.47
% The value of the non-prepayable mortgage is $10017.47. This value exceeds自房主收到的10000美元借款,而不仅收到10000美元,而且% also a prepayment option.% Look at the value of the mortgage on the last date, right after the last% mortgage payment, is zero:PriceTreeNonPrepayableMortgage.PTree{end}
ans =1×60 0 0 0 0 0
%可视化非预付抵押贷款的价格树。TreeViewer(pricetreenonprepayablemortgage)

Figure Tree Viewer contains 2 axes objects and other objects of type uicontrol. Axes object 1 contains 63 objects of type line. Axes object 2 is empty.

计算预付选项的价格树

% The Prepayment option is like a call option on a bond.%% The exercise price or strike will be equal to the outstanding principal amount使用函数摊销计算的%。OptSpec ='称呼'; Strike = [MortgageAmount OutstandingBalance]; ExerciseDates =[Settle CFlowDates]; AmericanOpt = 0; Maturity = CFlowDates(end);% Compute the price of the prepayment option:[PricePrepaymentOption,pricetreepaymentOption] = prepaymentbybdt(bdttree,optspec,stress,锻炼,美国经验,...0, Settle, Maturity,[], [], [],...[], [], [], [], 0, [], CFlowAmounts);%看看今天预付款选项的价格(tobs = 0)PricePrepaymentOption.
PricePrepaymentOption.= 17.47
% The value of the prepayment option is $17.47 as expected.% Visualize the price tree for the prepayment optiontreeviewer(PriceTreePrepaymentOption)

Figure Tree Viewer contains 2 axes objects and other objects of type uicontrol. Axes object 1 contains 63 objects of type line. Axes object 2 is empty.

Calculate the Price Tree of the Prepayable Mortgage.

% Compute the price of the prepayable mortgage.PricePrepayableMortgage = PriceNonPrepayableMortgage - PricePrepaymentOption; PriceTreePrepayableMortgage = PriceTreeNonPrepayableMortgage;foriLevel = 1:length(PriceTreeNonPrepayableMortgage.PTree) PriceTreePrepayableMortgage.PTree{iLevel}(:,:)= PriceTreeNonPrepayableMortgage.PTree{iLevel}(:,:) -...PriceTreePrepaymentOption.PTree{iLevel}(:,:);end% Look at the price of the prepayable mortgage today (tObs = 0)PricePrepayableMortgage
PricePrepayableMortgage = 10000.00
% The value of the prepayable mortgage is $10000 as expected.%可视化预付抵押贷款的价格和价格树treeviewer(PriceTreePrepayableMortgage)

Figure Tree Viewer contains 2 axes objects and other objects of type uicontrol. Axes object 1 contains 63 objects of type line. Axes object 2 is empty.

set(0,'格式',oldformat);

See Also

|||||||||||||||||

Related Examples

More About