Amortizing Swap error Valuation Matlab 2012a
1 view (last 30 days)
Show older comments
Hello all
I test the swapbyzero function in Matlab R2012a and find an error compared with Matlab R2009b. The old version do a correct valutaion for amortizing swaps, while the new version do it wrong.
1)RateStructure and Specification
StartDate='01-Jun-2005';
EndDates=['02-Jun-2005';'03-Jun-2005';'06-Jun-2005';'10-Jun-2005' ...
;'01-Jul-2005';'01-Aug-2005';'01-Sep-2005';'01-Oct-2005';'01-Nov-2005';'01-Dec-2005' ...
;'01-Jan-2006';'01-Feb-2006';'01-Mar-2006';'01-Apr-2006';'01-May-2006';'01-Jun-2006' ...
;'01-Jun-2007';'01-Jun-2008';'01-Jun-2009';'01-Jun-2010'];
Rates=[0.0208;0.0208;0.0208;0.0209;0.0209;0.021;ones(10,1)*0.0215;0.0227;0.02441;0.02608;0.02764];
RateSpec=intenvset('Rates',Rates,'StartDates',StartDate,'EndDates',EndDates,'Compounding',1,'Basis',0);
2)Swap Characteristics
Settle='01-Jun-2005'; %Settle in one year from now
Maturity='01-Jun-2009';
Basis=[6 2]; %30/360 for fixed and act/360 for variable
Principal ={{'01-Jun-2006' 10000000;'01-Jun-2007' 8000000;'01-Jun-2008' 6000000;'01-Jun-2009' 4000000}};
LegRate=[NaN 0]; %Present value of swap is zero and spread zero.
LegType=[1 0]; %Fixed=1 and Float=0;
LegReset=[1 2]; %Annual for fixed and semiannual for floating.
3)Pricing
[Price, SwapRate] = swapbyzero(RateSpec, LegRate, Settle,...
Maturity, LegReset, Basis, Principal, LegType) ;
The correct answer is closet to 2.6.
This is the output of an exercise done in "Manual de Instrumentos Derivados" Autor: Roberto Knop 2005 page 204-205.
0 Comments
Answers (0)
See Also
Categories
Find more on Instrument Control Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!