|
From: Magnus G. <mag...@ho...> - 2026-02-24 13:27:54
|
Hi all, I am using QuantLib across python and excel (the latter of which has had all inflation related classes and any required processes updated to 1.39 as a hybrid build) and currently experiencing some issues on building inflation curves. My issue is that when the months change, for the first few days of each month, calculations using the inflation curve fail due to the "root is not bracketed"-error. For instance, on February 3rd my setup failed although it was fully functional at the end of January. I've tried to broaden the bands for the guesses without luck in inflationtraits.hpp: constexpr double maxInflation = 0.5; The error is the same in both my tests in python and excel. Ive attached my python code, for reference! The errors in excel/Python: Excel: "ZeroInflationTSZeroRate - 1st iteration: failed at 3rd alive instrument, pillar May 1st, 2026, maturity May 1st, 2026, reference date December 1st, 2025: root not bracketed: f[-0.5,0.5] -> [-2.184665e-01,-2.960285e-01]" Python: "RuntimeError: 1st iteration: failed at 3rd alive instrument, pillar May 1st, 2026, maturity May 1st, 2026, reference date December 1st, 2025: root not bracketed: f[-0.5,0.5] -> [-2.184665e-01,-2.960285e-01]" Note, the same error is produced when valuing swaps using the curve. Observations: * During debugging, values seem reasonable across the board. No unexpected anomalies in forecasted index fixings and corresponding rate calculations. (Excel) * When I change the settlement date to the 13th of Feb the calculations work just fine. (Excel) * Removing the first 7 ratehelpers (and reducing noisy short term data) makes calculations work again. (Excel) * Flat interpolation works fine, but using linear as I intend causes issues. (Python / excel) * Reducing curve accuracy has no effect (fails at 1st iteration). (excel) Please find details on my current setup below: Inflation setup: Index: EUHICPXT Base date: Dec25 @ 128.89 Frequency: Monthly Curve: PiecewiseZeroInflationCurve Calendar: Target DayCount: Simple Convention: Modified Following Settlement days: 0 Settlement date: 03. Feb 2026 Lag: 3m Seasonality: Omitted for testing purposes / or set to 1 for all months Interpolation: Linear (Flat does not produce an error interestingly enough) Curve Accuracy: 1.00E-09 ZCISratehelpers Tenor & Example Prices: Tenor Rate 3m -2.81% 4m -0.73% 5m 1.17% 6m 2.27% 7m 2.19% 8m 2.22% 9m 1.75% 10m 1.86% 11m 1.74% 1y 1.82% 15m 1.46% 18m 2.19% 21m 2.08% 2y 1.78% 3y 1.84% 4y 1.88% 5y 1.90% 6y 1.92% 7y 1.95% 8y 1.97% 9y 1.99% 10y 2.01% 12y 2.06% 15y 2.11% 20y 2.19% 25y 2.24% 30y 2.29% Any help or insights would be greatly appreciated! Have a great week, everyone. Kind regards, Magnus |