Calendar with custom set holidays and name

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

Calendar with custom set holidays and name

Henner Heck

Hello all,

i am trying to create a Calendar in QuantLib 1.0.1 which contains
no holidays except the weekends and has a name provided by
me after finishing with the constructor.
When i have this "plain" calendar, i assume i can add holidays
with "void addHoliday(const Date&);". In the end i want to have
a calendar, which replies "true" on "isBusinessDay(const Date&)"
only on weekends and on the dates which i previously added.

I looked through the calendars, but until now i haven't found this  
behavior.
Am i not thorough enough or is it not provided at the moment?

Best regards,
Henner Heck

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Calendar with custom set holidays and name

Luigi Ballabio
On Fri, 2010-12-17 at 18:43 +0100, Henner Heck wrote:
> i am trying to create a Calendar in QuantLib 1.0.1 which contains
> no holidays except the weekends and has a name provided by
> me after finishing with the constructor.
> When i have this "plain" calendar, i assume i can add holidays
> with "void addHoliday(const Date&);". In the end i want to have
> a calendar, which replies "true" on "isBusinessDay(const Date&)"
> only on weekends and on the dates which i previously added.

Look in <ql/time/calendars/bespokecalendar.hpp>.

Luigi


--

A little inaccuracy sometimes saves tons of explanation.
-- H.H. Munro, "Saki"



------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Calendar with custom set holidays and name

Henner Heck
Am 20.12.2010, 10:16 Uhr, schrieb Luigi Ballabio  
<[hidden email]>:

> On Fri, 2010-12-17 at 18:43 +0100, Henner Heck wrote:
>> i am trying to create a Calendar in QuantLib 1.0.1 which contains
>> no holidays except the weekends and has a name provided by
>> me after finishing with the constructor.
>> When i have this "plain" calendar, i assume i can add holidays
>> with "void addHoliday(const Date&);". In the end i want to have
>> a calendar, which replies "true" on "isBusinessDay(const Date&)"
>> only on weekends and on the dates which i previously added.

>
> Look in <ql/time/calendars/bespokecalendar.hpp>.
>
> Luigi
>
>

Hello
and thank you for the hint,
although it seems to me that BespokeCalendar
bases it's isBusinessDay() and therefore also
it's isHoliday() on the weekday of a date alone:

<bespokecalendar.cpp, line 36>
bool BespokeCalendar::Impl::isBusinessDay(const Date& date) const {
         return !isWeekend(date.weekday());
     }

So e.g. every Monday or every Wednesday would appear as a  
holiday/businessday,
but not just specific days defined by year;month;day, or am i wrong on  
this?

Best regards,
Henner Heck

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Calendar with custom set holidays and name

Luigi Ballabio
On Mon, 2010-12-20 at 15:20 +0100, Henner Heck wrote:

> [...] it seems to me that BespokeCalendar
> bases it's isBusinessDay() and therefore also
> it's isHoliday() on the weekday of a date alone:
>
> <bespokecalendar.cpp, line 36>
> bool BespokeCalendar::Impl::isBusinessDay(const Date& date) const {
>          return !isWeekend(date.weekday());
>      }
>
> So e.g. every Monday or every Wednesday would appear as a  
> holiday/businessday,
> but not just specific days defined by year;month;day, or am i wrong on  
> this?

Right as far as the specific implementation is concerned, but the
Calendar class wraps it with an additional search for the dates you set
with addHoliday, so you'll get those as well.

Luigi



--

Hanlon's Razor:
Never attribute to malice that which is adequately explained
by stupidity.



------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Calendar with custom set holidays and name

Henner Heck

Thank you, i saw the light now.  :)


> Right as far as the specific implementation is concerned, but the
> Calendar class wraps it with an additional search for the dates you set
> with addHoliday, so you'll get those as well.
>
> Luigi

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users