#127 Bond Yield calculation for short maturity bonds

pending
nobody
None
5
2011-07-19
2010-11-23
Anonymous
No

Source file: bond.cpp

Discussion


  • Anonymous
    2010-11-23

    Rate Bond::yield(const DayCounter& dc,
    Compounding comp,
    Frequency freq,
    Real accuracy,
    Size maxEvaluations) const {
    Real currentNotional = notional(settlementDate());
    if (currentNotional == 0.0)
    return 0.0;

    return BondFunctions::yield(*this, cleanPrice(), dc, comp, freq,
    settlementDate(),
    accuracy, maxEvaluations);
    }

    In the above function:
    Real currentNotional = notional(settlementDate());
    should be
    Real currentNotional = notional(settlementDate(settlement));
    else it will always return yield=0 if settlement < maturity date. this is observed for short maturity bonds.

     
  • Luigi Ballabio
    Luigi Ballabio
    2011-07-19

    You mean that the settlement should be an additional argument? That would not be feasible, since the clean price should be calculated at the same date. Also, I'm not sure that you really meant with "when settlement < maturity date", since the settlement cannot be later than the maturity. Do you have some code that reproduces the problem?

     
  • Luigi Ballabio
    Luigi Ballabio
    2011-07-19

    • status: open --> pending