|
From: Ferdinando A. <qf...@am...> - 2009-04-17 09:31:48
|
Hi Luigi > So basically, you tried to discount to yesterday with the evaluation > date set to today? it is not nonsensical as (you try to make) it sounds, especially in a dynamic environment. I have a session on QuantLibXL with the evaluation date equal to today. I'm asked by the control office to justify a bond price valuation done about 2 months ago. I deserialize the xml files of that bond and its interest rate curve as they were at the time. The yield curve has fixed reference date. The bond clean price fails because of the evaluation date, and it should not since both bond and interest rate curve are coherent. To solve this issue I have to change evaluation date, disrupting my session, or just use a different dedicated session for the control office check. No big deal, but definitely not nice. >> >> E.g. Bond::isExpired check the settlementDate() vs >> >> Settings::instance().evaluationDate(). > > Oh, you mean "it checks the last cash flow against the settlement date, > instead of checking it against the evaluation date". I though you meant > "it compares the settlement date and the evaluation date". Agreed, it > should check the evaluation date. ok, now that at least we agree that it should check the evaluation date, let's try to move ahead one more step. It might check the yield term structure reference date if a pricing engine is set: wouldn't this be better? It would allow to price the bond in the above QuantLibXL example This is the key point you can observe in Revision 16180 (http://quantlib.svn.sourceforge.net/quantlib/?rev=16180&view=rev): isExpired sometime refers to the evaluation date, some other times to the term structure reference date. In my opinion the latter should be the correct, or at least preferred, behavior. While this can be probably patched locally (and I'm mainly interest in the Bond class right now), thinking along this line might lead to conclude that we should add the reference date in Instrument::results, i.e. the date at which value and error estimate have been evaluated. This would make the information set in Instrument::results "complete" and would allow for easy check/use of that reference date. Then the current evaluation date might then just become a fall-back case when the engine is not provided in order to calculate Bond::settlementDate and Bond::accruedAmount I look forward to feedback ciao -- Nando |