Menu

#46 Error in cashflowvectors if a single cash flow exists

closed-invalid
None
5
2007-11-28
2007-02-09
Anonymous
No

Version: 0.3.14
File: cashflowvectors.cpp

Error if a forward starting bond is created and the start date is Saturday and the maturity date is on the following Monday. SCHEDULE only create one cash flow date. Routines ends with an error on row with
Date start = schedule.date(0), end = schedule.date(1);

My Fix:
int indxend = (schedule.size() <= 1) ? 0 : 1;
Date start = schedule.date(0), end = schedule.date(indxend);

Best regards

Thomas Karlström

EMAIL: thomas.karlstroem@freenet.de

Discussion

  • Luigi Ballabio

    Luigi Ballabio - 2007-11-28
    • assigned_to: nobody --> lballabio
    • status: open --> closed-invalid
     
  • Luigi Ballabio

    Luigi Ballabio - 2007-11-28

    Logged In: YES
    user_id=75450
    Originator: NO

    The behavior is correct---If only one date is given, an error should be launched as the code does not make assumptions (such as the assumption that the given date is to be used twice.)
    If you really want the bond to start on a Saturday, you'll probably want to use the Unadjusted convention when you instantiate the schedule. This will keep both dates and allow you to instantiate the bond.

     

Log in to post a comment.