Calendars and the Good Friday exception
Worked examples
Read the claim, then run it and check the machine agrees. One at a time — nothing here is taken on trust.
import QuantLib as ql
usgov = ql.UnitedStates(ql.UnitedStates.GovernmentBond) # SIFMA - drives SOFR
target = ql.TARGET() # eurosystem - drives ESTR
uk = ql.UnitedKingdom() # drives SONIA
gf26, gf27 = ql.Date(3, 4, 2026), ql.Date(26, 3, 2027) # Good Fridays
for name, cal in (("USGOV", usgov), ("TARGET", target), ("UK", uk)):
print(f"{name:6} open Good Friday 2026: {str(cal.isBusinessDay(gf26)):5}"
f" open Good Friday 2027: {cal.isBusinessDay(gf27)}")
2026: the US bond market trades while all of Europe is dark —
April 3 is the first Friday of the month, so the jobs report drops
and SIFMA stays open. 2027: Good Friday falls in March, no report,
and all three calendars agree it's a holiday. Same rule name,
"Good Friday", two different realities — isBusinessDay is the
only opinion that counts.
import QuantLib as ql
target = ql.TARGET()
hols = target.holidayList(ql.Date(1, 1, 2026), ql.Date(31, 12, 2026))
print("TARGET weekday holidays 2026:", [d.ISO() for d in hols])
uk = ql.UnitedKingdom()
mon = ql.Date(28, 12, 2026) # the Monday after Boxing Day (Sat 26 Dec)
print("UK open Mon 28 Dec 2026:", uk.isBusinessDay(mon))
print("TARGET open Mon 28 Dec 2026:", target.isBusinessDay(mon))
Five weekday holidays in TARGET's whole 2026 — and Boxing Day isn't
one of them, because 26 December is a Saturday and a TARGET holiday
landing on a weekend simply disappears (no substitute day). The
UK disagrees: it substitutes the lost holiday to Monday the 28th, so
London is closed on a day Frankfurt settles euros. holidayList is
also your golden-test tool: dump it, diff it against the exchange's
published list, and your calendar is proven for that year rather
than assumed.
Check the concept
One question at a time. Unsure? Revisit the lecture, then answer.
The challenge
Pass the quiz to unlock the challenge — your code will still be waiting here.