Re: help with amortizing notionals

Posted by Simon Ibbotson on
URL: http://quantlib.414.s1.nabble.com/help-with-amortizing-notionals-tp12260p12262.html

Hi Pepe,
 
I'm afraid that I'm on holiday at the moment - won't be back at my desk for about 10 days. Also, after I wrote the code, Luigi did some modifications - so I can't be certain that the code in the library will work.
As the code that uses a simple sinking schedule also doesn't work (and therefore has nothing to do with how you've input the notional schedule) I'd guess that there is a problem with the code.
Can you send me the full file - I can't get to the repository on this PC?
Thanks,
Simon

On Wed, Nov 5, 2008 at 7:01 AM, Jose Aparicio-Navarro <[hidden email]> wrote:

Hi all, I am failing to create an amortizing notional bond schedule and I am not
sure whether I am misinterpreting the way I have to pass the data or a REQUIRE
is written with the test condition in the reverse direction.

I create the bond:

   DayCounter dayCtr = ActualActual();

   Real bondFaceVal = 1000000.0;
   Real redemption  = 100.0;
   Date bondMaturity(todaysDate + Period(3, Years));

   Schedule scheFix(todaysDate,
                    bondMaturity,
                    Period(3,TimeUnit::Months),
                    TARGET(),
                    ModifiedFollowing,
                    ModifiedFollowing,
                    DateGeneration::Backward,
                    false);

   std::vector<Real> notionls(5, bondFaceVal);
   notionls.insert(notionls.end(), 4, bondFaceVal/10.);
   notionls.insert(notionls.end(), 4, bondFaceVal/100.);

   boost::shared_ptr<AmortizingFixedRateBond> amortFix(
     new AmortizingFixedRateBond(0,
       notionls, scheFix, std::vector<Rate>(1, 0.05),
       dayCtr, ModifiedFollowing,
       std::vector<Real>(1, 100.)));


I fail the REQUIRE (line 508 in bond.cpp) at the second notional insertion in

void Bond::calculateNotionalsFromCashflows()


When constructing the bond with a sinking freq I get the same test failure:

   boost::shared_ptr<AmortizingFixedRateBond> amortFix(
     new AmortizingFixedRateBond(0,
       TARGET(), bondFaceVal, todaysDate,
       Period(3, Months), Frequency::Monthly, 0.05,
       dayCtr, ModifiedFollowing, todaysDate));


Regards
Pepe



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev