Amortizing Swap error Valuation Matlab 2012a

2 views (last 30 days)
Javier on 1 Sep 2012
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
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' ...
2)Swap Characteristics
Settle='01-Jun-2005'; %Settle in one year from now
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.
[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.

Answers (0)

Community Treasure Hunt

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

Start Hunting!