Evaluation date

classic Classic list List threaded Threaded
3 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.)
the side effect alone would have me to agree :)

>Thoughts?
why don't you post to the user list too? I guess we might receive
worthwhile suggestions.

ciao -- Nando




Reply | Threaded
Open this post in threaded view
|

Re: Evaluation date

Nicolas Di Césaré
Le lun 30/08/2004 à 18:51, Ferdinando Ametrano a écrit :

> 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

I am also agree.

--
Nicolas Di Césaré <[hidden email]>