isEndOfMonth

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

isEndOfMonth

Dimathematician

Wouldn't it make sense to add: 

if(!isBusinessDay(d)) return false

If I ask for a holiday, such as the 31st of December for the Frankfurt Stock Exchange
and ask the function if the day isEndOfMonth, I receive true



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: isEndOfMonth

Ferdinando Ametrano-4
On Tue, Sep 1, 2009 at 3:45 PM, Dima<[hidden email]> wrote:
> Wouldn't it make sense to add [to isEndOfMonth]:
> if(!isBusinessDay(d)) return false

no, it doesn't, at least not in general.
E.g. bond maturity date being on a non-business end-of-month day, you
might want all other dates to be end-of-month

> If I ask for a holiday, such as the 31st of December for the Frankfurt Stock
> Exchange
> and ask the function if the day isEndOfMonth, I receive true

so it would up to you to verify both isEndOfMonth and isBusinessDay

ciao -- Nando

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: isEndOfMonth

Luigi Ballabio
In reply to this post by Dimathematician
On Tue, 2009-09-01 at 15:45 +0200, Dima wrote:
> If I ask for a holiday, such as the 31st of December for the Frankfurt
> Stock Exchange
> and ask the function if the day isEndOfMonth, I receive true

You're right. It's fixed now. Thanks for the report.

Luigi


--

Grabel's Law:
2 is not equal to 3 -- not even for large values of 2.



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: isEndOfMonth

Luigi Ballabio
In reply to this post by Ferdinando Ametrano-4
On Tue, 2009-09-01 at 17:58 +0200, Ferdinando Ametrano wrote:
> On Tue, Sep 1, 2009 at 3:45 PM, Dima<[hidden email]> wrote:
> > Wouldn't it make sense to add [to isEndOfMonth]:
> > if(!isBusinessDay(d)) return false
>
> no, it doesn't, at least not in general.

Hmm. Pity I didn't get this mail before committing...

> E.g. bond maturity date being on a non-business end-of-month day, you
> might want all other dates to be end-of-month

But then, _in the schedule constructor_, you would check the maturity
with Date::isEndOfMonth, or adjust the maturity with Preceding and check
that for end-of-month.  The meaning of Calendar::isEndOfMonth shouldn't
depend on the use we want to do of the date, and according to the docs
is "is this the last business day of the month?".

If we decide that the meaning of ifEndOfMonth is "are there any business
days after this?" (which is a different thing) then the implementation
is ok. But in that case we have to change the documentation.

Thoughts?

Luigi


--

There is no likelihood man can ever tap the power of the atom.
-- Robert Millikan, Nobel Prize in Physics, 1923



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev