You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(17) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(23) |
2002 |
Jan
(18) |
Feb
(20) |
Mar
(22) |
Apr
(41) |
May
(28) |
Jun
(25) |
Jul
(10) |
Aug
(7) |
Sep
(5) |
Oct
(20) |
Nov
(13) |
Dec
(11) |
2003 |
Jan
(28) |
Feb
(5) |
Mar
(6) |
Apr
(5) |
May
(17) |
Jun
(6) |
Jul
(45) |
Aug
(35) |
Sep
(24) |
Oct
(50) |
Nov
(53) |
Dec
(6) |
2004 |
Jan
(4) |
Feb
(10) |
Mar
(52) |
Apr
(46) |
May
(8) |
Jun
(25) |
Jul
(12) |
Aug
(6) |
Sep
(8) |
Oct
(8) |
Nov
(9) |
Dec
(7) |
2005 |
Jan
(18) |
Feb
(60) |
Mar
(19) |
Apr
(26) |
May
(14) |
Jun
(27) |
Jul
(8) |
Aug
(15) |
Sep
(19) |
Oct
(53) |
Nov
(20) |
Dec
(23) |
2006 |
Jan
(16) |
Feb
(27) |
Mar
(33) |
Apr
(51) |
May
(36) |
Jun
(25) |
Jul
(54) |
Aug
(30) |
Sep
(25) |
Oct
(67) |
Nov
(43) |
Dec
(13) |
2007 |
Jan
(23) |
Feb
(27) |
Mar
(55) |
Apr
(79) |
May
(60) |
Jun
(66) |
Jul
(46) |
Aug
(30) |
Sep
(90) |
Oct
(49) |
Nov
(85) |
Dec
(74) |
2008 |
Jan
(68) |
Feb
(59) |
Mar
(64) |
Apr
(28) |
May
(66) |
Jun
(35) |
Jul
(73) |
Aug
(76) |
Sep
(65) |
Oct
(46) |
Nov
(41) |
Dec
(19) |
2009 |
Jan
(46) |
Feb
(90) |
Mar
(51) |
Apr
(104) |
May
(13) |
Jun
(24) |
Jul
(20) |
Aug
(39) |
Sep
(109) |
Oct
(101) |
Nov
(117) |
Dec
(57) |
2010 |
Jan
(55) |
Feb
(42) |
Mar
(39) |
Apr
(22) |
May
(33) |
Jun
(41) |
Jul
(25) |
Aug
(52) |
Sep
(75) |
Oct
(60) |
Nov
(62) |
Dec
(52) |
2011 |
Jan
(70) |
Feb
(31) |
Mar
(26) |
Apr
(28) |
May
(17) |
Jun
(38) |
Jul
(51) |
Aug
(35) |
Sep
(27) |
Oct
(35) |
Nov
(10) |
Dec
(20) |
2012 |
Jan
(21) |
Feb
(29) |
Mar
(13) |
Apr
(37) |
May
(33) |
Jun
(12) |
Jul
(34) |
Aug
(27) |
Sep
(29) |
Oct
(35) |
Nov
(58) |
Dec
(27) |
2013 |
Jan
(27) |
Feb
(16) |
Mar
(40) |
Apr
(16) |
May
(34) |
Jun
(37) |
Jul
(6) |
Aug
(3) |
Sep
(4) |
Oct
(49) |
Nov
(13) |
Dec
(12) |
2014 |
Jan
(15) |
Feb
(21) |
Mar
(11) |
Apr
(13) |
May
(27) |
Jun
(60) |
Jul
(19) |
Aug
(29) |
Sep
(20) |
Oct
(28) |
Nov
(41) |
Dec
(15) |
2015 |
Jan
(33) |
Feb
(29) |
Mar
(26) |
Apr
(17) |
May
(2) |
Jun
(13) |
Jul
(21) |
Aug
(30) |
Sep
(22) |
Oct
(15) |
Nov
(46) |
Dec
(20) |
2016 |
Jan
(6) |
Feb
(5) |
Mar
(9) |
Apr
(15) |
May
(9) |
Jun
(4) |
Jul
(3) |
Aug
(4) |
Sep
(39) |
Oct
(8) |
Nov
(5) |
Dec
(8) |
2017 |
Jan
(4) |
Feb
(14) |
Mar
(4) |
Apr
(16) |
May
(5) |
Jun
(10) |
Jul
(25) |
Aug
(2) |
Sep
(5) |
Oct
(11) |
Nov
(8) |
Dec
(11) |
2018 |
Jan
(7) |
Feb
(4) |
Mar
|
Apr
(1) |
May
(4) |
Jun
(21) |
Jul
(8) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(1) |
Dec
|
2019 |
Jan
(1) |
Feb
(5) |
Mar
(18) |
Apr
(9) |
May
(5) |
Jun
(21) |
Jul
(25) |
Aug
(25) |
Sep
(4) |
Oct
(2) |
Nov
(2) |
Dec
(5) |
2020 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(6) |
Dec
|
2021 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(2) |
Oct
(9) |
Nov
(1) |
Dec
(5) |
2022 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
(2) |
May
(5) |
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
(3) |
Oct
(14) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(2) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(5) |
Nov
|
Dec
|
2024 |
Jan
(8) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(4) |
Aug
(5) |
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(1) |
2025 |
Jan
(3) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Luigi B. <lui...@gm...> - 2025-07-23 10:25:18
|
QuantLib 1.39 is available for download at < https://www.quantlib.org/download.shtml>; precompiled binaries are also available from PyPI and NuGet for Python and C# respectively. The list of changes for this release is at < https://www.quantlib.org/reference/history.html>. Note that a few recent versions of the Visual C++ 2022 compiler (from 17.14.2 to 17.14.8) had a known bug that, unfortunately, affected QuantLib heavily and made it basically unusable. A fix was released in version 17.14.9; if you’re compiling QuantLib on Windows, make sure you're using at least that version (or, if you can't upgrade, use the Visual C++ 2019 toolset; you can do that from VC++ 2022, as well). Due to this, Python wheels for Windows are not yet available; they will be shortly, when GitHub action runners upgrade to the latest VC++ version. If you have any problems with this release, please report them here on the QuantLib mailing list (<qua...@li...>) or open a GitHub issue at <https://github.com/lballabio/quantlib/issues>. |
From: Marcin R. <mry...@gm...> - 2025-05-19 08:00:10
|
Hi Henry, The FX forward formula seems incorrect. Additionally, you need to calculate the forwards on the nodes of the MXN curve, and correct for the spot date. Something like this: # ====== Step 6: Calculate implied forward rates ====== print("\nImplied Forward USD/MXN Rates:") fx_spot_date = fx_calendar.advance(today, fixing_days, ql.Days, convention, end_of_month) for node, _ in mxn_curve.nodes()[1:]: # Calculate implied forward rate usd_discount = usd_curve.discount(node) usd_discount_spot = usd_curve.discount(fx_spot_date) mxn_discount = mxn_curve.discount(node) mxn_discount_spot = mxn_curve.discount(fx_spot_date) fwd_fx = spot_fx_usdmxn * (usd_discount / mxn_discount) * ( mxn_discount_spot / usd_discount_spot) points = (fwd_fx - spot_fx_usdmxn) * 10000 # Convert to pips print(f"{node}: {fwd_fx:.4f} (Points: {points:.1f})") Hope this helps. Cheers, Marcin On Sat, 17 May 2025 at 14:39, Henry Wu Hu <hen...@gm...> wrote: > Hello. I am trying to get implied fx forward using the FxRateSwapHelper. > Some how I am not able to get the same fx forward points when comparing > with the input. > > Am I missing something? All help is appreciated > > Thanks in advanced. > > > import QuantLib as ql > import datetime as dt > import numpy as np > import pandas as pd > > # Set evaluation date > today = ql.Date(16, 5, 2025) # May 16, 2025 > ql.Settings.instance().evaluationDate = today > > # ====== Step 1: Define market data ====== > # USD yield curve data (assuming we already have this) > usd_rate_dates = [ > today + ql.Period("1D"), > today + ql.Period("1W"), > today + ql.Period("1M"), > today + ql.Period("3M"), > today + ql.Period("6M"), > today + ql.Period("1Y"), > today + ql.Period("2Y"), > today + ql.Period("5Y") > ] > > usd_rates = [0.0520, 0.0525, 0.0530, 0.0535, 0.0540, 0.0550, 0.0560, > 0.0570] # Sample rates > > # FX Spot USDMXN rate > spot_fx_usdmxn = 17.8500 # USD/MXN spot rate > > # FX Swap points for different tenors (market quotes in pips) > fx_swap_tenors = [ql.Period("1M"), ql.Period("3M"), ql.Period("6M"), > ql.Period("1Y")] > fx_swap_points = [125, 375, 825, 1750] # Sample swap points in pips > > # ====== Step 2: Set up USD curve (base/collateral currency) ====== > usd_day_count = ql.Actual360() > usd_calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) > usd_interpolation = ql.Linear() > usd_compounding = ql.Compounded > usd_compounding_freq = ql.Semiannual > > # Create USD deposit rate helpers > usd_rate_helpers = [] > for rate, maturity in zip(usd_rates, usd_rate_dates): > if maturity <= today + ql.Period("1Y"): # For maturities up to 1Y > days_to_maturity = (maturity - today) > usd_rate_helpers.append( > ql.DepositRateHelper( > ql.QuoteHandle(ql.SimpleQuote(rate)), > ql.Period(days_to_maturity, ql.Days), > 2, # fixing days > usd_calendar, > ql.ModifiedFollowing, > False, > usd_day_count > ) > ) > else: # For longer maturities, assume we're using swap rates > tenor_length = (maturity - today) / 365 # Approximate in years > usd_rate_helpers.append( > ql.SwapRateHelper( > ql.QuoteHandle(ql.SimpleQuote(rate)), > ql.Period(int(tenor_length), ql.Years), > usd_calendar, > ql.Semiannual, > ql.ModifiedFollowing, > usd_day_count, > ql.Euribor6M() # Example index, in reality would use > appropriate USD index > ) > ) > > # Build USD curve > usd_curve = ql.PiecewiseLinearZero( > today, usd_rate_helpers, usd_day_count > ) > usd_curve_handle = ql.YieldTermStructureHandle(usd_curve) > > # ====== Step 3: Set up FX swap rate helpers for MXN curve ====== > mxn_calendar = ql.Mexico() > # In FX markets, typically both calendars are considered > fx_calendar = ql.JointCalendar(usd_calendar, mxn_calendar) > fixing_days = 2 # Standard for FX markets > convention = ql.Following > end_of_month = False > # In USD/MXN, USD is the base currency, and if using USD as collateral: > is_fx_base_currency_collateral_currency = True > > # Create FX swap rate helpers > fx_swap_helpers = [] > for tenor, points in zip(fx_swap_tenors, fx_swap_points): > # Convert swap points from pips to decimal > swap_point_decimal = points / 10000.0 > > fx_swap_helpers.append( > ql.FxSwapRateHelper( > ql.QuoteHandle(ql.SimpleQuote(swap_point_decimal)), > ql.QuoteHandle(ql.SimpleQuote(spot_fx_usdmxn)), > tenor, > fixing_days, > fx_calendar, > convention, > end_of_month, > is_fx_base_currency_collateral_currency, > usd_curve_handle > ) > ) > > # ====== Step 4: Build MXN curve ====== > mxn_day_count = ql.Actual360() > mxn_curve = ql.PiecewiseLinearZero( > today, fx_swap_helpers, mxn_day_count > ) > > # ====== Step 5: Analyze the results ====== > print(f"Evaluation date: {today.ISO()}") > print(f"USD/MXN Spot Rate: {spot_fx_usdmxn}") > print("\nUSD Zero Rates:") > for date, rate in zip(usd_rate_dates, usd_rates): > days = (date - today) > print(f"{days} days: {rate*100:.4f}%") > > print("\nImplied MXN Zero Rates:") > for tenor in fx_swap_tenors: > date = today + tenor > mxn_zero_rate = mxn_curve.zeroRate( > date, mxn_day_count, ql.Continuous).rate() > print(f"{tenor}: {mxn_zero_rate*100:.4f}%") > > # ====== Step 6: Calculate implied forward rates ====== > print("\nImplied Forward USD/MXN Rates:") > for tenor in fx_swap_tenors: > date = today + tenor > # Calculate implied forward rate > usd_discount = usd_curve.discount(date) > mxn_discount = mxn_curve.discount(date) > fwd_fx = spot_fx_usdmxn * (mxn_discount / usd_discount) > > points = (fwd_fx - spot_fx_usdmxn) * 10000 # Convert to pips > print(f"{tenor}: {fwd_fx:.4f} (Points: {points:.1f})") > > Best Regards > Henry Wu Hu > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |
From: Peter C. <pca...@gm...> - 2025-05-17 07:49:52
|
Dear all, We will be hosting a meeting in London on June 3rd with presentations on the latest in Open-Source Risk Engine and QuantLib - the former is based on the latter, as you might know. There will also be talks on more general quant finance topics. I will attach the full invite below. Would be nice to see you there. Best Peter We’re delighted to invite you to the LSEG Post Trade Solutions (formerly Acadia) *Quant Summit*, taking place at the *LSEG Headquarters* in *London * on *Tuesday 3rd June*. Join us for an exciting day of insights and innovation in quantitative finance, bringing together leading professionals to share their expertise. You are invited to attend our morning Open-Source Risk Engine Technical Masterclass, and/or our afternoon Quant Summit packed with presentations and panels from industry leaders. This free-to-attend event is ideal for Heads of Traded Risk/XVA/Model Validation and Senior Quants supporting FO, risk or model validation and Quant Developers. It’s a fantastic opportunity to exchange ideas and connect with peers from across the industry. Feel free to share with colleagues who may be interested. The link below provides details on the agenda and registration form. https://solutions.lseg.com/Quant_Summit_London_2025 Register now to secure your place. We look forward to welcoming you! |
From: Luigi B. <lui...@gm...> - 2025-04-23 08:48:56
|
QuantLib 1.38 is available for download at < https://www.quantlib.org/download.shtml>; precompiled binaries are also available from PyPI and NuGet for Python and C# respectively. The list of changes for this release is at < https://www.quantlib.org/reference/history.html>. If you have any problems with this release, please report them here on the QuantLib mailing list (<qua...@li...>) or open a GitHub issue at <https://github.com/lballabio/quantlib/issues>. |
From: Luigi B. <lui...@gm...> - 2025-03-27 14:57:59
|
Hello Leopold, the multiple-reset feature is relatively recent and it's not available in SwapRateHelper. There is an open issue about this ( https://github.com/lballabio/QuantLib/issues/2138) so thanks for posting—I'll point to this thread in that issue as further evidence. You can follow the issue to check if there's any progress. Best, Luigi On Thu, Mar 27, 2025 at 2:41 PM Leopold Coupet <lc...@ra...> wrote: > Hello Luigi, regarding IRS that pay less frequently than the index resets. > > A real example would be the Canadian swap based on CDOR3M Index. They pay > semi-annually while resetting quarterly. > In your article here > https://www.implementingquantlib.com/2025/02/multiple-resets.html, you > explain how to price those type of swaps, but my question is how to > bootstrap the forward zero curve using the ql.SwapRateHelper object. Does > QuantLib understand that the index resets quarterly, if we define the index > tenor as ql.Period(“3M”) ? Or is there a way to precise in the swap helper > object that there is a quarterly reset ? > > Thank you very much, > > Léopold > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > |
From: Leopold C. <lc...@ra...> - 2025-03-27 13:40:30
|
Hello Luigi, regarding IRS that pay less frequently than the index resets. A real example would be the Canadian swap based on CDOR3M Index. They pay semi-annually while resetting quarterly. In your article here https://www.implementingquantlib.com/2025/02/multiple-resets.html, you explain how to price those type of swaps, but my question is how to bootstrap the forward zero curve using the ql.SwapRateHelper object. Does QuantLib understand that the index resets quarterly, if we define the index tenor as ql.Period(“3M”) ? Or is there a way to precise in the swap helper object that there is a quarterly reset ? Thank you very much, Léopold |
From: Luigi B. <lui...@gm...> - 2025-02-13 16:50:12
|
Hi, it's not a linking problem, it's a constraint of the Boost test framework. Older versions allowed different tests to have the same name, and we had a few of those in QuantLib. Since Boost 1.67 (which came out 7 years ago), that's no longer possible and we had to change those names. This was fixed shortly afterwards in version 1.12.1. If you can't upgrade at least to that version of QuantLib, you have two possibilities. You can downgrade Boost to 1.66.0 and build with that, or you can backport the fixes in < https://github.com/lballabio/QuantLib/pull/446> to your version of QuantLib. Hope this helps, Luigi On Thu, Feb 13, 2025 at 2:50 PM Amine Ifri <ami...@gm...> wrote: > Hi Team, > > Hope you are well. I am reaching out as I am using an old version of > QuantLib built with boost 1_83_0. The library builds fine as its own > dynamic library target, and I build the suite of tests as a separate Target > linking to the QuantLib dylib. > > The tests also build fine. However, when running the suite of tests, I get > the following error message: > > *Test setup error: test unit with name > 'QuantLib__detail__quantlib_test_case(boost__bind(&BasketOptionTest__testOneDAmericanValues_ > (i _(sizeof(oneDataValues)_sizeof(oneDataValues[0])))_nTestCases_ > ((i_1)_(sizeof(oneDataValues)_sizeof(oneDataValues[0])))_nTestCases))' > registered multiple times in the test suite 'Basket option tests'* > > I use the preprocessing variable BOOST_TEST_DYN_LINK to enable the > inclusion of the main function, but I don't use the parallel runner for the > tests. > > Any suggestions on how to tackle this problem will be very much > appreciated. > > Thanks, > Amine > > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > |
From: Amine I. <ami...@gm...> - 2025-02-13 13:49:22
|
Hi Team, Hope you are well. I am reaching out as I am using an old version of QuantLib built with boost 1_83_0. The library builds fine as its own dynamic library target, and I build the suite of tests as a separate Target linking to the QuantLib dylib. The tests also build fine. However, when running the suite of tests, I get the following error message: *Test setup error: test unit with name 'QuantLib__detail__quantlib_test_case(boost__bind(&BasketOptionTest__testOneDAmericanValues_ (i _(sizeof(oneDataValues)_sizeof(oneDataValues[0])))_nTestCases_ ((i_1)_(sizeof(oneDataValues)_sizeof(oneDataValues[0])))_nTestCases))' registered multiple times in the test suite 'Basket option tests'* I use the preprocessing variable BOOST_TEST_DYN_LINK to enable the inclusion of the main function, but I don't use the parallel runner for the tests. Any suggestions on how to tackle this problem will be very much appreciated. Thanks, Amine |
From: Luigi B. <lui...@gm...> - 2025-01-21 11:46:04
|
Ciao Paolo, the cost of carry also needs to consider the dividend yield, in case your test values include it as part of the inputs. If you want to open a pull request with what you have at the moment, I'd be glad to have a look. Hope this helps, Luigi On Mon, Jan 6, 2025 at 8:13 PM Paolo D'Elia <pao...@gm...> wrote: > Dear QuantLib Developers, > > I hope this email finds you well. I’m currently working on implementing > the feature request in issue #1986 > <https://github.com/lballabio/QuantLib/issues/1986>, which involves > adding support for the calculation of partial-time put barrier options > using the put-call symmetry approach as described on page 167 of Haug’s > book (since there is no closed-form formula available). I’ve pushed my > current work to the branch [partial-time-barrier-put-option] > <https://github.com/paolodelia99/QuantLib/tree/partial-time-barrier-put-option> > in my fork, and I would greatly appreciate your guidance on the following > matters. > > So far, I’ve extended the AnalyticPartialTimeBarrierOptionEngine to > support this feature. My implementation creates a synthetic call option and > leverages the put-call symmetry to calculate the put price. While the code > works in the context of the AnalyticPartialTimeBarrierOptionEngine, I > wanted to verify its correctness by testing this same symmetry property on > standard barrier options. > > Here is where I’m encountering an issue: for interest rate values > different from 0, I observe a discrepancy in the put-call symmetry results. > My suspicion is that I may not have properly accounted for the "cost of > carry" term in the symmetry calculation. However, I’m struggling to fully > understand this concept. I’ve read on page 8 of Haug’s book that, in the > Black-Scholes model, the cost of carry is the same as the risk-free > interest rate, but I can’t wrap my head around how it applies here or > whether I’m omitting this variable in my implementation. > > Could this discrepancy be related to the cost-of-carry term, or am I > misunderstanding something fundamental about the put-call symmetry for > barrier options? If anyone has experience or insights into this area, I > would be very grateful for your assistance and guidance. > > Thank you in advance for your time and help. Please let me know if further > details or specific code snippets would be helpful. > > Best regards, > Paolo D'Elia > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > |
From: Luigi B. <lui...@gm...> - 2025-01-21 09:57:57
|
QuantLib 1.37 is available for download at < https://www.quantlib.org/download.shtml>; precompiled binaries are also available from PyPI and NuGet for Python and C# respectively. The list of changes for this release is at < https://www.quantlib.org/reference/history.html>. If you have any problems with this release, please report them here on the QuantLib mailing list (<qua...@li...>) or open a GitHub issue at <https://github.com/lballabio/quantlib/issues>. |
From: Paolo D'E. <pao...@gm...> - 2025-01-06 19:12:15
|
Dear QuantLib Developers, I hope this email finds you well. I’m currently working on implementing the feature request in issue #1986 <https://github.com/lballabio/QuantLib/issues/1986>, which involves adding support for the calculation of partial-time put barrier options using the put-call symmetry approach as described on page 167 of Haug’s book (since there is no closed-form formula available). I’ve pushed my current work to the branch [partial-time-barrier-put-option] <https://github.com/paolodelia99/QuantLib/tree/partial-time-barrier-put-option> in my fork, and I would greatly appreciate your guidance on the following matters. So far, I’ve extended the AnalyticPartialTimeBarrierOptionEngine to support this feature. My implementation creates a synthetic call option and leverages the put-call symmetry to calculate the put price. While the code works in the context of the AnalyticPartialTimeBarrierOptionEngine, I wanted to verify its correctness by testing this same symmetry property on standard barrier options. Here is where I’m encountering an issue: for interest rate values different from 0, I observe a discrepancy in the put-call symmetry results. My suspicion is that I may not have properly accounted for the "cost of carry" term in the symmetry calculation. However, I’m struggling to fully understand this concept. I’ve read on page 8 of Haug’s book that, in the Black-Scholes model, the cost of carry is the same as the risk-free interest rate, but I can’t wrap my head around how it applies here or whether I’m omitting this variable in my implementation. Could this discrepancy be related to the cost-of-carry term, or am I misunderstanding something fundamental about the put-call symmetry for barrier options? If anyone has experience or insights into this area, I would be very grateful for your assistance and guidance. Thank you in advance for your time and help. Please let me know if further details or specific code snippets would be helpful. Best regards, Paolo D'Elia |
From: Luigi B. <lui...@gm...> - 2024-12-27 09:35:40
|
Hi, if that helps, https://www.quantlib.org doesn't have the same problem. Luigi On Mon, Nov 4, 2024 at 12:06 PM Francois Botha <ig...@gm...> wrote: > Hi Luigi, > > I just tried to access https://quantlib.org from my corporate laptop and > our over-zealous proxy server is complaining about an invalid SSL > certificate, hence blocking me from accessing the site. This wasn't a > problem before, but I can't say whether it's due to a change in the > certificate or policies enforced here. > > All the online SSL certificate checkers agree that there is a minor issue, > e.g. https://www.ssllabs.com/ssltest/analyze.html?d=quantlib.org . > > or from https://www.geocerts.com/ssl-checker : > > > > *Certificate Common Name (CN) and Hostname Match?The hostname > (quantlib.org <http://quantlib.org>) does NOT match the Common Name in the > certificate (*.github.com <http://github.com>). This certificate is > currently invalid for this host.* > > I suspect that this isn't easily fixable. From what I can tell, one can't > install a custom SSL cert when hosting static pages on Github. However, > using CloudFlare is maybe an option. > https://stackoverflow.com/a/75996544/179494 > > thanks > Francois Botha > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > |
From: Francois B. <ig...@gm...> - 2024-11-04 11:05:43
|
Hi Luigi, I just tried to access https://quantlib.org from my corporate laptop and our over-zealous proxy server is complaining about an invalid SSL certificate, hence blocking me from accessing the site. This wasn't a problem before, but I can't say whether it's due to a change in the certificate or policies enforced here. All the online SSL certificate checkers agree that there is a minor issue, e.g. https://www.ssllabs.com/ssltest/analyze.html?d=quantlib.org . or from https://www.geocerts.com/ssl-checker : *Certificate Common Name (CN) and Hostname Match?The hostname (quantlib.org <http://quantlib.org>) does NOT match the Common Name in the certificate (*.github.com <http://github.com>). This certificate is currently invalid for this host.* I suspect that this isn't easily fixable. From what I can tell, one can't install a custom SSL cert when hosting static pages on Github. However, using CloudFlare is maybe an option. https://stackoverflow.com/a/75996544/179494 thanks Francois Botha |
From: Dirk E. <ed...@de...> - 2024-10-15 15:37:20
|
Sweet. Switched to (cd Python && \ swig -python -c++ -outdir src/QuantLib \ -o src/QuantLib/quantlib_wrap.cpp \ ../SWIG/quantlib.i; \ for python in $(PYTHONS); do \ CC="$(cxxcompiler)" \ CXX="$(cxxcompiler)" \ CFLAGS="$(compilerflags)" \ CXXFLAGS="$(compilerflags)" \ $$python setup.py build; \ done ) and it is running. I already python3-setuptools, I added python3-build for good measure. No wheels for builds within / for the Debian distribution, of course. Thanks as always for the prompt and on-point reply! Dirk -- dirk.eddelbuettel.com | @eddelbuettel | ed...@de... |
From: Luigi B. <lui...@gm...> - 2024-10-15 14:41:31
|
Hi Dirk—yes, I did a few changes. There finally seems to be some consensus on the tools for building Python wheels, so I'm using those now. First, you'll need some tooling; in the CI build I'm doing `pip install setuptools build tox` but I guess you'll install the corresponding apt packages instead. If you're not running the tests, you don't need tox, I guess. Second, forget setup.py wrap, the SWIG command is now $(SWIG) -python -c++ -outdir src/QuantLib -o src/QuantLib/quantlib_wrap.cpp ../SWIG/quantlib.i You can do it just once for all Pythons. Third, instead of setup.py build, the build command is now CXXFLAGS="$(compilerflags)" CC="$(cxxcompiler)" CXX="$(cxxcompiler)" $(PYTHON) -m build --wheel which builds a Python wheel. It uses Python's stable API, so the same wheel should work for all Python versions >= 3.8. I don't know if there's a fourth step—do you need to install the wheel in order to package it for apt? If so, use "$(PYTHON) -m pip install". Hope it helps—let me know if you hit some other roadblock. Luigi On Tue, Oct 15, 2024 at 3:27 PM Dirk Eddelbuettel <ed...@de...> wrote: > > I am having an issue with QL-SWIG under 1.36. I updated QL to 1.36 > yesterday > for Debian (and my Ubuntu PPA for 24.04; having done so a week earlier for > the RC as well). But now QL-SWIG croaks: > > fatal error: src/QuantLib/quantlib_wrap.cpp: No such file or directory > > I presume I need to change something (again). Currently we use a two-step > of > 'setup.py wrap' (no longer recognised -- I likely need to replace it ?) and > 'setup.py build', where the latter now fails presumably because the former > is > not working: > > build-stamp: > dh_testdir > @echo "*** Running on arch $(arch) and cpu $(cpu)" > > ./autogen.sh > > # need to build the Makefile for R (and Ruby ?) > ./configure --prefix=/usr \ > --build $(arch) > > # $(MAKE) > (cd Python && for python in $(PYTHONS); do \ > CC="$(cxxcompiler)" \ > CXX="$(cxxcompiler)" \ > CFLAGS="$(compilerflags)" \ > CXXFLAGS="$(compilerflags)" \ > $$python setup.py wrap; \ > CC="$(cxxcompiler)" \ > CXX="$(cxxcompiler)" \ > CFLAGS="$(compilerflags)" \ > CXXFLAGS="$(compilerflags)" \ > $$python setup.py build; \ > done ) > > Thanks in advance for any help! > > Cheers, Dirk > > -- > dirk.eddelbuettel.com | @eddelbuettel | ed...@de... > |
From: Dirk E. <ed...@de...> - 2024-10-15 13:28:05
|
I am having an issue with QL-SWIG under 1.36. I updated QL to 1.36 yesterday for Debian (and my Ubuntu PPA for 24.04; having done so a week earlier for the RC as well). But now QL-SWIG croaks: fatal error: src/QuantLib/quantlib_wrap.cpp: No such file or directory I presume I need to change something (again). Currently we use a two-step of 'setup.py wrap' (no longer recognised -- I likely need to replace it ?) and 'setup.py build', where the latter now fails presumably because the former is not working: build-stamp: dh_testdir @echo "*** Running on arch $(arch) and cpu $(cpu)" ./autogen.sh # need to build the Makefile for R (and Ruby ?) ./configure --prefix=/usr \ --build $(arch) # $(MAKE) (cd Python && for python in $(PYTHONS); do \ CC="$(cxxcompiler)" \ CXX="$(cxxcompiler)" \ CFLAGS="$(compilerflags)" \ CXXFLAGS="$(compilerflags)" \ $$python setup.py wrap; \ CC="$(cxxcompiler)" \ CXX="$(cxxcompiler)" \ CFLAGS="$(compilerflags)" \ CXXFLAGS="$(compilerflags)" \ $$python setup.py build; \ done ) Thanks in advance for any help! Cheers, Dirk -- dirk.eddelbuettel.com | @eddelbuettel | ed...@de... |
From: Luigi B. <lui...@gm...> - 2024-10-14 08:02:07
|
QuantLib 1.36 is available for download at < https://www.quantlib.org/download.shtml>; precompiled binaries are also available from PyPI and NuGet for Python and C# respectively. The list of changes for this release is at < https://www.quantlib.org/reference/history.html>. If you have any problems with this release, please report them here on the QuantLib mailing list (<qua...@li...>) or open a GitHub issue at <https://github.com/lballabio/quantlib/issues>. |
From: Luigi B. <lui...@gm...> - 2024-08-30 15:47:11
|
Hi—hmm, I don't know what the new property or rule should be. It looks like a very specific case, and the Schedule code is already kind of a mess (in fact, I've been wondering if we should keep all those combinations in a single constructor or if we should migrate some cases to separate builder methods). A function that creates the custom date vector and passes it to the schedule is probably not the worst solution. Luigi On Thu, Aug 29, 2024 at 9:38 AM Francois Botha <ig...@gm...> wrote: > Hi Luigi, > > Thanks again for your informative blog post. As before, it triggered > something. One of the nuances of valuing our local bonds is that some bonds > pay semiannual coupons on 28 Feb and 31 Aug every year, whether it is a > leap year or not. The Feb coupon is always payable on 28 Feb (with > Following business day convention otherwise). One of these bonds also > matures on 28 Feb 2048 (the South African R2048 bond), which is in a leap > year. This makes the normal schedule generation not possible (as far as I > know), so I usually have to build a custom date vector and pass it to a > schedule. > > Is this solvable in a more elegant way? I originally thought of adding a > new DateGeneration:NoLeapDays enum value, but this feature is probably > something one would want to use in conjunction with the existing > DateGeneration values. Maybe then a new class/property on the schedule to > enable this? > > Looking forward to your comments (and next blog post). > > thanks > Francois Botha > > > On Thu, 29 Aug 2024 at 07:31, Luigi Ballabio from Implementing QuantLib < > imp...@su...> wrote: > >> Hello again! This post was originally published in the March 2024 issue >> of Wilmott Magazine. >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ >> Forwarded this email? Subscribe here >> <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9pbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20vc3Vic2NyaWJlP3V0bV9zb3VyY2U9ZW1haWwmdXRtX2NhbXBhaWduPWVtYWlsLXN1YnNjcmliZSZyPTZuNzR2Jm5leHQ9aHR0cHMlM0ElMkYlMkZpbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20lMkZwJTJGc2NoZWR1bGVzLWluLXF1YW50bGliIiwicCI6MTQ4MDcyMzU5LCJzIjoyNDMxMTI5LCJmIjp0cnVlLCJ1IjoxMTE2MDAzMSwiaWF0IjoxNzI0OTA5NDYwLCJleHAiOjE3Mjc1MDE0NjAsImlzcyI6InB1Yi0wIiwic3ViIjoibGluay1yZWRpcmVjdCJ9.g-lp_1nL_0_WmPfMTi8LL4h8y2E5GSg3djDV7OV0jjg?> >> for more >> >> <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9pbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20vcC9zY2hlZHVsZXMtaW4tcXVhbnRsaWI_dXRtX2NhbXBhaWduPWVtYWlsLWhhbGYtcG9zdCZyPTZuNzR2JnRva2VuPWV5SjFjMlZ5WDJsa0lqb3hNVEUyTURBek1Td2ljRzl6ZEY5cFpDSTZNVFE0TURjeU16VTVMQ0pwWVhRaU9qRTNNalE1TURrME5qQXNJbVY0Y0NJNk1UY3lOelV3TVRRMk1Dd2lhWE56SWpvaWNIVmlMVEkwTXpFeE1qa2lMQ0p6ZFdJaU9pSndiM04wTFhKbFlXTjBhVzl1SW4wLjg1T25wSjh2YW82S1dmb2kxZWFQMnJGNW50Qm1GUjVKTEotWmp1QTdmdEEiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.y_ysg6ed95CdRAJClcmn2N6PD7w0mLLhwAfivLrIWFA?> >> Schedules in QuantLib >> <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=post-email-title&utm_campaign=email-post-title&isFreemail=true&r=6n74v&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA> >> >> Luigi Ballabio <https://substack.com/@lballabio> >> Aug 29 >> <https://substack.com/@lballabio> >> >> >> <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&isFreemail=true&submitLike=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJyZWFjdGlvbiI6IuKdpCIsImlhdCI6MTcyNDkwOTQ2MCwiZXhwIjoxNzI3NTAxNDYwLCJpc3MiOiJwdWItMjQzMTEyOSIsInN1YiI6InJlYWN0aW9uIn0.sB6gVgVEMo4ZBZA44fsZmp_c6EBYvRc-tBHyN762xG8&utm_medium=email&utm_campaign=email-reaction&r=6n74v> >> >> <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&isFreemail=true&comments=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA&r=6n74v&utm_campaign=email-half-magic-comments&action=post-comment&utm_source=substack&utm_medium=email> >> >> <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&utm_content=share&utm_campaign=email-share&action=share&triggerShare=true&isFreemail=true&r=6n74v&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA> >> >> <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9vcGVuLnN1YnN0YWNrLmNvbS9wdWIvaW1wbGVtZW50aW5ncXVhbnRsaWIvcC9zY2hlZHVsZXMtaW4tcXVhbnRsaWI_dXRtX3NvdXJjZT1zdWJzdGFjayZ1dG1fbWVkaXVtPWVtYWlsJnV0bV9jYW1wYWlnbj1lbWFpbC1yZXN0YWNrLWNvbW1lbnQmYWN0aW9uPXJlc3RhY2stY29tbWVudCZyPTZuNzR2JnRva2VuPWV5SjFjMlZ5WDJsa0lqb3hNVEUyTURBek1Td2ljRzl6ZEY5cFpDSTZNVFE0TURjeU16VTVMQ0pwWVhRaU9qRTNNalE1TURrME5qQXNJbVY0Y0NJNk1UY3lOelV3TVRRMk1Dd2lhWE56SWpvaWNIVmlMVEkwTXpFeE1qa2lMQ0p6ZFdJaU9pSndiM04wTFhKbFlXTjBhVzl1SW4wLjg1T25wSjh2YW82S1dmb2kxZWFQMnJGNW50Qm1GUjVKTEotWmp1QTdmdEEiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.E93_m7YsoFZzpil4XdpBCcvzhGiQOxaCifb9BX4qVyU?&utm_source=substack&utm_medium=email> >> >> READ IN APP >> <https://open.substack.com/pub/implementingquantlib/p/schedules-in-quantlib?utm_source=email&redirect=app-store> >> >> >> Hello again! This post was originally published in the March 2024 issue >> of Wilmott Magazine. The full source code is available on my Tutorial >> page >> <https://substack.com/redirect/a0e37dcd-d154-4ed3-aeaa-4f3550905f1c?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg>, >> together with code from other articles and, when available, either the >> articles themselves or corresponding blog posts like this one. >> Schedules in QuantLib >> >> For this article, I thought I’d try something new: I won’t completely >> change the subject from what I covered in the last issue, that is, calendars >> and holidays >> <https://substack.com/redirect/685b5a65-f9e1-45e7-9d95-57986f55d8fd?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg>. >> This month, I’ll start from there and show how to use QuantLib to generate >> schedules, i.e., regular sequences of dates, choosing from a number of >> market conventions. In turn, those can be used to create sequences of >> coupons; but that’s something for another time. What I will also show, >> instead, is a C++ technique that can come useful at times. Off we go. >> Some examples >> >> We can build a schedule with as little information as a start date, an >> end date, and a frequency. Here is the corresponding call: >> >> Schedule s = MakeSchedule() >> .from(Date(11, May, 2021)) >> .to(Date(11, May, 2025)) >> .withFrequency(Semiannual); >> >> If you then write something like >> >> for (auto date : s) >> std::cout << date << std::endl; >> >> you’ll see the dates listed in the table below. Unsurprisingly, it is a >> sequence of alternating May 11th and November 11th from the start date to >> the end date; they are both included. >> >> <https://substack.com/redirect/37472cb9-17d8-4c0c-adaf-e956754aa0eb?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> >> When building coupons from this schedule, the understanding is that the >> first date in the schedule is the start of the first coupon; the second >> date is both the end of the first coupon and the start of the second; the >> third date is the end of the second coupon and the start of the third; >> until we get to the last date, which is the end of the last coupon. >> Adjusting for holidays >> >> The above schedule didn’t make a distinction between holidays and >> business days. If we want holidays to be adjusted, we need to choose a >> calendar: >> >> Schedule s = MakeSchedule() >> .from(Date(11, May, 2021)) >> .to(Date(11, May, 2025)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()); >> >> The above generates the schedule in the next table. As you can see, a few >> dates are no longer the 11th of the month and were replaced with the next >> business day. In this case, those dates fell on Saturdays or Sundays, but >> of course the adjustment would also be performed if they were mid-week >> holidays. >> >> <https://substack.com/redirect/ae8057c5-7ee5-420c-af4f-cb7978fa34c3?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> >> For convenience, it’s possible to pass a calendar and at the same time >> specify that dates should be unadjusted; here is the corresponding call: >> >> Schedule s = MakeSchedule() >> .from(Date(11, May, 2021)) >> .to(Date(11, May, 2025)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .withConvention(Unadjusted); >> >> The result is the same as the one we got when we didn’t pass a calendar. >> As I said, this is a convenience; when reading data from a file or a DB, it >> makes it unnecessary to write logic that chooses whether or not to pass a >> calendar. >> Short and long coupons >> >> If the start and end dates don’t bracket a whole number of periods, it >> becomes important to specify whether the dates should be generated forwards >> from the start date or backwards from the end date; the default is to >> generate them backwards, but it’s probably better to be explicit. The >> corresponding calls are as follows: >> >> Schedule s1 = MakeSchedule() >> .from(Date(11, May, 2021)) >> .to(Date(11, February, 2025)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .forwards(); >> >> Schedule s2 = MakeSchedule() >> .from(Date(11, May, 2021)) >> .to(Date(11, February, 2025)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .backwards(); >> >> The results are shown in the table below. In the first case, we ended up >> with a short last coupon; in the second, with a short first coupon. >> >> <https://substack.com/redirect/79b2a55d-55e3-4ef7-b18a-f815310c4b21?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> >> It’s also possible to specify a long coupon by passing an explicit stub: >> >> Schedule s = MakeSchedule() >> .from(Date(11, February, 2021)) >> .to(Date(11, May, 2025)) >> .withFirstDate(Date(11, November, 2021)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .forwards(); >> >> The result is shown below. In case of a long last coupon, you can use the >> withNextToLastDate method instead of withFirstDate; the two can also be >> used together. >> >> <https://substack.com/redirect/9c91b185-1084-427d-9240-b6ccdaf3ced1?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> End of month >> >> When the dates are close to the end of their month, other conventions can >> come into play. The default behavior is to generate dates as usual; the call >> >> Schedule s = MakeSchedule() >> .from(Date(28, February, 2019)) >> .to(Date(28, February, 2023)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .forwards(); >> >> results in the dates shown in the next table, where for instance February >> 28th 2021, a Sunday, is adjusted to March 1st according to the “following” >> convention. >> >> <https://substack.com/redirect/bb5d3306-b554-4057-a7ac-852c9da94366?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> >> However, if another convention such as “modified following” needs to be >> used, it can be passed to the call: >> >> Schedule s = MakeSchedule() >> .from(Date(28, February, 2019)) >> .to(Date(28, February, 2023)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .withConvention(ModifiedFollowing) >> .forwards(); >> >> The result is displayed below and shows that February 28th 2021 is >> adjusted back to February 26th so that it doesn’t change month. >> >> <https://substack.com/redirect/eba5b21f-42f4-49ab-b7d4-3a339fd9a827?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> >> Also, in some cases, the terms of an instrument might stipulate that >> coupons reset on the last business day of the month; in that case, the >> schedule can be generated with: >> >> Schedule s = MakeSchedule() >> .from(Date(28, February, 2019)) >> .to(Date(28, February, 2023)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .forwards() >> .endOfMonth(); >> >> The result is shown next; by comparing it with the tables above, you can >> see the difference of behavior for the dates at the end of August. >> >> <https://substack.com/redirect/5d65c482-eda7-47a4-98e7-70c6b2f0bee2?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> Specialized rules >> >> The forwards and backwards methods shown above are shorthand for calls >> to a more general method withRule that allows to specify a generation >> rule (“forwards” and “backwards” being two such rules.) Other, more >> specialized rules are available; for instance, if you needed to generate >> the schedule for the payments of a standard 5-years credit default swap, >> you would do it as follows: >> >> auto tradeDate = Date(11, March, 2021); >> auto tenor = Period(5, Years); >> auto maturityDate = >> cdsMaturity(tradeDate, tenor, >> DateGeneration::CDS2015); >> >> Schedule s = MakeSchedule() >> .from(tradeDate) >> .to(maturityDate) >> .withFrequency(Quarterly) >> .withCalendar(TARGET()) >> .withRule(DateGeneration::CDS2015); >> >> First, the cdsMaturity function returns the standardized maturity date >> for the passed trade date; for March 11th 2021, that would be December 20th >> 2025 (it would roll to June 2025 only later in March.) Then, we pass the >> calculated maturity date to MakeSchedule while also specifying a CDS2015 >> date-generation rule; this recalculates the start date of the CDS and also >> adjusts all the dates in the schedule to the twentieth of their months or >> the next business day. The result is shown below. >> >> <https://substack.com/redirect/39ba32d3-8058-4b41-983a-e7f7b19eef80?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> >> >> This covers most of the functionality of schedules in QuantLib. However, >> you might still be curious about one thing. What about the syntax of >> MakeSchedule? Why aren’t we using a constructor like all decent folks, >> and what happens when we chain all those method calls? >> The Named Parameter idiom >> >> The Schedule class does have a constructor, of course, but it’s a bit >> awkward to use. As the time of this writing, corresponding to QuantLib >> 1.32, its signature is: >> >> Schedule(Date effectiveDate, >> const Date& terminationDate, >> const Period& tenor, >> Calendar calendar, >> BusinessDayConvention convention, >> BusinessDayConvention >> terminationDateConvention, >> DateGeneration::Rule rule, >> bool endOfMonth, >> const Date& firstDate, >> const Date& nextToLastDate); >> >> This means it requires a whole lot of parameters, even in the simplest >> case. Reasonable defaults exist for some of them (a null calendar, >> following for the conventions, backwards for the generation rule, false for >> the end of month, and no first or next-to-last date) but if we added them, >> we’d run into another problem. When we’re good with most of the default >> parameters but want to change one of the last ones (say, firstDate), >> there’s no easy syntax we can use for the call. In Python, which supports >> named parameters, we’d say >> >> s = Schedule( >> Date(11, February, 2021), >> Date(11, May, 2025), >> Period(6, Months), >> firstDate = Date(11, November, 2021), >> ) >> >> but in C++, we’d have to pass all the parameters before firstDate, even >> if they all equal the defaults. >> >> The solution? The Named Parameter idiom (a.k.a Fluent Interface). We >> write a helper class, MakeSchedule in our case, which contains the >> parameters needed to build a schedule and gives them sensible default >> values: >> >> class MakeSchedule { >> ... >> private: >> Calendar calendar_; >> Date effectiveDate_; >> Date terminationDate_; >> Period tenor_; >> BusinessDayConvention convention_ = Following; >> DateGeneration::Rule rule_ = >> DateGeneration::Backward; >> bool endOfMonth_ = false; >> Date firstDate_ = Date(); >> Date nextToLastDate_ = Date(); >> }; >> >> Settings the parameters >> >> To set the values of the parameters, we give MakeSchedule a number of >> setter methods; the twist here is that each of these methods returns the >> object itself, making it possible to chain them. >> >> class MakeSchedule { >> public: >> MakeSchedule& from(const Date& effectiveDate) { >> effectiveDate_ = effectiveDate; >> return *this; >> } >> >> MakeSchedule& to(const Date& terminationDate) { >> terminationDate_ = terminationDate; >> return *this; >> } >> >> MakeSchedule& withTenor(const Period& tenor) { >> tenor_ = tenor; >> return *this; >> } >> >> MakeSchedule& forwards() { >> rule_ = DateGeneration::Forward; >> return *this; >> } >> >> ... >> }; >> >> Getting our schedule >> >> At this point, we’re able to write >> >> MakeSchedule() >> .from(Date(11, May, 2021)) >> .to(Date(11, February, 2025)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()) >> .forwards() >> >> but the result is still a MakeSchedule instance, not a schedule. In >> order to build the latter, we could add an explicit to_schedule() method >> that calls the Schedule constructor and returns the result. However, we >> went for a fancier solution. >> >> A little-used feature of C++ are user-defined conversion functions. You >> can google them for details, but the gist is that, if A and B are two >> unrelated classes, you can give B a method which returns an instance of A, >> declared as >> >> class B { >> public: >> operator A() const; >> ... >> }; >> >> and if you then write >> >> B b; >> A a = b; >> >> the compiler will look first for an A constructor taking a B instance, >> and then (after seeing it isn’t there) it will look into B, find the >> conversion method, invoke it, and assign to a the instance of A returned >> by it. >> >> In our case, the conversion function will be declared in MakeSchedule as >> >> class MakeSchedule { >> public: >> ... >> >> operator Schedule() const; >> }; >> >> and its implementation will call the Schedule constructor with the >> required parameters and return the resulting schedule. Putting everything >> together, we get the syntax >> >> Schedule s = MakeSchedule() >> .from(Date(11, May, 2021)) >> .to(Date(11, May, 2025)) >> .withFrequency(Semiannual) >> .withCalendar(TARGET()); >> >> used in the examples. And in case you were wondering why I didn’t use the >> shorter syntax, note that using auto s above would not trigger the >> assignment operator; it would assign to s the MakeSchedule instance. >> >> And with this, we can bring this article to a close. See you next time! >> >> >> Share >> <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&utm_content=share&utm_campaign=email-share&action=share&triggerShare=true&isFreemail=true&r=6n74v&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA> >> >> >> Like >> <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&isFreemail=true&submitLike=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJyZWFjdGlvbiI6IuKdpCIsImlhdCI6MTcyNDkwOTQ2MCwiZXhwIjoxNzI3NTAxNDYwLCJpc3MiOiJwdWItMjQzMTEyOSIsInN1YiI6InJlYWN0aW9uIn0.sB6gVgVEMo4ZBZA44fsZmp_c6EBYvRc-tBHyN762xG8&utm_medium=email&utm_campaign=email-reaction&r=6n74v> >> Comment >> <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&isFreemail=true&comments=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA&r=6n74v&utm_campaign=email-half-magic-comments&action=post-comment&utm_source=substack&utm_medium=email> >> Restack >> <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9vcGVuLnN1YnN0YWNrLmNvbS9wdWIvaW1wbGVtZW50aW5ncXVhbnRsaWIvcC9zY2hlZHVsZXMtaW4tcXVhbnRsaWI_dXRtX3NvdXJjZT1zdWJzdGFjayZ1dG1fbWVkaXVtPWVtYWlsJnV0bV9jYW1wYWlnbj1lbWFpbC1yZXN0YWNrLWNvbW1lbnQmYWN0aW9uPXJlc3RhY2stY29tbWVudCZyPTZuNzR2JnRva2VuPWV5SjFjMlZ5WDJsa0lqb3hNVEUyTURBek1Td2ljRzl6ZEY5cFpDSTZNVFE0TURjeU16VTVMQ0pwWVhRaU9qRTNNalE1TURrME5qQXNJbVY0Y0NJNk1UY3lOelV3TVRRMk1Dd2lhWE56SWpvaWNIVmlMVEkwTXpFeE1qa2lMQ0p6ZFdJaU9pSndiM04wTFhKbFlXTjBhVzl1SW4wLjg1T25wSjh2YW82S1dmb2kxZWFQMnJGNW50Qm1GUjVKTEotWmp1QTdmdEEiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.E93_m7YsoFZzpil4XdpBCcvzhGiQOxaCifb9BX4qVyU?&utm_source=substack&utm_medium=email> >> >> >> © 2024 Luigi Ballabio >> Unsubscribe >> <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9pbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20vYWN0aW9uL2Rpc2FibGVfZW1haWw_dG9rZW49ZXlKMWMyVnlYMmxrSWpveE1URTJNREF6TVN3aWNHOXpkRjlwWkNJNk1UUTRNRGN5TXpVNUxDSnBZWFFpT2pFM01qUTVNRGswTmpBc0ltVjRjQ0k2TVRjMU5qUTBOVFEyTUN3aWFYTnpJam9pY0hWaUxUSTBNekV4TWpraUxDSnpkV0lpT2lKa2FYTmhZbXhsWDJWdFlXbHNJbjAuSGhMSEJmRXlZWDZMLVJkV3p0X21WcGw5cElfU0lqV0FQZ3VuZDhCRllNNCIsInAiOjE0ODA3MjM1OSwicyI6MjQzMTEyOSwiZiI6dHJ1ZSwidSI6MTExNjAwMzEsImlhdCI6MTcyNDkwOTQ2MCwiZXhwIjoxNzI3NTAxNDYwLCJpc3MiOiJwdWItMCIsInN1YiI6ImxpbmstcmVkaXJlY3QifQ.7hYEpbmfPteAplYUa0TsI3ghXcX5gGEedAA-BrI5yoY?> >> >> [image: Get the app] >> <https://substack.com/redirect/6aaa26eb-860b-40a4-aaca-148a2fcbcd99?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg>[image: >> Start writing] >> <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9zdWJzdGFjay5jb20vc2lnbnVwP3V0bV9zb3VyY2U9c3Vic3RhY2smdXRtX21lZGl1bT1lbWFpbCZ1dG1fY29udGVudD1mb290ZXImdXRtX2NhbXBhaWduPWF1dG9maWxsZWQtZm9vdGVyJmZyZWVTaWdudXBFbWFpbD1pZ2l0dXJAZ21haWwuY29tJnI9Nm43NHYiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.IRAhmOitvOwB23-qSnqo2ANBKQmkWzs-PEHFPPaNWpc?> >> > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > |
From: Richard M. <dr....@gm...> - 2024-08-29 17:22:25
|
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Perfect, many thanks <div>Rich</div><div><br></div><div><br id="lineBreakAtBeginningOfSignature"><div dir="ltr">Sent from my iPhone</div><div dir="ltr"><br><blockquote type="cite">On 29 Aug 2024, at 18:09, Tolan, Robert <rob...@nb...> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"> Here is the Substack link!<br> <br> </div> <div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"> <a href="https://implementingquantlib.substack.com/p/schedules-in-quantlib?utm_source=post-email-title&publication_id=2431129&post_id=148072359&utm_campaign=email-post-title&isFreemail=true&r=6n74v&triedRedirect=true&utm_medium=email" id="OWA9f056cae-6263-1d78-28d3-fcefdb298a7f" class="OWAAutoLink">Schedules in QuantLib - by Luigi Ballabio (substack.com)</a></div> <div id="appendonsend"></div> <hr style="display:inline-block;width:98%" tabindex="-1"> <div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Richard Marshall <dr....@gm...><br> <b>Sent:</b> Thursday, August 29, 2024 13:04<br> <b>To:</b> qua...@li... <qua...@li...><br> <b>Subject:</b> Re: [Quantlib-dev] QuantLib-dev Digest, Vol 195, Issue 1</font> <div> </div> </div> <div class="BodyFragment"><font size="2"><span style="font-size:11pt;"> <div class="PlainText">[You don't often get email from dr....@gm.... Learn why this is important at <a href="https://aka.ms/LearnAboutSenderIdentification">https://aka.ms/LearnAboutSenderIdentification</a> ]<br> <br> Hi hi,<br> <br> With apologies for being a bit behind… could you share details of how to access the blog ?<br> <br> Cheers<br> Rich<br> <br> Sent from my iPhone<br> <br> > On 29 Aug 2024, at 08:37, qua...@li... wrote:<br> > Send QuantLib-dev mailing list submissions to<br> > qua...@li...<br> ><br> > To subscribe or unsubscribe via the World Wide Web, visit<br> > <a href="https://lists.sourceforge.net/lists/listinfo/quantlib-dev">https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fquantlib-dev&data=05%7C02%7Crobert.tolan%40nbim.no%7C85b0dc28e89a42de57c508dcc84cc890%7C4a653e38cdfe40468620e0fa13765079%7C0%7C0%7C638605479321983118%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=iyiZrVOO0Irh5M70dxQVSjT2IXgccse6rYJQdClH0GA%3D&reserved=0</a><br> > or, via email, send a message with subject or body 'help' to<br> > qua...@li...<br> ><br> > You can reach the person managing the list at<br> > qua...@li...<br> ><br> > When replying, please edit your Subject line so it is more specific<br> > than "Re: Contents of QuantLib-dev digest..."<br> > Today's Topics:<br> ><br> > 1. Re: Schedules in QuantLib (Francois Botha)<br> > <mime-attachment><br> > _______________________________________________<br> > QuantLib-dev mailing list<br> > Qua...@li...<br> > <a href="https://lists.sourceforge.net/lists/listinfo/quantlib-dev">https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fquantlib-dev&data=05%7C02%7Crobert.tolan%40nbim.no%7C85b0dc28e89a42de57c508dcc84cc890%7C4a653e38cdfe40468620e0fa13765079%7C0%7C0%7C638605479321992495%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=gW%2Bymh%2BIko0p8uL%2BKYnwmh4KgGzVp9JPASqlrTxZnuk%3D&reserved=0</a><br> <br> <br> _______________________________________________<br> QuantLib-dev mailing list<br> Qua...@li...<br> <a href="https://lists.sourceforge.net/lists/listinfo/quantlib-dev">https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fquantlib-dev&data=05%7C02%7Crobert.tolan%40nbim.no%7C85b0dc28e89a42de57c508dcc84cc890%7C4a653e38cdfe40468620e0fa13765079%7C0%7C0%7C638605479321999643%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=te3LIMCJ3RcFlLEbT%2FHc37ecORB2Hdsx%2Fd2CP8XlfDk%3D&reserved=0</a><br> </div> </span></font></div> <p><font size="1" color="grey" face="Arial"><i>This e-mail is confidential and may contain information that is privileged. If you are not the intended recipient, please notify the sender immediately and delete this e-mail. Any unauthorised review, use, disclosure, dissemination or copying of this e-mail is prohibited. Norges Bank does not accept liability for any loss or damage of any nature, however caused, which may result directly or indirectly from this e-mail or any file attached, including malicious software and other defects.</i></font></p> </div></blockquote></div></body></html> |
From: Richard M. <dr....@gm...> - 2024-08-29 17:04:34
|
Hi hi, With apologies for being a bit behind… could you share details of how to access the blog ? Cheers Rich Sent from my iPhone > On 29 Aug 2024, at 08:37, qua...@li... wrote: > Send QuantLib-dev mailing list submissions to > qua...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > or, via email, send a message with subject or body 'help' to > qua...@li... > > You can reach the person managing the list at > qua...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of QuantLib-dev digest..." > Today's Topics: > > 1. Re: Schedules in QuantLib (Francois Botha) > <mime-attachment> > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
From: Francois B. <ig...@gm...> - 2024-08-29 07:37:22
|
Hi Luigi, Thanks again for your informative blog post. As before, it triggered something. One of the nuances of valuing our local bonds is that some bonds pay semiannual coupons on 28 Feb and 31 Aug every year, whether it is a leap year or not. The Feb coupon is always payable on 28 Feb (with Following business day convention otherwise). One of these bonds also matures on 28 Feb 2048 (the South African R2048 bond), which is in a leap year. This makes the normal schedule generation not possible (as far as I know), so I usually have to build a custom date vector and pass it to a schedule. Is this solvable in a more elegant way? I originally thought of adding a new DateGeneration:NoLeapDays enum value, but this feature is probably something one would want to use in conjunction with the existing DateGeneration values. Maybe then a new class/property on the schedule to enable this? Looking forward to your comments (and next blog post). thanks Francois Botha On Thu, 29 Aug 2024 at 07:31, Luigi Ballabio from Implementing QuantLib < imp...@su...> wrote: > Hello again! This post was originally published in the March 2024 issue of > Wilmott Magazine. > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ > Forwarded this email? Subscribe here > <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9pbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20vc3Vic2NyaWJlP3V0bV9zb3VyY2U9ZW1haWwmdXRtX2NhbXBhaWduPWVtYWlsLXN1YnNjcmliZSZyPTZuNzR2Jm5leHQ9aHR0cHMlM0ElMkYlMkZpbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20lMkZwJTJGc2NoZWR1bGVzLWluLXF1YW50bGliIiwicCI6MTQ4MDcyMzU5LCJzIjoyNDMxMTI5LCJmIjp0cnVlLCJ1IjoxMTE2MDAzMSwiaWF0IjoxNzI0OTA5NDYwLCJleHAiOjE3Mjc1MDE0NjAsImlzcyI6InB1Yi0wIiwic3ViIjoibGluay1yZWRpcmVjdCJ9.g-lp_1nL_0_WmPfMTi8LL4h8y2E5GSg3djDV7OV0jjg?> > for more > > <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9pbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20vcC9zY2hlZHVsZXMtaW4tcXVhbnRsaWI_dXRtX2NhbXBhaWduPWVtYWlsLWhhbGYtcG9zdCZyPTZuNzR2JnRva2VuPWV5SjFjMlZ5WDJsa0lqb3hNVEUyTURBek1Td2ljRzl6ZEY5cFpDSTZNVFE0TURjeU16VTVMQ0pwWVhRaU9qRTNNalE1TURrME5qQXNJbVY0Y0NJNk1UY3lOelV3TVRRMk1Dd2lhWE56SWpvaWNIVmlMVEkwTXpFeE1qa2lMQ0p6ZFdJaU9pSndiM04wTFhKbFlXTjBhVzl1SW4wLjg1T25wSjh2YW82S1dmb2kxZWFQMnJGNW50Qm1GUjVKTEotWmp1QTdmdEEiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.y_ysg6ed95CdRAJClcmn2N6PD7w0mLLhwAfivLrIWFA?> > Schedules in QuantLib > <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=post-email-title&utm_campaign=email-post-title&isFreemail=true&r=6n74v&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA> > > Luigi Ballabio <https://substack.com/@lballabio> > Aug 29 > <https://substack.com/@lballabio> > > > <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&isFreemail=true&submitLike=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJyZWFjdGlvbiI6IuKdpCIsImlhdCI6MTcyNDkwOTQ2MCwiZXhwIjoxNzI3NTAxNDYwLCJpc3MiOiJwdWItMjQzMTEyOSIsInN1YiI6InJlYWN0aW9uIn0.sB6gVgVEMo4ZBZA44fsZmp_c6EBYvRc-tBHyN762xG8&utm_medium=email&utm_campaign=email-reaction&r=6n74v> > > <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&isFreemail=true&comments=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA&r=6n74v&utm_campaign=email-half-magic-comments&action=post-comment&utm_source=substack&utm_medium=email> > > <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&utm_content=share&utm_campaign=email-share&action=share&triggerShare=true&isFreemail=true&r=6n74v&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA> > > <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9vcGVuLnN1YnN0YWNrLmNvbS9wdWIvaW1wbGVtZW50aW5ncXVhbnRsaWIvcC9zY2hlZHVsZXMtaW4tcXVhbnRsaWI_dXRtX3NvdXJjZT1zdWJzdGFjayZ1dG1fbWVkaXVtPWVtYWlsJnV0bV9jYW1wYWlnbj1lbWFpbC1yZXN0YWNrLWNvbW1lbnQmYWN0aW9uPXJlc3RhY2stY29tbWVudCZyPTZuNzR2JnRva2VuPWV5SjFjMlZ5WDJsa0lqb3hNVEUyTURBek1Td2ljRzl6ZEY5cFpDSTZNVFE0TURjeU16VTVMQ0pwWVhRaU9qRTNNalE1TURrME5qQXNJbVY0Y0NJNk1UY3lOelV3TVRRMk1Dd2lhWE56SWpvaWNIVmlMVEkwTXpFeE1qa2lMQ0p6ZFdJaU9pSndiM04wTFhKbFlXTjBhVzl1SW4wLjg1T25wSjh2YW82S1dmb2kxZWFQMnJGNW50Qm1GUjVKTEotWmp1QTdmdEEiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.E93_m7YsoFZzpil4XdpBCcvzhGiQOxaCifb9BX4qVyU?&utm_source=substack&utm_medium=email> > > READ IN APP > <https://open.substack.com/pub/implementingquantlib/p/schedules-in-quantlib?utm_source=email&redirect=app-store> > > > Hello again! This post was originally published in the March 2024 issue of > Wilmott Magazine. The full source code is available on my Tutorial page > <https://substack.com/redirect/a0e37dcd-d154-4ed3-aeaa-4f3550905f1c?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg>, > together with code from other articles and, when available, either the > articles themselves or corresponding blog posts like this one. > Schedules in QuantLib > > For this article, I thought I’d try something new: I won’t completely > change the subject from what I covered in the last issue, that is, calendars > and holidays > <https://substack.com/redirect/685b5a65-f9e1-45e7-9d95-57986f55d8fd?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg>. > This month, I’ll start from there and show how to use QuantLib to generate > schedules, i.e., regular sequences of dates, choosing from a number of > market conventions. In turn, those can be used to create sequences of > coupons; but that’s something for another time. What I will also show, > instead, is a C++ technique that can come useful at times. Off we go. > Some examples > > We can build a schedule with as little information as a start date, an end > date, and a frequency. Here is the corresponding call: > > Schedule s = MakeSchedule() > .from(Date(11, May, 2021)) > .to(Date(11, May, 2025)) > .withFrequency(Semiannual); > > If you then write something like > > for (auto date : s) > std::cout << date << std::endl; > > you’ll see the dates listed in the table below. Unsurprisingly, it is a > sequence of alternating May 11th and November 11th from the start date to > the end date; they are both included. > > <https://substack.com/redirect/37472cb9-17d8-4c0c-adaf-e956754aa0eb?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > > When building coupons from this schedule, the understanding is that the > first date in the schedule is the start of the first coupon; the second > date is both the end of the first coupon and the start of the second; the > third date is the end of the second coupon and the start of the third; > until we get to the last date, which is the end of the last coupon. > Adjusting for holidays > > The above schedule didn’t make a distinction between holidays and business > days. If we want holidays to be adjusted, we need to choose a calendar: > > Schedule s = MakeSchedule() > .from(Date(11, May, 2021)) > .to(Date(11, May, 2025)) > .withFrequency(Semiannual) > .withCalendar(TARGET()); > > The above generates the schedule in the next table. As you can see, a few > dates are no longer the 11th of the month and were replaced with the next > business day. In this case, those dates fell on Saturdays or Sundays, but > of course the adjustment would also be performed if they were mid-week > holidays. > > <https://substack.com/redirect/ae8057c5-7ee5-420c-af4f-cb7978fa34c3?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > > For convenience, it’s possible to pass a calendar and at the same time > specify that dates should be unadjusted; here is the corresponding call: > > Schedule s = MakeSchedule() > .from(Date(11, May, 2021)) > .to(Date(11, May, 2025)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .withConvention(Unadjusted); > > The result is the same as the one we got when we didn’t pass a calendar. > As I said, this is a convenience; when reading data from a file or a DB, it > makes it unnecessary to write logic that chooses whether or not to pass a > calendar. > Short and long coupons > > If the start and end dates don’t bracket a whole number of periods, it > becomes important to specify whether the dates should be generated forwards > from the start date or backwards from the end date; the default is to > generate them backwards, but it’s probably better to be explicit. The > corresponding calls are as follows: > > Schedule s1 = MakeSchedule() > .from(Date(11, May, 2021)) > .to(Date(11, February, 2025)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .forwards(); > > Schedule s2 = MakeSchedule() > .from(Date(11, May, 2021)) > .to(Date(11, February, 2025)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .backwards(); > > The results are shown in the table below. In the first case, we ended up > with a short last coupon; in the second, with a short first coupon. > > <https://substack.com/redirect/79b2a55d-55e3-4ef7-b18a-f815310c4b21?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > > It’s also possible to specify a long coupon by passing an explicit stub: > > Schedule s = MakeSchedule() > .from(Date(11, February, 2021)) > .to(Date(11, May, 2025)) > .withFirstDate(Date(11, November, 2021)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .forwards(); > > The result is shown below. In case of a long last coupon, you can use the > withNextToLastDate method instead of withFirstDate; the two can also be > used together. > > <https://substack.com/redirect/9c91b185-1084-427d-9240-b6ccdaf3ced1?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > End of month > > When the dates are close to the end of their month, other conventions can > come into play. The default behavior is to generate dates as usual; the call > > Schedule s = MakeSchedule() > .from(Date(28, February, 2019)) > .to(Date(28, February, 2023)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .forwards(); > > results in the dates shown in the next table, where for instance February > 28th 2021, a Sunday, is adjusted to March 1st according to the “following” > convention. > > <https://substack.com/redirect/bb5d3306-b554-4057-a7ac-852c9da94366?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > > However, if another convention such as “modified following” needs to be > used, it can be passed to the call: > > Schedule s = MakeSchedule() > .from(Date(28, February, 2019)) > .to(Date(28, February, 2023)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .withConvention(ModifiedFollowing) > .forwards(); > > The result is displayed below and shows that February 28th 2021 is > adjusted back to February 26th so that it doesn’t change month. > > <https://substack.com/redirect/eba5b21f-42f4-49ab-b7d4-3a339fd9a827?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > > Also, in some cases, the terms of an instrument might stipulate that > coupons reset on the last business day of the month; in that case, the > schedule can be generated with: > > Schedule s = MakeSchedule() > .from(Date(28, February, 2019)) > .to(Date(28, February, 2023)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .forwards() > .endOfMonth(); > > The result is shown next; by comparing it with the tables above, you can > see the difference of behavior for the dates at the end of August. > > <https://substack.com/redirect/5d65c482-eda7-47a4-98e7-70c6b2f0bee2?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > Specialized rules > > The forwards and backwards methods shown above are shorthand for calls to > a more general method withRule that allows to specify a generation rule > (“forwards” and “backwards” being two such rules.) Other, more specialized > rules are available; for instance, if you needed to generate the schedule > for the payments of a standard 5-years credit default swap, you would do it > as follows: > > auto tradeDate = Date(11, March, 2021); > auto tenor = Period(5, Years); > auto maturityDate = > cdsMaturity(tradeDate, tenor, > DateGeneration::CDS2015); > > Schedule s = MakeSchedule() > .from(tradeDate) > .to(maturityDate) > .withFrequency(Quarterly) > .withCalendar(TARGET()) > .withRule(DateGeneration::CDS2015); > > First, the cdsMaturity function returns the standardized maturity date > for the passed trade date; for March 11th 2021, that would be December 20th > 2025 (it would roll to June 2025 only later in March.) Then, we pass the > calculated maturity date to MakeSchedule while also specifying a CDS2015 > date-generation rule; this recalculates the start date of the CDS and also > adjusts all the dates in the schedule to the twentieth of their months or > the next business day. The result is shown below. > > <https://substack.com/redirect/39ba32d3-8058-4b41-983a-e7f7b19eef80?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg> > > This covers most of the functionality of schedules in QuantLib. However, > you might still be curious about one thing. What about the syntax of > MakeSchedule? Why aren’t we using a constructor like all decent folks, > and what happens when we chain all those method calls? > The Named Parameter idiom > > The Schedule class does have a constructor, of course, but it’s a bit > awkward to use. As the time of this writing, corresponding to QuantLib > 1.32, its signature is: > > Schedule(Date effectiveDate, > const Date& terminationDate, > const Period& tenor, > Calendar calendar, > BusinessDayConvention convention, > BusinessDayConvention > terminationDateConvention, > DateGeneration::Rule rule, > bool endOfMonth, > const Date& firstDate, > const Date& nextToLastDate); > > This means it requires a whole lot of parameters, even in the simplest > case. Reasonable defaults exist for some of them (a null calendar, > following for the conventions, backwards for the generation rule, false for > the end of month, and no first or next-to-last date) but if we added them, > we’d run into another problem. When we’re good with most of the default > parameters but want to change one of the last ones (say, firstDate), > there’s no easy syntax we can use for the call. In Python, which supports > named parameters, we’d say > > s = Schedule( > Date(11, February, 2021), > Date(11, May, 2025), > Period(6, Months), > firstDate = Date(11, November, 2021), > ) > > but in C++, we’d have to pass all the parameters before firstDate, even > if they all equal the defaults. > > The solution? The Named Parameter idiom (a.k.a Fluent Interface). We write > a helper class, MakeSchedule in our case, which contains the parameters > needed to build a schedule and gives them sensible default values: > > class MakeSchedule { > ... > private: > Calendar calendar_; > Date effectiveDate_; > Date terminationDate_; > Period tenor_; > BusinessDayConvention convention_ = Following; > DateGeneration::Rule rule_ = > DateGeneration::Backward; > bool endOfMonth_ = false; > Date firstDate_ = Date(); > Date nextToLastDate_ = Date(); > }; > > Settings the parameters > > To set the values of the parameters, we give MakeSchedule a number of > setter methods; the twist here is that each of these methods returns the > object itself, making it possible to chain them. > > class MakeSchedule { > public: > MakeSchedule& from(const Date& effectiveDate) { > effectiveDate_ = effectiveDate; > return *this; > } > > MakeSchedule& to(const Date& terminationDate) { > terminationDate_ = terminationDate; > return *this; > } > > MakeSchedule& withTenor(const Period& tenor) { > tenor_ = tenor; > return *this; > } > > MakeSchedule& forwards() { > rule_ = DateGeneration::Forward; > return *this; > } > > ... > }; > > Getting our schedule > > At this point, we’re able to write > > MakeSchedule() > .from(Date(11, May, 2021)) > .to(Date(11, February, 2025)) > .withFrequency(Semiannual) > .withCalendar(TARGET()) > .forwards() > > but the result is still a MakeSchedule instance, not a schedule. In order > to build the latter, we could add an explicit to_schedule() method that > calls the Schedule constructor and returns the result. However, we went > for a fancier solution. > > A little-used feature of C++ are user-defined conversion functions. You > can google them for details, but the gist is that, if A and B are two > unrelated classes, you can give B a method which returns an instance of A, > declared as > > class B { > public: > operator A() const; > ... > }; > > and if you then write > > B b; > A a = b; > > the compiler will look first for an A constructor taking a B instance, > and then (after seeing it isn’t there) it will look into B, find the > conversion method, invoke it, and assign to a the instance of A returned > by it. > > In our case, the conversion function will be declared in MakeSchedule as > > class MakeSchedule { > public: > ... > > operator Schedule() const; > }; > > and its implementation will call the Schedule constructor with the > required parameters and return the resulting schedule. Putting everything > together, we get the syntax > > Schedule s = MakeSchedule() > .from(Date(11, May, 2021)) > .to(Date(11, May, 2025)) > .withFrequency(Semiannual) > .withCalendar(TARGET()); > > used in the examples. And in case you were wondering why I didn’t use the > shorter syntax, note that using auto s above would not trigger the > assignment operator; it would assign to s the MakeSchedule instance. > > And with this, we can bring this article to a close. See you next time! > > > Share > <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&utm_content=share&utm_campaign=email-share&action=share&triggerShare=true&isFreemail=true&r=6n74v&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA> > > > Like > <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&isFreemail=true&submitLike=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJyZWFjdGlvbiI6IuKdpCIsImlhdCI6MTcyNDkwOTQ2MCwiZXhwIjoxNzI3NTAxNDYwLCJpc3MiOiJwdWItMjQzMTEyOSIsInN1YiI6InJlYWN0aW9uIn0.sB6gVgVEMo4ZBZA44fsZmp_c6EBYvRc-tBHyN762xG8&utm_medium=email&utm_campaign=email-reaction&r=6n74v> > Comment > <https://substack.com/app-link/post?publication_id=2431129&post_id=148072359&utm_source=substack&utm_medium=email&isFreemail=true&comments=true&token=eyJ1c2VyX2lkIjoxMTE2MDAzMSwicG9zdF9pZCI6MTQ4MDcyMzU5LCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTI0MzExMjkiLCJzdWIiOiJwb3N0LXJlYWN0aW9uIn0.85OnpJ8vao6KWfoi1eaP2rF5ntBmFR5JLJ-ZjuA7ftA&r=6n74v&utm_campaign=email-half-magic-comments&action=post-comment&utm_source=substack&utm_medium=email> > Restack > <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9vcGVuLnN1YnN0YWNrLmNvbS9wdWIvaW1wbGVtZW50aW5ncXVhbnRsaWIvcC9zY2hlZHVsZXMtaW4tcXVhbnRsaWI_dXRtX3NvdXJjZT1zdWJzdGFjayZ1dG1fbWVkaXVtPWVtYWlsJnV0bV9jYW1wYWlnbj1lbWFpbC1yZXN0YWNrLWNvbW1lbnQmYWN0aW9uPXJlc3RhY2stY29tbWVudCZyPTZuNzR2JnRva2VuPWV5SjFjMlZ5WDJsa0lqb3hNVEUyTURBek1Td2ljRzl6ZEY5cFpDSTZNVFE0TURjeU16VTVMQ0pwWVhRaU9qRTNNalE1TURrME5qQXNJbVY0Y0NJNk1UY3lOelV3TVRRMk1Dd2lhWE56SWpvaWNIVmlMVEkwTXpFeE1qa2lMQ0p6ZFdJaU9pSndiM04wTFhKbFlXTjBhVzl1SW4wLjg1T25wSjh2YW82S1dmb2kxZWFQMnJGNW50Qm1GUjVKTEotWmp1QTdmdEEiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.E93_m7YsoFZzpil4XdpBCcvzhGiQOxaCifb9BX4qVyU?&utm_source=substack&utm_medium=email> > > > © 2024 Luigi Ballabio > Unsubscribe > <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9pbXBsZW1lbnRpbmdxdWFudGxpYi5zdWJzdGFjay5jb20vYWN0aW9uL2Rpc2FibGVfZW1haWw_dG9rZW49ZXlKMWMyVnlYMmxrSWpveE1URTJNREF6TVN3aWNHOXpkRjlwWkNJNk1UUTRNRGN5TXpVNUxDSnBZWFFpT2pFM01qUTVNRGswTmpBc0ltVjRjQ0k2TVRjMU5qUTBOVFEyTUN3aWFYTnpJam9pY0hWaUxUSTBNekV4TWpraUxDSnpkV0lpT2lKa2FYTmhZbXhsWDJWdFlXbHNJbjAuSGhMSEJmRXlZWDZMLVJkV3p0X21WcGw5cElfU0lqV0FQZ3VuZDhCRllNNCIsInAiOjE0ODA3MjM1OSwicyI6MjQzMTEyOSwiZiI6dHJ1ZSwidSI6MTExNjAwMzEsImlhdCI6MTcyNDkwOTQ2MCwiZXhwIjoxNzI3NTAxNDYwLCJpc3MiOiJwdWItMCIsInN1YiI6ImxpbmstcmVkaXJlY3QifQ.7hYEpbmfPteAplYUa0TsI3ghXcX5gGEedAA-BrI5yoY?> > > [image: Get the app] > <https://substack.com/redirect/6aaa26eb-860b-40a4-aaca-148a2fcbcd99?j=eyJ1IjoiNm43NHYifQ.2BvNVSYTXVj4Jl36nKPPVi0V9dvSTHmeQ67a-Xs1HCg>[image: > Start writing] > <https://substack.com/redirect/2/eyJlIjoiaHR0cHM6Ly9zdWJzdGFjay5jb20vc2lnbnVwP3V0bV9zb3VyY2U9c3Vic3RhY2smdXRtX21lZGl1bT1lbWFpbCZ1dG1fY29udGVudD1mb290ZXImdXRtX2NhbXBhaWduPWF1dG9maWxsZWQtZm9vdGVyJmZyZWVTaWdudXBFbWFpbD1pZ2l0dXJAZ21haWwuY29tJnI9Nm43NHYiLCJwIjoxNDgwNzIzNTksInMiOjI0MzExMjksImYiOnRydWUsInUiOjExMTYwMDMxLCJpYXQiOjE3MjQ5MDk0NjAsImV4cCI6MTcyNzUwMTQ2MCwiaXNzIjoicHViLTAiLCJzdWIiOiJsaW5rLXJlZGlyZWN0In0.IRAhmOitvOwB23-qSnqo2ANBKQmkWzs-PEHFPPaNWpc?> > |
From: Luigi B. <lui...@gm...> - 2024-07-23 07:38:39
|
QuantLib 1.35 is available for download at < https://www.quantlib.org/download.shtml>; precompiled binaries are also available from PyPI and NuGet for Python and C# respectively. The list of changes for this release is at < https://www.quantlib.org/reference/history.html>. If you have any problems with this release, please report them here on the QuantLib mailing list (<qua...@li...>), or open a GitHub issue at <https://github.com/lballabio/quantlib/issues>. |
From: Peter C. <pca...@gm...> - 2024-07-08 17:16:32
|
Just to close the loop. The generation of the polynomials of degree <= 27 with the Galois package took roughly 50 CPU hours, I submitted the result here: https://github.com/lballabio/QuantLib/pull/2012 Not sure if we want to blow up the file like that in the "standard edition" of QuantLib, to be discussed. For now we'll include it in our QuantLib fork to support high-dimensional xva simulations. Peter Jäckel gave permission to use the file from his book as well in the meantime. I just don't have it and the calculation was underway in any case. And it's probably also nice to be able to reproduce and verify the data at any time using an open source python package. Or generate even more polynomials, who knows. Best Peter On Sun, 7 Jul 2024 at 12:19, Peter Caspers <pca...@gm...> wrote: > > I am looking at Galois > > https://mhostetter.github.io/galois/latest/ > > which allows us to generate this data pretty easily. > > I did some spot checks to confirm that the output is consistent with > the existing file in QuantLib. > > I'll give it a try and see whether I can get the data in a finite time... > > Best > Peter > > > On Fri, 5 Jul 2024 at 16:52, Peter Caspers <pca...@gm...> wrote: > > > > Hi, > > > > I would like to add primitive polynomials up to degree 27 to > > QuantLib's primitivepolynomials.cpp as provided "on the CD > > accompanying the book Monte Carlo Methods in Finance" by Peter Jäckel, > > see the comments in that file. > > > > My understanding is that polynomials with degree 19 and greater were > > omitted for practical reasons, but there is no copyright issue or > > anything like that with adding them? Also, it would probably be nice > > to save Peter Jäckel's works in the QuantLib code base. > > > > So anyway, I would hope that Peter is maybe on this list and could > > confirm that it is okay to extend the code? Or someone who has his > > contact details could forward this request to him? > > > > Thanks > > Peter |
From: Peter C. <pca...@gm...> - 2024-07-07 10:19:59
|
I am looking at Galois https://mhostetter.github.io/galois/latest/ which allows us to generate this data pretty easily. I did some spot checks to confirm that the output is consistent with the existing file in QuantLib. I'll give it a try and see whether I can get the data in a finite time... Best Peter On Fri, 5 Jul 2024 at 16:52, Peter Caspers <pca...@gm...> wrote: > > Hi, > > I would like to add primitive polynomials up to degree 27 to > QuantLib's primitivepolynomials.cpp as provided "on the CD > accompanying the book Monte Carlo Methods in Finance" by Peter Jäckel, > see the comments in that file. > > My understanding is that polynomials with degree 19 and greater were > omitted for practical reasons, but there is no copyright issue or > anything like that with adding them? Also, it would probably be nice > to save Peter Jäckel's works in the QuantLib code base. > > So anyway, I would hope that Peter is maybe on this list and could > confirm that it is okay to extend the code? Or someone who has his > contact details could forward this request to him? > > Thanks > Peter |