|
From: jian Xu <jia...@gm...> - 2022-03-02 15:11:48
|
OK, I found out the answer. Basically, by checking
>>> calendar.isBusinessDay(ql.Date(30, 3, 2018))
False
I can see that the effective date 2018-03-29 (Thursday) is indeed an
"end of month". This is because 2018-03-30 (Friday) is a Good Friday.
So everything makes sense. Thanks.
Jian
On Wed, Mar 2, 2022 at 12:07 AM jian Xu <jia...@gm...> wrote:
>
> Hi,
> I'm confused by the "endOfMonth" setting. The document says:
> ```
> endOfMonth : If the start date is at the end of the month, whether
> other dates are required to be scheduled at the end of the month
> (except the last date).
> ```
>
> So my understanding is that if the start date is NOT the end of the
> month, then this setting doesn't matter. (is this correct?)
>
> However, it does matter in the following example. As the input
> suggests, I expect the first date in the schedule should be 2018-03-29
> (Thursday, NOT end of the month). However, I only get this result
> when I set endOfMonth=False. If I set it to true, the first date in
> the schedule will be 2018-03-31 (Saturday). Why?
>
> Thanks a lot.
>
> import QuantLib as ql
> calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond)
> schedule = ql.MakeSchedule(effectiveDate=ql.Date(29,3,2018),
> terminationDate=ql.Date(29, 3, 2021),
> tenor=ql.Period("3M"),
> calendar=calendar,
> convention=ql.Unadjusted,
> terminalDateConvention=ql.Unadjusted,
> rule=ql.DateGeneration.Forward,
> endOfMonth=True,
> firstDate=ql.Date(29, 6, 2018),
> nextToLastDate=ql.Date())
>
> print(schedule[0])
|