|
From: Steve H. <war...@gm...> - 2023-02-13 12:17:37
|
Hi Luigi, Thank you very much for your reply. It does help. Regards, Steve Luigi Ballabio <lui...@gm...> 於 2023年2月13日 週一 下午7:34寫道: > Hello Steve, > when you join two calendars, you can join their holidays (i.e., a day > is a holiday if it is for any of them) or you can join their business days > (i.e., a day is a holiday if it is for both of them). The default is the > first behavior, so date1 is a holiday for the joint calendar because it's a > holiday for cdr2 and date2 because it's a holiday for cdr1. > If you want the opposite behavior, use cdr3=ql.JointCalendar(cdr1,cdr2,ql.JoinBusinessDays) > instead. > > Luigi > > > On Mon, Feb 13, 2023 at 9:45 AM Steve Hsieh <war...@gm...> > wrote: > >> >> Hi all, >> >> I’m doing some study on JointCalendar. >> >> I make two calendar and remove one holiday for each calendar respectively. >> >> Then I make a joint calendar to combine the above calendars. >> >> I use isBusinessDay to check if I can get the desired result. >> >> I find joint calendar doesn’t return the expected result as both >> calendars. >> >> If I am not using JointCalendar correctly? >> >> >> >> >> >> import QuantLib as ql >> >> cdr1=ql.UnitedStates(ql.UnitedStates.LiborImpact) >> >> cdr2=ql.UnitedStates(ql.UnitedStates.Settlement) >> >> date1=ql.Date(11, 2 , 2023) >> >> date2=ql.Date(12, 2 , 2023) >> >> cdr1.removeHoliday(date1) >> >> cdr2.removeHoliday(date2) >> >> cdr3=ql.JointCalendar(cdr1,cdr2) >> >> >> >> print(cdr1.isBusinessDay(date1)) >> >> =>return True >> >> >> >> print(cdr2.isBusinessDay(date2)) >> >> =>return True >> >> >> >> print(cdr3.isBusinessDay(date1)) >> >> =>return False , why ? >> >> >> >> print(cdr3.isBusinessDay(date2)) >> >> =>return Fasle , why ? >> >> >> >> Regards, >> >> Steve >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |