|
From: Luigi B. <lui...@gm...> - 2021-06-01 09:32:32
|
Hello,
instances of the same calendar share the added holidays. The rationale
is that, when a new holiday is announced (for instance, next year's
Platinum Jubilee in the UK) it's possible to add it to the relevant
calendar just once at initialization instead of having to do it for each
instance.
If you want a particular calendar instance detached from all others, you
can use the BespokeCalendar class, but in that case you'll start from a
calendar without holidays and you'll have to add the whole list of them
manually. You can do something like this:
obj2 = ql.BespokeCalendar("mycalendar")
obj2.addWeekday(ql.Saturday)
obj2.addWeekday(ql.Sunday)
for d in TARGET().holidayList(start_date, end_date):
obj2.add(d)
obj2.add(my_new_holiday1)
obj2.add(my_new_holiday2)
Hope this helps,
Luigi
On Tue, Jun 1, 2021 at 12:07 AM HANISH SHARMA <han...@gm...>
wrote:
> Hello,
>
> Greetings,
>
> I have a question regarding the TARGET class.
> I have created 2 instances of the target class "obj" and "obj2".
> After this, I added 2 holidays in obj2 instance using addHoliday().
>
> Now, if I print the holidayList of both the instances, I get the same
> result ie 2 added holidays in the holiday list of obj as well.
> PFB the code snippet and output:
> [image: image.png]
> [image: image.png]
>
> Why is the output of obj.holidayList contains the holidays added in obj2
> instance?
>
> How can I get the holidaylist of obj exclusive to obj ie holidays added in
> other instances do not become the part obj's holidaylist.
>
> Thank you in advance.
>
> Regards
> Hanish Sharma
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|