Evaluation date

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Evaluation date

Luigi Ballabio-2
Hi all,
        a few functions/methods need to know which date it is, or which  
date it is supposed to be for calculation purposes---e.g., a LIBOR  
index needs to know today's date in order to know whether it should  
forecast or look for past fixings; and when adding two Money instances  
with different currencies, the current date must be known in order to  
look up the correct exchange rate.  In the former case, the date  
returned by index.termStructure().todaysDate() is used (which, as Nando  
pointed out to me, is not fully satisfactory;) in the latter case,  
Date::todaysDate() is used (which is even less satisfactory.)

Instead, I'd create some kind of singleton Settings class through which  
the  global evaluation date can be set and retrieved, as in

Settings::instance().evaluationDate() = Date(30,August,2004);
Date d = Settings::instance().evaluationDate()

The stored date would be used whenever one needs to know what day it's
supposed to be, and the actual today's date would be returned if none  
was set.  (As a side effect, todaysDate() would eventually disappear  
from TermStructure.)

Thoughts?

Later,
        Luigi


Reply | Threaded
Open this post in threaded view
|

Re: Evaluation date

Ferdinando M. Ametrano-3
Hi Luigi

>I'd create some kind of singleton Settings class through which
>the global evaluation date can be set and retrieved, as in
>
>Settings::instance().evaluationDate() = Date(30,August,2004);
>Date d = Settings::instance().evaluationDate()
>
>The stored date would be used whenever one needs to know what day it's
>supposed to be, and the actual today's date would be returned if none
>was set.
I agree.

>  (As a side effect, todaysDate() would eventually disappear
>from TermStructure.)
this side effect alone could force me to agree :)

I wonder about different approaches used by good derivatives
system/library. Does anyone want to share their experience?

ciao -- Nando