diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index 0775a908323..7aff9ea4fd6 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -6,7 +6,7 @@ on: pull_request: jobs: coverage: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Setup diff --git a/.github/workflows/devenv-images.yml b/.github/workflows/devenv-images.yml index f2fb566da40..c1eb19ec231 100644 --- a/.github/workflows/devenv-images.yml +++ b/.github/workflows/devenv-images.yml @@ -6,7 +6,7 @@ on: description: 'Boost version' required: true env: - ROLLING: noble + ROLLING: oracular jobs: docker-images: runs-on: ubuntu-latest diff --git a/.github/workflows/macos-nondefault.yml b/.github/workflows/macos-nondefault.yml index 2b4f1d9a81d..7a9286516c9 100644 --- a/.github/workflows/macos-nondefault.yml +++ b/.github/workflows/macos-nondefault.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-12, macos-13, macos-14] + os: [macos-13, macos-14] classes: [boost, std] include: - classes: std diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index fa61ac1d010..a034797d727 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-12, macos-13, macos-14] + os: [macos-13, macos-14] steps: - uses: actions/checkout@v4 - name: Setup diff --git a/CMakeLists.txt b/CMakeLists.txt index 130faeab9e2..b9266a30642 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,14 +5,14 @@ cmake_policy(SET CMP0091 NEW) # Version info set(QUANTLIB_VERSION_MAJOR 1) -set(QUANTLIB_VERSION_MINOR 36) +set(QUANTLIB_VERSION_MINOR 37) set(QUANTLIB_VERSION_PATCH 0) set(QUANTLIB_VERSION ${QUANTLIB_VERSION_MAJOR}.${QUANTLIB_VERSION_MINOR}.${QUANTLIB_VERSION_PATCH}) # Project Info set(PACKAGE_NAME "QuantLib") -set(PACKAGE_VERSION "${QUANTLIB_VERSION}-rc") -set(PACKAGE_VERSION_HEX "0x013600c0") +set(PACKAGE_VERSION "${QUANTLIB_VERSION}-dev") +set(PACKAGE_VERSION_HEX "0x01370000") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/lballabio/QuantLib/issues/") @@ -99,7 +99,7 @@ if (QL_ENABLE_DEFAULT_WARNING_LEVEL) add_compile_options(-W3) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") # lots of warnings - add_compile_options(-Wall -Wno-unknown-pragmas) + add_compile_options(-Wall -Wno-unknown-pragmas -Wno-array-bounds) endif() endif() diff --git a/ChangeLog.txt b/ChangeLog.txt index 56dda1bee32..706473d0fc8 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,72 @@ +commit 85e9489fd486c00fb624fb4c8f10ab227ac2e9e8 +Author: Luigi Ballabio +Date: Sat, 12 Oct 2024 22:55:21 +0200 + + Ignore lcov error + + .github/workflows/coveralls.yml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 4bae7919925f54076c6f7bcb44a15bd8c1d1fb2a +Author: Luigi Ballabio +Date: Sat, 12 Oct 2024 22:38:07 +0200 + + Avoid occasional warning from std::enable_shared_from_this + + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 3074bd85d60aaf477b4c4f609e4da4f0c0d1f553 +Author: Luigi Ballabio +Date: Sat, 12 Oct 2024 20:45:08 +0200 + + Update changelog + + ChangeLog.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +commit 814c9cf074ce4dcb9b8777c03d205856769e6b86 +Author: Luigi Ballabio +Date: Mon, 12 Jul 2021 09:46:54 +0200 + + Set version to 1.36 final. + + CMakeLists.txt | 4 ++-- + configure.ac | 2 +- + ql/version.hpp | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +commit 10be1e1ab186950dcd05147b1676ee048893f99d +Author: Luigi Ballabio +Date: Sat, 12 Oct 2024 20:29:39 +0200 + + Updated release history + + Docs/pages/history.docs | 129 +++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 128 insertions(+), 1 deletion(-) + +commit 4cf029617169cfc1985527a5187113ba105655a2 +Author: Luigi Ballabio +Date: Wed, 4 Oct 2023 11:52:15 +0200 + + Set version to 1.36-rc + + CMakeLists.txt | 4 ++-- + configure.ac | 2 +- + ql/version.hpp | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +commit fc6f3919ba1c85427332f38db5d69be85439d8fd +Author: Luigi Ballabio +Date: Mon, 7 Oct 2024 12:30:47 +0200 + + Update news and changelog + + ChangeLog.txt | 2733 ++++++++++++++++++++++++++++-------------------------- + Contributors.txt | 4 + + News.md | 244 ++--- + 3 files changed, 1551 insertions(+), 1430 deletions(-) + commit 3d27c6b27d232c42965b7afb1684f181219cbc81 Merge: a5d2197cc 64acfbbe2 Author: Luigi Ballabio diff --git a/Docs/pages/history.docs b/Docs/pages/history.docs index b0ca8c4d8db..6618731786c 100644 --- a/Docs/pages/history.docs +++ b/Docs/pages/history.docs @@ -17,7 +17,134 @@ /*! \page history Version history - Release 1.35 - July 2024 + Release 1.36 - October 2024 + + PORTABILITY + - **New minimum C++ standard:** starting from this release, a compiler + supporting C++17 is required. Passing `--enable-std-classes` to + `configure` now causes `std::any` and `std::optional` to be used. + - **End of support:** related to the above, and as announced since + release 1.32, this release drops support Visual C++ 2015, g++ up to + version 6.x, and clang up to version 4. Also, given the testing + environments available on GitHub actions, clang 5 and 6 are no + longer available to us for testing, and the same holds for g++ 7. + Therefore, it is suggested to upgrade to a newer version if + possible. + - **End of support:** this release also removes the configure switch + that allowed to use `boost::tuple`, `boost::function` and + `boost::bind` instead of their `std` counterparts; the `std` classes + were already the default since release 1.32. The corresponding + classes in the `ext` namespace are now deprecated. + - **Future change of default:** in a couple of releases, we're going + to switch the default for `ext::any` and `ext::optional` from the + Boost implementation to the standard one. + + DATES AND CALENDARS + - Added `startOfMonth` and `isStartOfMonth` methods to both `Date` and + `Calendar`; thanks to Francois Botha. + - Added specialized Warsaw Stock Exchange (WSE) calendar to Poland; + thanks to Marcin Bogusz. + - Added a new one-off holiday to South Korean calendar; thanks to + Jongbong An. + + CASH FLOWS + - Made` OvernightIndexedCouponPricer` public and renamed to + `CompoundingOvernightIndexedCouponPricer`, and moved + `ArithmeticAveragedOvernightIndexedCouponPricer` from experimental + to core library; thanks to Ralf Konrad Eckel. + + INDEXES + - **Possibly breaking:** inherited the `Index` class from `Observer` + and added a virtual `pastFixing` method. If you inherited a class + from both `Index` and `Observer`, change your code to avoid + inheriting twice from `Observer`. Thanks to Ralf Konrad Eckel. + - Added currency information to `EquityIndex`; thanks to Ralf Konrad + Eckel. + + INFLATION + - Inflation indexes are now better at deciding when to forecast; + also added a `needsForecast` method that makes the + information available. + - Added `CPI::laggedYoYRate`; also, `YoYInflationCoupon`, + `yoyInflationLeg`, `CappedFlooredYoYInflationCoupon`, + `YearOnYearInflationSwap`, `MakeYoYInflationCapFloor`, + `YearOnYearInflationSwapHelper`, `YoYOptionletHelper` and the + experimental `YoYCapFloorTermPriceSurface` and + `InterpolatedYoYCapFloorTermPriceSurface` can now take an explicit + `CPI::InterpolationType` parameter instead of relying on the index + being defined as interpolated or not. This is a first + step in removing interpolation from `YoYInflationIndex` and moving + it into the coupons where it belongs. + - Added method to YoY inflation index returning the date of the last + available fixing. + + TERM STRUCTURES + - Allow passing a pricer to the constructor of the `OISRateHelper` and + `DatedOISRateHelper` classes; this makes it possible to + use arithmetic averaging of overnight rates. + - Allow custom constraint in non-linear fitting methods; thanks to Kai + Lin. + - Allow creating a swap helper with frequency "Once". + - The `GlobalBootstrap` constructor can now take an optional optimizer + and end criteria, allowing for better configuration; thanks to + Eugene Toder. + + VOLATILITY + - Added exact Bachelier implied-vol formula from Jäckel's paper; thanks + to Peter Caspers. + + + DEPRECATED FEATURES + - **Removed** features deprecated in version 1.31: + - the `BlackVanillaOptionPricer` typedef; + - the constructors of `CPICoupon` taking a `spread` parameter, its + `spread` method, and its protected `spread_` data member; + - the `withSpreads` method of `CPILeg`; + - the protected `adjustedFixing` method and `spread_` data member of + `CPICouponPricer`; + - the `YYAUCPIr`, `YYEUHICPr`, `YYFRHICPr`, `YYUKRPIr`, `YYUSCPIr` + and `YYZACPIr` indexes and the experimental `YYGenericCPIr` class; + - the constructor of `YoYInflationIndex` taking a `ratio` parameter; + - a couple of constructors of `ForwardRateAgreement`; + - the empty files `ql/math/curve.hpp`, `ql/math/lexicographicalview.hpp`, + `ql/termstructures/yield/drifttermstructure.hpp` + and `ql/patterns/composite.hpp`; + - the `const_iterator` and `const_value_iterator` typedefs in the + `Garch11` class; + - the `const_time_iterator`, `const_value_iterator`, + `const_reverse_time_iterator` and `const_reverse_value_iterator` + typedefs and the `cbegin_values`, `cend_values`, `crbegin_values`, + `crend_values`, `cbegin_time`, `cend_time`, `crbegin_time` and + `crend_time` methods of the `TimeSeries` class; + - the `base`, `increment`, `decrement`, `advance` and `distance_to` + method of the `step_iterator` class. + - Deprecated `ext::function`, `ext::bind`, `ext::ref`, `ext::cref`, + `ext::placeholders`, `ext::tuple`, `ext::make_tuple`, `ext::get` and + `ext::tie`; use the corresponding `std::` classes and functions + instead. + - Deprecated the `ArithmeticAverageOIS`, `MakeArithmeticAverageOIS` + and `ArithmeticOISRateHelper` classes; use `OvernightIndexedSwap`, + `MakeOIS` and `OISRateHelper` instead. + - Deprecated the `YoYInflationCoupon`, `yoyInflationLeg`, + `CappedFlooredYoYInflationCoupon`, `YearOnYearInflationSwap`, + `MakeYoYInflationCapFloor`, `YearOnYearInflationSwapHelper`, + `YoYOptionletHelper`, `YoYCapFloorTermPriceSurface` and + `InterpolatedYoYCapFloorTermPriceSurface` constructors that don't + take an explicit CPI interpolation type. + - Deprecated the `getInfo` method of `LevenbergMarquardt`; inspect the + result of `minimize` instead. + - Deprecated the + `ql/experimental/averageois/averageoiscouponpricer.hpp` file; + include `ql/cashflows/overnightindexedcouponpricer.hpp` instead. + - Deprecated the somewhat out-of-scope and experimental + `CreditRiskPlus`, `SensitivityAnalysis`, `aggregateNPV`, + `parallelAnalysis` and `bucketAnalysis`. + + Thanks go also to Jonathan Sweemer, Eugene Toder, Ralf Konrad + Eckel, Tony Wang and the XAD team for miscellaneous smaller fixes, + improvements or reports. + + Release 1.35 - July 23rd, 2024 PORTABILITY - **Future end of support:** as announced since release 1.32, this diff --git a/LICENSE.TXT b/LICENSE.TXT index e4a21ec6a40..382b42300cd 100644 --- a/LICENSE.TXT +++ b/LICENSE.TXT @@ -169,6 +169,7 @@ QuantLib is Copyright (C) 2023 Paul Xi Cao Copyright (C) 2024 Jacques du Toit + Copyright (C) 2024 Jongbong An QuantLib includes code taken from Peter Jäckel's book "Monte Carlo Methods in Finance". diff --git a/QuantLib.vcxproj b/QuantLib.vcxproj index c9e69684b9d..b11f40de9d9 100644 --- a/QuantLib.vcxproj +++ b/QuantLib.vcxproj @@ -533,6 +533,7 @@ + @@ -663,32 +664,23 @@ - - - - - - - - - @@ -791,7 +783,6 @@ - @@ -848,6 +839,7 @@ + @@ -1221,7 +1213,6 @@ - @@ -1233,7 +1224,6 @@ - @@ -1358,7 +1348,6 @@ - @@ -1607,14 +1596,11 @@ - - - @@ -1933,12 +1919,12 @@ + - @@ -2137,6 +2123,7 @@ + @@ -2329,7 +2316,6 @@ - @@ -2649,7 +2635,6 @@ - diff --git a/QuantLib.vcxproj.filters b/QuantLib.vcxproj.filters index 001b00b67ee..1aa50931d2d 100644 --- a/QuantLib.vcxproj.filters +++ b/QuantLib.vcxproj.filters @@ -450,12 +450,6 @@ methods\finitedifferences - - methods\finitedifferences - - - methods\finitedifferences - methods\finitedifferences @@ -558,6 +552,9 @@ cashflows + + cashflows + cashflows @@ -669,6 +666,9 @@ indexes\ibor + + indexes\ibor + indexes\ibor @@ -1482,9 +1482,6 @@ models\marketmodels - - models\marketmodels - models\marketmodels @@ -2532,18 +2529,9 @@ pricingengines\vanilla - - pricingengines\vanilla - - - pricingengines\vanilla - pricingengines\vanilla - - pricingengines\vanilla - pricingengines\vanilla @@ -3132,15 +3120,6 @@ experimental\exoticoptions - - experimental\exoticoptions - - - experimental\exoticoptions - - - experimental\exoticoptions - experimental\exoticoptions @@ -3156,9 +3135,6 @@ pricingengines\barrier - - experimental\exoticoptions - experimental\exoticoptions @@ -3168,9 +3144,6 @@ experimental\exoticoptions - - experimental\exoticoptions - experimental\exoticoptions @@ -3189,9 +3162,6 @@ experimental\exoticoptions - - experimental\exoticoptions - experimental\exoticoptions @@ -3207,9 +3177,6 @@ experimental\exoticoptions - - experimental\exoticoptions - experimental\exoticoptions @@ -3486,9 +3453,6 @@ experimental\termstructures - - experimental\termstructures - experimental\varianceoption @@ -3639,12 +3603,6 @@ experimental\barrieroption - - experimental\exoticoptions - - - experimental\exoticoptions - experimental\inflation @@ -4544,6 +4502,9 @@ cashflows + + cashflows + cashflows @@ -4559,9 +4520,6 @@ cashflows - - cashflows - cashflows @@ -4613,6 +4571,9 @@ indexes\ibor + + indexes\ibor + indexes\ibor @@ -4862,9 +4823,6 @@ math - - math - math\statistics @@ -5792,9 +5750,6 @@ pricingengines\vanilla - - pricingengines\vanilla - pricingengines\vanilla diff --git a/cmake/GenerateHeaders.cmake b/cmake/GenerateHeaders.cmake index f1ec159d192..a1eecb5fb47 100644 --- a/cmake/GenerateHeaders.cmake +++ b/cmake/GenerateHeaders.cmake @@ -38,29 +38,15 @@ function(generate_dir_headers source_dir binary_dir) file(GLOB children_hpp RELATIVE ${source_dir} "${source_dir}/*.hpp") list(FILTER children_hpp EXCLUDE REGEX "all.hpp") - # These headers were moved to another location. - # Therefore, we can ignore them as they only contain a warning and the new includes. - if (${source_dir} MATCHES "experimental" AND ${source_dir} MATCHES "exoticoptions") - list(FILTER children_hpp EXCLUDE REGEX "margrabeoption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticamericanmargrabeengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticeuropeanmargrabeengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "compoundoption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticcompoundoptionengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "simplechooseroption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticsimplechooserengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "complexchooseroption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticcomplexchooserengine.hpp") - endif () - - list(FILTER children_hpp EXCLUDE REGEX "multicurvesensitivities.hpp") - list(FILTER children_hpp EXCLUDE REGEX "shoutcondition.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fdcondition.hpp") - list(FILTER children_hpp EXCLUDE REGEX "pdeshortrate.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fddividendengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fdstepconditionengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "duffsdeviceinnerproduct.hpp") list(FILTER children_hpp EXCLUDE REGEX "dividendvanillaoption.hpp") list(FILTER children_hpp EXCLUDE REGEX "averageoiscouponpricer.hpp") + list(FILTER children_hpp EXCLUDE REGEX "subperiodcoupon.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdmultiperiodengine.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdvanillaengine.hpp") + list(FILTER children_hpp EXCLUDE REGEX "sampledcurve.hpp") + list(FILTER children_hpp EXCLUDE REGEX "bsmtermoperator.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdtypedefs.hpp") + list(FILTER children_hpp EXCLUDE REGEX "parallelevolver.hpp") file(GLOB children_dir RELATIVE ${source_dir} "${source_dir}/*") list(FILTER children_dir EXCLUDE REGEX "CMakeFiles") diff --git a/configure.ac b/configure.ac index 2617be31c6a..85b288b2865 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([QuantLib], [1.36-rc], +AC_INIT([QuantLib], [1.37-dev], [quantlib-dev@lists.sourceforge.net], [QuantLib]) AC_PREREQ(2.62) diff --git a/ql/CMakeLists.txt b/ql/CMakeLists.txt index ca7950156d0..3e409c1be57 100644 --- a/ql/CMakeLists.txt +++ b/ql/CMakeLists.txt @@ -24,13 +24,13 @@ set(QL_SOURCES cashflows/inflationcoupon.cpp cashflows/inflationcouponpricer.cpp cashflows/lineartsrpricer.cpp + cashflows/multipleresetscoupon.cpp cashflows/overnightindexedcoupon.cpp cashflows/overnightindexedcouponpricer.cpp cashflows/rangeaccrual.cpp cashflows/replication.cpp cashflows/simplecashflow.cpp cashflows/timebasket.cpp - cashflows/subperiodcoupon.cpp cashflows/yoyinflationcoupon.cpp cashflows/zeroinflationcashflow.cpp currencies/africa.cpp @@ -235,6 +235,7 @@ set(QL_SOURCES indexes/ibor/euribor.cpp indexes/ibor/eurlibor.cpp indexes/ibor/fedfunds.cpp + indexes/ibor/kofr.cpp indexes/ibor/libor.cpp indexes/ibor/shibor.cpp indexes/ibor/sofr.cpp @@ -429,7 +430,6 @@ set(QL_SOURCES math/randomnumbers/xoshiro256starstaruniformrng.cpp math/richardsonextrapolation.cpp math/rounding.cpp - math/sampledcurve.cpp math/statistics/discrepancystatistics.cpp math/statistics/generalstatistics.cpp math/statistics/histogram.cpp @@ -752,7 +752,6 @@ set(QL_SOURCES pricingengines/vanilla/fdhestonvanillaengine.cpp pricingengines/vanilla/fdsabrvanillaengine.cpp pricingengines/vanilla/fdsimplebsswingengine.cpp - pricingengines/vanilla/fdvanillaengine.cpp pricingengines/vanilla/hestonexpansionengine.cpp pricingengines/vanilla/integralengine.cpp pricingengines/vanilla/jumpdiffusionengine.cpp @@ -960,6 +959,7 @@ set(QL_HEADERS cashflows/inflationcoupon.hpp cashflows/inflationcouponpricer.hpp cashflows/lineartsrpricer.hpp + cashflows/multipleresetscoupon.hpp cashflows/overnightindexedcoupon.hpp cashflows/overnightindexedcouponpricer.hpp cashflows/rangeaccrual.hpp @@ -1090,32 +1090,23 @@ set(QL_HEADERS experimental/credit/spotlosslatentmodel.hpp experimental/credit/spreadedhazardratecurve.hpp experimental/credit/syntheticcdo.hpp - experimental/exoticoptions/analyticamericanmargrabeengine.hpp - experimental/exoticoptions/analyticcomplexchooserengine.hpp - experimental/exoticoptions/analyticcompoundoptionengine.hpp - experimental/exoticoptions/analyticeuropeanmargrabeengine.hpp experimental/exoticoptions/analyticholderextensibleoptionengine.hpp experimental/exoticoptions/analyticpartialtimebarrieroptionengine.hpp experimental/exoticoptions/analyticpdfhestonengine.hpp - experimental/exoticoptions/analyticsimplechooserengine.hpp experimental/exoticoptions/analytictwoassetbarrierengine.hpp experimental/exoticoptions/analytictwoassetcorrelationengine.hpp experimental/exoticoptions/analyticwriterextensibleoptionengine.hpp - experimental/exoticoptions/complexchooseroption.hpp - experimental/exoticoptions/compoundoption.hpp experimental/exoticoptions/continuousarithmeticasianlevyengine.hpp experimental/exoticoptions/continuousarithmeticasianvecerengine.hpp experimental/exoticoptions/everestoption.hpp experimental/exoticoptions/himalayaoption.hpp experimental/exoticoptions/holderextensibleoption.hpp experimental/exoticoptions/kirkspreadoptionengine.hpp - experimental/exoticoptions/margrabeoption.hpp experimental/exoticoptions/mceverestengine.hpp experimental/exoticoptions/mchimalayaengine.hpp experimental/exoticoptions/mcpagodaengine.hpp experimental/exoticoptions/pagodaoption.hpp experimental/exoticoptions/partialtimebarrieroption.hpp - experimental/exoticoptions/simplechooseroption.hpp experimental/exoticoptions/spreadoption.hpp experimental/exoticoptions/twoassetbarrieroption.hpp experimental/exoticoptions/twoassetcorrelationoption.hpp @@ -1205,7 +1196,6 @@ set(QL_HEADERS experimental/swaptions/irregularswaption.hpp experimental/termstructures/basisswapratehelpers.hpp experimental/termstructures/crosscurrencyratehelpers.hpp - experimental/termstructures/multicurvesensitivities.hpp experimental/variancegamma/analyticvariancegammaengine.hpp experimental/variancegamma/fftengine.hpp experimental/variancegamma/fftvanillaengine.hpp @@ -1261,6 +1251,7 @@ set(QL_HEADERS indexes/ibor/gbplibor.hpp indexes/ibor/jibar.hpp indexes/ibor/jpylibor.hpp + indexes/ibor/kofr.hpp indexes/ibor/libor.hpp indexes/ibor/mosprime.hpp indexes/ibor/nzdlibor.hpp @@ -1616,7 +1607,6 @@ set(QL_HEADERS methods/finitedifferences/parallelevolver.hpp methods/finitedifferences/pde.hpp methods/finitedifferences/pdebsm.hpp - methods/finitedifferences/pdeshortrate.hpp methods/finitedifferences/schemes/boundaryconditionschemehelper.hpp methods/finitedifferences/schemes/craigsneydscheme.hpp methods/finitedifferences/schemes/cranknicolsonscheme.hpp @@ -1627,7 +1617,6 @@ set(QL_HEADERS methods/finitedifferences/schemes/methodoflinesscheme.hpp methods/finitedifferences/schemes/modifiedcraigsneydscheme.hpp methods/finitedifferences/schemes/trbdf2scheme.hpp - methods/finitedifferences/shoutcondition.hpp methods/finitedifferences/solvers/fdm1dimsolver.hpp methods/finitedifferences/solvers/fdm2dblackscholessolver.hpp methods/finitedifferences/solvers/fdm2dimsolver.hpp @@ -1739,7 +1728,6 @@ set(QL_HEADERS models/marketmodels/driftcomputation/lmmdriftcalculator.hpp models/marketmodels/driftcomputation/lmmnormaldriftcalculator.hpp models/marketmodels/driftcomputation/smmdriftcalculator.hpp - models/marketmodels/duffsdeviceinnerproduct.hpp models/marketmodels/evolutiondescription.hpp models/marketmodels/evolver.hpp models/marketmodels/evolvers/lognormalcmswapratepc.hpp @@ -1966,14 +1954,11 @@ set(QL_HEADERS pricingengines/vanilla/fdblackscholesshoutengine.hpp pricingengines/vanilla/fdcirvanillaengine.hpp pricingengines/vanilla/fdcevvanillaengine.hpp - pricingengines/vanilla/fdconditions.hpp - pricingengines/vanilla/fddividendengine.hpp pricingengines/vanilla/fdhestonhullwhitevanillaengine.hpp pricingengines/vanilla/fdhestonvanillaengine.hpp pricingengines/vanilla/fdmultiperiodengine.hpp pricingengines/vanilla/fdsabrvanillaengine.hpp pricingengines/vanilla/fdsimplebsswingengine.hpp - pricingengines/vanilla/fdstepconditionengine.hpp pricingengines/vanilla/fdvanillaengine.hpp pricingengines/vanilla/hestonexpansionengine.hpp pricingengines/vanilla/integralengine.hpp diff --git a/ql/cashflows/Makefile.am b/ql/cashflows/Makefile.am index f45d7c0274b..cdb593471d2 100644 --- a/ql/cashflows/Makefile.am +++ b/ql/cashflows/Makefile.am @@ -28,6 +28,7 @@ this_include_HEADERS = \ inflationcoupon.hpp \ inflationcouponpricer.hpp \ lineartsrpricer.hpp \ + multipleresetscoupon.hpp \ overnightindexedcoupon.hpp \ overnightindexedcouponpricer.hpp \ rangeaccrual.hpp \ @@ -64,12 +65,12 @@ cpp_files = \ inflationcoupon.cpp \ inflationcouponpricer.cpp \ lineartsrpricer.cpp \ + multipleresetscoupon.cpp \ overnightindexedcoupon.cpp \ overnightindexedcouponpricer.cpp \ rangeaccrual.cpp \ replication.cpp \ simplecashflow.cpp \ - subperiodcoupon.cpp \ timebasket.cpp \ yoyinflationcoupon.cpp \ zeroinflationcashflow.cpp @@ -100,7 +101,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp subperiodcoupon.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/cashflows/all.hpp b/ql/cashflows/all.hpp index ef579427e71..6929ae3526e 100644 --- a/ql/cashflows/all.hpp +++ b/ql/cashflows/all.hpp @@ -25,13 +25,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include diff --git a/ql/cashflows/couponpricer.cpp b/ql/cashflows/couponpricer.cpp index beaf87b66b3..44b5577b00f 100644 --- a/ql/cashflows/couponpricer.cpp +++ b/ql/cashflows/couponpricer.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include /* internal */ #include /* internal */ #include @@ -253,7 +253,7 @@ namespace QuantLib { public Visitor, public Visitor, public Visitor, - public Visitor { + public Visitor { private: ext::shared_ptr pricer_; public: @@ -274,7 +274,7 @@ namespace QuantLib { void visit(DigitalCmsCoupon& c) override; void visit(DigitalCmsSpreadCoupon& c) override; void visit(RangeAccrualFloatersCoupon& c) override; - void visit(SubPeriodsCoupon& c) override; + void visit(MultipleResetsCoupon& c) override; }; void PricerSetter::visit(CashFlow&) { @@ -386,12 +386,11 @@ namespace QuantLib { c.setPricer(rangeAccrualPricer); } - void PricerSetter::visit(SubPeriodsCoupon& c) { - const ext::shared_ptr subPeriodsPricer = - ext::dynamic_pointer_cast(pricer_); - QL_REQUIRE(subPeriodsPricer, - "pricer not compatible with sub-period coupon"); - c.setPricer(subPeriodsPricer); + void PricerSetter::visit(MultipleResetsCoupon& c) { + const ext::shared_ptr pricer = + ext::dynamic_pointer_cast(pricer_); + QL_REQUIRE(pricer, "pricer not compatible with multiple-resets coupon"); + c.setPricer(pricer); } void setCouponPricersFirstMatching(const Leg& leg, diff --git a/ql/cashflows/digitalcmscoupon.cpp b/ql/cashflows/digitalcmscoupon.cpp index 5225357c81f..7ec59e84350 100644 --- a/ql/cashflows/digitalcmscoupon.cpp +++ b/ql/cashflows/digitalcmscoupon.cpp @@ -185,11 +185,6 @@ namespace QuantLib { return *this; } - DigitalCmsLeg& DigitalCmsLeg::withReplication() { - replication_ = ext::make_shared(); - return *this; - } - DigitalCmsLeg& DigitalCmsLeg::withNakedOption(bool nakedOption) { nakedOption_ = nakedOption; return *this; diff --git a/ql/cashflows/digitalcmscoupon.hpp b/ql/cashflows/digitalcmscoupon.hpp index 8a6ccc2374f..824042e6f63 100644 --- a/ql/cashflows/digitalcmscoupon.hpp +++ b/ql/cashflows/digitalcmscoupon.hpp @@ -83,11 +83,6 @@ namespace QuantLib { DigitalCmsLeg& withPutPayoffs(Rate payoff); DigitalCmsLeg& withPutPayoffs(const std::vector& payoffs); DigitalCmsLeg& withReplication(const ext::shared_ptr&); - /*! \deprecated Use the overload that passes a replication instead. - Deprecated in version 1.32. - */ - [[deprecated("Use the overload that passes a replication instead")]] - DigitalCmsLeg& withReplication(); DigitalCmsLeg& withNakedOption(bool nakedOption = true); operator Leg() const; diff --git a/ql/cashflows/digitalcoupon.cpp b/ql/cashflows/digitalcoupon.cpp index 37d89ad4391..61f7173a606 100644 --- a/ql/cashflows/digitalcoupon.cpp +++ b/ql/cashflows/digitalcoupon.cpp @@ -238,9 +238,7 @@ namespace QuantLib { rate_ = underlyingRate + callCsi_ * callPayoff() + putCsi_ * putPayoff(); } else if (fixingDate == today) { // might have been fixed - Rate pastFixing = - IndexManager::instance().getHistory((underlying_->index())->name())[fixingDate]; - if (pastFixing != Null()) { + if (underlying_->index()->hasHistoricalFixing(fixingDate)) { rate_ = underlyingRate + callCsi_ * callPayoff() + putCsi_ * putPayoff(); } else { rate_ = underlyingRate + callCsi_ * callOptionRate() + putCsi_ * putOptionRate(); diff --git a/ql/cashflows/digitaliborcoupon.cpp b/ql/cashflows/digitaliborcoupon.cpp index d3c465fbb76..b0cd505750a 100644 --- a/ql/cashflows/digitaliborcoupon.cpp +++ b/ql/cashflows/digitaliborcoupon.cpp @@ -185,11 +185,6 @@ namespace QuantLib { return *this; } - DigitalIborLeg& DigitalIborLeg::withReplication() { - replication_ = ext::make_shared(); - return *this; - } - DigitalIborLeg& DigitalIborLeg::withNakedOption(bool nakedOption) { nakedOption_ = nakedOption; return *this; diff --git a/ql/cashflows/digitaliborcoupon.hpp b/ql/cashflows/digitaliborcoupon.hpp index 293bfdcb62c..758856b6b45 100644 --- a/ql/cashflows/digitaliborcoupon.hpp +++ b/ql/cashflows/digitaliborcoupon.hpp @@ -83,11 +83,6 @@ namespace QuantLib { DigitalIborLeg& withPutPayoffs(Rate payoff); DigitalIborLeg& withPutPayoffs(const std::vector& payoffs); DigitalIborLeg& withReplication(const ext::shared_ptr&); - /*! \deprecated Use the overload that passes a replication instead. - Deprecated in version 1.32. - */ - [[deprecated("Use the overload that passes a replication instead")]] - DigitalIborLeg& withReplication(); DigitalIborLeg& withNakedOption(bool nakedOption = true); operator Leg() const; diff --git a/ql/cashflows/multipleresetscoupon.cpp b/ql/cashflows/multipleresetscoupon.cpp new file mode 100644 index 00000000000..86bb39625d8 --- /dev/null +++ b/ql/cashflows/multipleresetscoupon.cpp @@ -0,0 +1,502 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2008 Toyin Akin + Copyright (C) 2021 Marcin Rybacki + + This file is part of QuantLib, a free-software/open-source library + for financial quantitative analysts and developers - http://quantlib.org/ + + QuantLib is free software: you can redistribute it and/or modify it + under the terms of the QuantLib license. You should have received a + copy of the license along with this program; if not, please email + . The license is also available online at + . + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +#include +#include +#include +#include +#include +#include + +namespace QuantLib { + + MultipleResetsCoupon::MultipleResetsCoupon(const Date& paymentDate, + Real nominal, + const Schedule& resetSchedule, + Natural fixingDays, + const ext::shared_ptr& index, + Real gearing, + Rate couponSpread, + Rate rateSpread, + const Date& refPeriodStart, + const Date& refPeriodEnd, + const DayCounter& dayCounter, + const Date& exCouponDate) + : FloatingRateCoupon(paymentDate, nominal, + resetSchedule.front(), resetSchedule.back(), + fixingDays, index, gearing, couponSpread, + refPeriodStart, refPeriodEnd, dayCounter, + false, exCouponDate), + rateSpread_(rateSpread) { + valueDates_ = resetSchedule.dates(); + + // fixing dates + n_ = valueDates_.size() - 1; + if (fixingDays_ == 0) { + fixingDates_ = std::vector(valueDates_.begin(), valueDates_.end() - 1); + } else { + fixingDates_.resize(n_); + for (Size i = 0; i < n_; ++i) + fixingDates_[i] = fixingDate(valueDates_[i]); + } + + // accrual times of sub-periods + dt_.resize(n_); + const DayCounter& dc = index->dayCounter(); + for (Size i = 0; i < n_; ++i) + dt_[i] = dc.yearFraction(valueDates_[i], valueDates_[i + 1]); + } + + MultipleResetsCoupon::MultipleResetsCoupon(const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + Natural fixingDays, + const ext::shared_ptr& index, + Real gearing, + Rate couponSpread, + Rate rateSpread, + const Date& refPeriodStart, + const Date& refPeriodEnd, + const DayCounter& dayCounter, + const Date& exCouponDate) + : FloatingRateCoupon(paymentDate, nominal, startDate, endDate, + fixingDays, index, gearing, couponSpread, + refPeriodStart, refPeriodEnd, dayCounter, + false, exCouponDate), + rateSpread_(rateSpread) { + Schedule sch = MakeSchedule() + .from(startDate) + .to(endDate) + .withTenor(index->tenor()) + .withCalendar(index->fixingCalendar()) + .withConvention(index->businessDayConvention()) + .backwards() + .endOfMonth(index->endOfMonth()); + valueDates_ = sch.dates(); + + // fixing dates + n_ = valueDates_.size() - 1; + if (fixingDays_ == 0) { + fixingDates_ = std::vector(valueDates_.begin(), valueDates_.end() - 1); + } else { + fixingDates_.resize(n_); + for (Size i = 0; i < n_; ++i) + fixingDates_[i] = fixingDate(valueDates_[i]); + } + + // accrual of sub-periods + dt_.resize(n_); + const DayCounter& dc = index->dayCounter(); + for (Size i = 0; i < n_; ++i) + dt_[i] = dc.yearFraction(valueDates_[i], valueDates_[i + 1]); + } + + void MultipleResetsCoupon::accept(AcyclicVisitor& v) { + auto* v1 = dynamic_cast*>(&v); + if (v1 != nullptr) + v1->visit(*this); + else + FloatingRateCoupon::accept(v); + } + + Date MultipleResetsCoupon::fixingDate(const Date& valueDate) const { + Date fixingDate = + index_->fixingCalendar().advance(valueDate, -static_cast(fixingDays_), Days); + return fixingDate; + } + + void MultipleResetsPricer::initialize(const FloatingRateCoupon& coupon) { + coupon_ = dynamic_cast(&coupon); + QL_REQUIRE(coupon_, "sub-periods coupon required"); + + ext::shared_ptr index = ext::dynamic_pointer_cast(coupon_->index()); + if (!index) { + // coupon was right, index is not + QL_FAIL("IborIndex required"); + } + + QL_REQUIRE(coupon_->accrualPeriod() != 0.0, "null accrual period"); + + const std::vector& fixingDates = coupon_->fixingDates(); + Size n = fixingDates.size(); + subPeriodFixings_.resize(n); + + for (Size i = 0; i < n; i++) { + subPeriodFixings_[i] = index->fixing(fixingDates[i]) + coupon_->rateSpread(); + } + } + + Real MultipleResetsPricer::swapletPrice() const { + QL_FAIL("MultipleResetsPricer::swapletPrice not implemented"); + } + + Real MultipleResetsPricer::capletPrice(Rate) const { + QL_FAIL("MultipleResetsPricer::capletPrice not implemented"); + } + + Rate MultipleResetsPricer::capletRate(Rate) const { + QL_FAIL("MultipleResetsPricer::capletRate not implemented"); + } + + Real MultipleResetsPricer::floorletPrice(Rate) const { + QL_FAIL("MultipleResetsPricer::floorletPrice not implemented"); + } + + Rate MultipleResetsPricer::floorletRate(Rate) const { + QL_FAIL("MultipleResetsPricer::floorletRate not implemented"); + } + + Real AveragingMultipleResetsPricer::swapletRate() const { + // past or future fixing is managed in InterestRateIndex::fixing() + + Size nCount = subPeriodFixings_.size(); + const std::vector