[ quantlib-Bugs-3116601 ] Bond Yield calculation for short maturity bonds

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Bugs-3116601 ] Bond Yield calculation for short maturity bonds

SourceForge.net
Bugs item #3116601, was opened at 2010-11-23 15:01
Message generated for change (Comment added) made by lballabio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3116601&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Pending
Resolution: None
Priority: 5
Private: No
Submitted By: https://www.google.com/accounts ()
Assigned to: Nobody/Anonymous (nobody)
Summary: Bond Yield calculation for short maturity bonds

Initial Comment:
Source file: bond.cpp

----------------------------------------------------------------------

>Comment By: Luigi Ballabio (lballabio)
Date: 2011-07-19 14:59

Message:
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?


----------------------------------------------------------------------

Comment By: https://www.google.com/accounts ()
Date: 2010-11-23 15:03

Message:
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.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3116601&group_id=12740

------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev