help with amortizing notionals

Posted by japari on
URL: http://quantlib.414.s1.nabble.com/help-with-amortizing-notionals-tp12260.html


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