|
From: Martin A. <mau...@pe...> - 2025-03-25 12:12:05
|
Hi All,
I am trying to use the new ql.SwapRateHelper.forDates() method.
However, it is not clear to me how it treats the dates for the rate setting
dates. Using the same maturity dates and conventions, I get additional rate
setting dates when using the forDates() method compared to using the
standard method with a tenor. The code snippet below illustrates the case.
Is this behaviour intended?
Thanks,
Martin
Code Snippet:
ql.Settings.instance().evaluationDate = ql.DateParser.parseISO("2024-02-29")
helpers = [
{
"name": "forDates SwapRateHelper",
"swap": ql.SwapRateHelper.forDates(
ql.QuoteHandle(ql.SimpleQuote(2.0 / 100)),
ql.DateParser.parseISO("2024-03-04"),
ql.DateParser.parseISO("2028-03-06"),
ql.TARGET(),
ql.Annual,
ql.ModifiedFollowing,
ql.Thirty360(ql.Thirty360.European),
ql.Euribor6M(),
),
}
]
helpers.append(
{
"name": "forTenor SwapRateHelper",
"swap": ql.SwapRateHelper(
ql.QuoteHandle(ql.SimpleQuote(2.0 / 100)),
ql.Period("4Y"),
ql.TARGET(),
ql.Annual,
ql.ModifiedFollowing,
ql.Thirty360(ql.Thirty360.European),
ql.Euribor6M(),
),
}
)
for helper in helpers:
h = helper["swap"]
s = h.swap()
fixed_leg = s.fixedLeg()
floating_leg = s.floatingLeg()
print(f"\n\n{helper['name']}")
print(f"Start Date: {h.earliestDate()}")
print(f"End Date: {h.maturityDate()}")
print(f"Fixed Leg: ({len(s.fixedLeg())} Dates)")
for leg in fixed_leg:
print(leg.date())
print("------")
print(f"Floating Leg: ({len(s.floatingLeg())} Dates)")
for leg in floating_leg:
print(leg.date())
*Output:*
*forDates SwapRateHelper* Start Date: March 4th, 2024 End Date: March 6th,
2028 Fixed Leg: (5 Dates) March 6th, 2024 March 6th, 2025 March 6th, 2026 March
8th, 2027 March 6th, 2028 ------ Floating Leg: (9 Dates) March 6th,
2024 September
6th, 2024 March 6th, 2025 September 8th, 2025 March 6th, 2026 September
7th, 2026 March 8th, 2027 September 6th, 2027 March 6th, 2028 *forTenor
SwapRateHelper* Start Date: March 4th, 2024 End Date: March 6th, 2028 Fixed
Leg: (4 Dates) March 4th, 2025 March 4th, 2026 March 4th, 2027 March 6th,
2028 ------ Floating Leg: (8 Dates) September 4th, 2024 March 4th,
2025 September
4th, 2025 March 4th, 2026 September 4th, 2026 March 4th, 2027 September
6th, 2027 March 6th, 2028
--
*Martin Aussenhof*
*Head of Solutions*
*E: *ma...@pe...
*T:* +447407401595
*PeerNova, Inc.* *web* <http://peernova.com/> | *x*
<http://x.com/peernovainc> | *li*
<https://www.linkedin.com/company/peernova> | *fb*
<https://www.facebook.com/peernova>
The information transmitted in this email is intended only for the person
or entity it addresses. This email may contain confidential or privileged
information. If you are not the intended recipient of this message, please
do not read, copy, use, or disclose this communication and notify the
sender immediately. Any review, transmission, dissemination, or use of this
information by a person or entity other than the intended recipient is
prohibited.
Learn more about our Cuneiform Platform <https://peernova.com/platform> →
|