From 9021d04cefa386ab37ec0ff5c5b0913d4b89c09b Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Sun, 7 Feb 2021 21:41:42 +0100 Subject: [PATCH 01/16] Added averaging method member to OvernightIndex class. --- ql/cashflows/overnightindexedcoupon.cpp | 17 +++++++++++++++-- .../averageois/arithmeticaverageois.cpp | 2 +- .../averageois/averageoiscouponpricer.hpp | 4 ++-- ql/indexes/iborindex.cpp | 7 ++++--- ql/indexes/iborindex.hpp | 12 ++++++++++-- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ql/cashflows/overnightindexedcoupon.cpp b/ql/cashflows/overnightindexedcoupon.cpp index 0b2b38322b4..b578f7bd23d 100644 --- a/ql/cashflows/overnightindexedcoupon.cpp +++ b/ql/cashflows/overnightindexedcoupon.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -193,8 +194,20 @@ namespace QuantLib { for (Size i=0; i(new - OvernightIndexedCouponPricer)); + OvernightAveraging averagingMethod = overnightIndex->averagingMethod(); + + switch (averagingMethod) { + case OvernightAveraging::Simple: + setPricer(ext::shared_ptr( + new ArithmeticAveragedOvernightIndexedCouponPricer(telescopicValueDates))); + break; + case OvernightAveraging::Compound: + setPricer( + ext::shared_ptr(new OvernightIndexedCouponPricer)); + break; + default: + QL_FAIL("unknown compounding convention (" << Integer(averagingMethod) << ")"); + } } const vector& OvernightIndexedCoupon::indexFixings() const { diff --git a/ql/experimental/averageois/arithmeticaverageois.cpp b/ql/experimental/averageois/arithmeticaverageois.cpp index 450a39e130b..7163ee48f94 100644 --- a/ql/experimental/averageois/arithmeticaverageois.cpp +++ b/ql/experimental/averageois/arithmeticaverageois.cpp @@ -84,7 +84,7 @@ namespace QuantLib { .withSpreads(spread_); ext::shared_ptr arithmeticPricer( - new ArithmeticAveragedOvernightIndexedCouponPricer(mrs_, vol_, byApprox_)); + new ArithmeticAveragedOvernightIndexedCouponPricer(byApprox_, mrs_, vol_)); for (Size i = 0; i < legs_[1].size(); i++) { ext::shared_ptr diff --git a/ql/experimental/averageois/averageoiscouponpricer.hpp b/ql/experimental/averageois/averageoiscouponpricer.hpp index 95694c68572..a7ddf052d40 100644 --- a/ql/experimental/averageois/averageoiscouponpricer.hpp +++ b/ql/experimental/averageois/averageoiscouponpricer.hpp @@ -37,9 +37,9 @@ namespace QuantLib { : public FloatingRateCouponPricer { public: ArithmeticAveragedOvernightIndexedCouponPricer( + bool byApprox = false, // TRUE to use Katsumi Takada approximation Real meanReversion = 0.03, - Real volatility = 0.00, // NO convexity adjustment by default - bool byApprox = false) // TRUE to use Katsumi Takada approximation + Real volatility = 0.00) // NO convexity adjustment by default : byApprox_(byApprox), mrs_(meanReversion), vol_(volatility) {} void initialize(const FloatingRateCoupon& coupon) override; diff --git a/ql/indexes/iborindex.cpp b/ql/indexes/iborindex.cpp index daced19c1ea..2e6f53d7b19 100644 --- a/ql/indexes/iborindex.cpp +++ b/ql/indexes/iborindex.cpp @@ -78,9 +78,10 @@ namespace QuantLib { const Currency& curr, const Calendar& fixCal, const DayCounter& dc, - const Handle& h) - : IborIndex(familyName, 1*Days, settlementDays, curr, - fixCal, Following, false, dc, h) {} + const Handle& h, + OvernightAveraging averagingMethod) + : IborIndex(familyName, 1 * Days, settlementDays, curr, fixCal, Following, false, dc, h), + averagingMethod_(averagingMethod) {} ext::shared_ptr OvernightIndex::clone( const Handle& h) const { diff --git a/ql/indexes/iborindex.hpp b/ql/indexes/iborindex.hpp index 0a956189484..0d169523fe6 100644 --- a/ql/indexes/iborindex.hpp +++ b/ql/indexes/iborindex.hpp @@ -85,6 +85,7 @@ namespace QuantLib { friend class IborCoupon; }; + enum class OvernightAveraging { Simple, Compound }; class OvernightIndex : public IborIndex { public: @@ -93,10 +94,17 @@ namespace QuantLib { const Currency& currency, const Calendar& fixingCalendar, const DayCounter& dayCounter, - const Handle& h = - Handle()); + const Handle& h = Handle(), + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! returns a copy of itself linked to a different forwarding curve ext::shared_ptr clone(const Handle& h) const override; + + //! \name Overnight Index Inspectors + //@{ + OvernightAveraging averagingMethod() const { return averagingMethod_; } + //@} + private: + OvernightAveraging averagingMethod_; }; From ec4aa7732a778d9fa72b1097627e1bf06309a0be Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Mon, 8 Feb 2021 12:36:02 +0100 Subject: [PATCH 02/16] Updated OvernightIndex clone method. --- ql/indexes/iborindex.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ql/indexes/iborindex.cpp b/ql/indexes/iborindex.cpp index 2e6f53d7b19..6e2749c602a 100644 --- a/ql/indexes/iborindex.cpp +++ b/ql/indexes/iborindex.cpp @@ -91,7 +91,8 @@ namespace QuantLib { currency(), fixingCalendar(), dayCounter(), - h)); + h, + averagingMethod())); } } From 197fd14a9d1cfa1db2b4f8782007821dfe6190cd Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Mon, 8 Feb 2021 12:37:16 +0100 Subject: [PATCH 03/16] Added unit tests for simple averaging cases. --- test-suite/overnightindexedswap.cpp | 162 ++++++++++++++++------------ test-suite/overnightindexedswap.hpp | 2 + 2 files changed, 97 insertions(+), 67 deletions(-) diff --git a/test-suite/overnightindexedswap.cpp b/test-suite/overnightindexedswap.cpp index 1a587a8b576..bf4bdf6fd41 100644 --- a/test-suite/overnightindexedswap.cpp +++ b/test-suite/overnightindexedswap.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -134,13 +135,14 @@ namespace overnight_indexed_swap_test { SavedSettings backup; // utilities - ext::shared_ptr makeSwap(Period length, + ext::shared_ptr makeSwap(const ext::shared_ptr &index, + Period length, Rate fixedRate, Spread spread, bool telescopicValueDates, Date effectiveDate = Null(), Natural paymentLag = 0) { - return MakeOIS(length, eoniaIndex, fixedRate) + return MakeOIS(length, index, fixedRate) .withEffectiveDate(effectiveDate == Null() ? settlement : effectiveDate) .withOvernightLegSpread(spread) .withNominal(nominal) @@ -149,6 +151,16 @@ namespace overnight_indexed_swap_test { .withTelescopicValueDates(telescopicValueDates); } + ext::shared_ptr makeSwap(Period length, + Rate fixedRate, + Spread spread, + bool telescopicValueDates, + Date effectiveDate = Null(), + Natural paymentLag = 0) { + return makeSwap(eoniaIndex, length, fixedRate, spread, telescopicValueDates, + effectiveDate, paymentLag); + } + CommonVars() { type = OvernightIndexedSwap::Payer; settlementDays = 2; @@ -313,87 +325,100 @@ void OvernightIndexedSwapTest::testCachedValue() { } namespace overnight_indexed_swap_test { -void testBootstrap(bool telescopicValueDates) { - CommonVars vars; + ext::shared_ptr createIdx(const Handle& h = Handle(), + OvernightAveraging averagingMethod = OvernightAveraging::Compound) { + return ext::make_shared("Index", 0, EURCurrency(), TARGET(), + Actual360(), h, averagingMethod); + } + + void testBootstrap(bool telescopicValueDates, + OvernightAveraging averagingMethod, + Real tolerance = 1.0e-8) { + + CommonVars vars; + + Natural paymentLag = 2; - Natural paymentLag = 2; + std::vector > eoniaHelpers; - std::vector > eoniaHelpers; + ext::shared_ptr euribor3m(new Euribor3M); + ext::shared_ptr eonia = createIdx(vars.eoniaTermStructure, averagingMethod); - ext::shared_ptr euribor3m(new Euribor3M); - ext::shared_ptr eonia(new Eonia); + for (Size i = 0; i < LENGTH(depositData); i++) { + Real rate = 0.01 * depositData[i].rate; + ext::shared_ptr simple = ext::make_shared(rate); + ext::shared_ptr quote(simple); + Period term = depositData[i].n * depositData[i].unit; + ext::shared_ptr helper(new DepositRateHelper( + Handle(quote), term, depositData[i].settlementDays, + euribor3m->fixingCalendar(), euribor3m->businessDayConvention(), + euribor3m->endOfMonth(), euribor3m->dayCounter())); - for (Size i = 0; i < LENGTH(depositData); i++) { - Real rate = 0.01 * depositData[i].rate; - ext::shared_ptr simple = ext::make_shared(rate); - ext::shared_ptr quote (simple); - Period term = depositData[i].n * depositData[i].unit; - ext::shared_ptr helper(new - DepositRateHelper(Handle(quote), - term, - depositData[i].settlementDays, - euribor3m->fixingCalendar(), - euribor3m->businessDayConvention(), - euribor3m->endOfMonth(), - euribor3m->dayCounter())); + if (term <= 2 * Days) + eoniaHelpers.push_back(helper); + } - if (term <= 2*Days) + for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { + Real rate = 0.01 * eoniaSwapData[i].rate; + ext::shared_ptr simple = ext::make_shared(rate); + ext::shared_ptr quote(simple); + Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; + ext::shared_ptr helper(new OISRateHelper( + eoniaSwapData[i].settlementDays, term, Handle(quote), eonia, + Handle(), telescopicValueDates, paymentLag)); eoniaHelpers.push_back(helper); - } + } - for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { - Real rate = 0.01 * eoniaSwapData[i].rate; - ext::shared_ptr simple = ext::make_shared(rate); - ext::shared_ptr quote (simple); - Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; - ext::shared_ptr helper(new - OISRateHelper(eoniaSwapData[i].settlementDays, - term, - Handle(quote), - eonia, - Handle(), - telescopicValueDates, - paymentLag)); - eoniaHelpers.push_back(helper); - } + ext::shared_ptr eoniaTS( + new PiecewiseFlatForward(vars.today, eoniaHelpers, Actual365Fixed())); - ext::shared_ptr eoniaTS( - new PiecewiseFlatForward (vars.today, eoniaHelpers, Actual365Fixed())); - - vars.eoniaTermStructure.linkTo(eoniaTS); - - // test curve consistency - Real tolerance = 1.0e-8; - for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { - Rate expected = eoniaSwapData[i].rate/100; - Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; - // test telescopic value dates (in bootstrap) against non telescopic value dates (swap here) - ext::shared_ptr swap = vars.makeSwap(term, 0.0, 0.0, false, - Null(), paymentLag); - Rate calculated = swap->fairRate(); - Rate error = std::fabs(expected-calculated); - - if (error>tolerance) - BOOST_FAIL("curve inconsistency:" << std::setprecision(10) << - "\n swap length: " << term << - "\n quoted rate: " << expected << - "\n calculated rate: " << calculated << - "\n error: " << error << - "\n tolerance: " << tolerance); - } -} // testBootstrap(telescopicValueDates) + vars.eoniaTermStructure.linkTo(eoniaTS); + + // test curve consistency + for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { + Rate expected = eoniaSwapData[i].rate / 100; + Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; + // test telescopic value dates (in bootstrap) against non telescopic value dates (swap + // here) + ext::shared_ptr swap = + vars.makeSwap(eonia, term, 0.0, 0.0, false, Null(), paymentLag); + Rate calculated = swap->fairRate(); + Rate error = std::fabs(expected - calculated); + + if (error > tolerance) + BOOST_FAIL("curve inconsistency:" << std::setprecision(10) << "\n swap length: " + << term << "\n quoted rate: " << expected + << "\n calculated rate: " << calculated + << "\n error: " << error + << "\n tolerance: " << tolerance); + } + } // testBootstrap(telescopicValueDates) } // anonymous namespace void OvernightIndexedSwapTest::testBootstrap() { - BOOST_TEST_MESSAGE("Testing Eonia-swap curve building..."); - overnight_indexed_swap_test::testBootstrap(false); + BOOST_TEST_MESSAGE("Testing Eonia-swap curve building with daily compounded ON rates..."); + overnight_indexed_swap_test::testBootstrap(false, OvernightAveraging::Compound); +} + +void OvernightIndexedSwapTest::testBootstrapWithArithmeticAverage() { + BOOST_TEST_MESSAGE("Testing Eonia-swap curve building with arithmetic average ON rates..."); + overnight_indexed_swap_test::testBootstrap(false, OvernightAveraging::Simple); } void OvernightIndexedSwapTest::testBootstrapWithTelescopicDates() { BOOST_TEST_MESSAGE( - "Testing Eonia-swap curve building with telescopic value dates..."); - overnight_indexed_swap_test::testBootstrap(true); + "Testing Eonia-swap curve building with telescopic value dates and DCON rates..."); + overnight_indexed_swap_test::testBootstrap(true, OvernightAveraging::Compound); +} + +void OvernightIndexedSwapTest::testBootstrapWithTelescopicDatesAndArithmeticAverage() { + BOOST_TEST_MESSAGE( + "Testing Eonia-swap curve building with telescopic value dates and AAON rates..."); + // Given that we are using an approximation that omits + // the required convexity correction, a higher tolerance + // is needed. + overnight_indexed_swap_test::testBootstrap(true, OvernightAveraging::Simple, 1.0e-5); } void OvernightIndexedSwapTest::testSeasonedSwaps() { @@ -509,8 +534,11 @@ test_suite* OvernightIndexedSwapTest::suite() { suite->add(QUANTLIB_TEST_CASE(&OvernightIndexedSwapTest::testFairSpread)); suite->add(QUANTLIB_TEST_CASE(&OvernightIndexedSwapTest::testCachedValue)); suite->add(QUANTLIB_TEST_CASE(&OvernightIndexedSwapTest::testBootstrap)); + suite->add(QUANTLIB_TEST_CASE(&OvernightIndexedSwapTest::testBootstrapWithArithmeticAverage)); suite->add(QUANTLIB_TEST_CASE( &OvernightIndexedSwapTest::testBootstrapWithTelescopicDates)); + suite->add(QUANTLIB_TEST_CASE( + &OvernightIndexedSwapTest::testBootstrapWithTelescopicDatesAndArithmeticAverage)); suite->add(QUANTLIB_TEST_CASE(&OvernightIndexedSwapTest::testSeasonedSwaps)); suite->add(QUANTLIB_TEST_CASE(&OvernightIndexedSwapTest::testBootstrapRegression)); return suite; diff --git a/test-suite/overnightindexedswap.hpp b/test-suite/overnightindexedswap.hpp index 1963386ad63..6eba0099f80 100644 --- a/test-suite/overnightindexedswap.hpp +++ b/test-suite/overnightindexedswap.hpp @@ -32,7 +32,9 @@ class OvernightIndexedSwapTest { static void testFairSpread(); static void testCachedValue(); static void testBootstrap(); + static void testBootstrapWithArithmeticAverage(); static void testBootstrapWithTelescopicDates(); + static void testBootstrapWithTelescopicDatesAndArithmeticAverage(); static void testSeasonedSwaps(); static void testBootstrapRegression(); static boost::unit_test_framework::test_suite* suite(); From c90f90d2fbde829633678589cf1519de7ec42143 Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Mon, 8 Feb 2021 12:42:37 +0100 Subject: [PATCH 04/16] Fixed indentation. --- test-suite/overnightindexedswap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test-suite/overnightindexedswap.cpp b/test-suite/overnightindexedswap.cpp index bf4bdf6fd41..88637b059ac 100644 --- a/test-suite/overnightindexedswap.cpp +++ b/test-suite/overnightindexedswap.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -387,11 +386,12 @@ namespace overnight_indexed_swap_test { Rate error = std::fabs(expected - calculated); if (error > tolerance) - BOOST_FAIL("curve inconsistency:" << std::setprecision(10) << "\n swap length: " - << term << "\n quoted rate: " << expected - << "\n calculated rate: " << calculated - << "\n error: " << error - << "\n tolerance: " << tolerance); + BOOST_FAIL("curve inconsistency:" << std::setprecision(10) << + "\n swap length: " << term << + "\n quoted rate: " << expected << + "\n calculated rate: " << calculated << + "\n error: " << error << + "\n tolerance: " << tolerance); } } // testBootstrap(telescopicValueDates) } // anonymous namespace From ee3f0169eb1a195928373b381dfe9e32d2f0e32d Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Tue, 9 Feb 2021 16:27:28 +0100 Subject: [PATCH 05/16] Rolled back previous changes and implemented PR feedback. --- ql/cashflows/overnightindexedcoupon.cpp | 16 +- ql/cashflows/overnightindexedcoupon.hpp | 8 +- .../averageois/arithmeticaverageois.cpp | 2 +- .../averageois/averageoiscouponpricer.hpp | 8 +- .../futures/overnightindexfuture.cpp | 13 +- .../futures/overnightindexfuture.hpp | 7 +- .../overnightindexfutureratehelper.cpp | 12 +- .../overnightindexfutureratehelper.hpp | 9 +- ql/indexes/iborindex.cpp | 10 +- ql/indexes/iborindex.hpp | 12 +- ql/instruments/makeois.cpp | 12 +- ql/instruments/makeois.hpp | 3 + ql/instruments/overnightindexedswap.cpp | 14 +- ql/instruments/overnightindexedswap.hpp | 11 +- ql/termstructures/yield/oisratehelper.cpp | 18 +- ql/termstructures/yield/oisratehelper.hpp | 8 +- test-suite/overnightindexedswap.cpp | 163 ++++++------ test-suite/quantlibtestsuite.cpp | 236 +++++++++--------- test-suite/sofrfutures.cpp | 33 ++- 19 files changed, 310 insertions(+), 285 deletions(-) diff --git a/ql/cashflows/overnightindexedcoupon.cpp b/ql/cashflows/overnightindexedcoupon.cpp index b578f7bd23d..1fe2a59f138 100644 --- a/ql/cashflows/overnightindexedcoupon.cpp +++ b/ql/cashflows/overnightindexedcoupon.cpp @@ -125,7 +125,8 @@ namespace QuantLib { const Date& refPeriodStart, const Date& refPeriodEnd, const DayCounter& dayCounter, - bool telescopicValueDates) + bool telescopicValueDates, + OvernightAveraging averagingMethod) : FloatingRateCoupon(paymentDate, nominal, startDate, endDate, overnightIndex->fixingDays(), overnightIndex, gearing, spread, @@ -194,8 +195,6 @@ namespace QuantLib { for (Size i=0; iaveragingMethod(); - switch (averagingMethod) { case OvernightAveraging::Simple: setPricer(ext::shared_ptr( @@ -230,7 +229,8 @@ namespace QuantLib { OvernightLeg::OvernightLeg(const Schedule& schedule, const ext::shared_ptr& i) : schedule_(schedule), overnightIndex_(i), paymentCalendar_(schedule.calendar()), - paymentAdjustment_(Following), paymentLag_(0), telescopicValueDates_(false) {} + paymentAdjustment_(Following), paymentLag_(0), telescopicValueDates_(false), + averagingMethod_(OvernightAveraging::Compound) {} OvernightLeg& OvernightLeg::withNotionals(Real notional) { notionals_ = vector(1, notional); @@ -288,6 +288,11 @@ namespace QuantLib { return *this; } + OvernightLeg& OvernightLeg::withAveragingMethod(OvernightAveraging averagingMethod) { + averagingMethod_ = averagingMethod; + return *this; + } + OvernightLeg::operator Leg() const { QL_REQUIRE(!notionals_.empty(), "no notional given"); @@ -323,7 +328,8 @@ namespace QuantLib { detail::get(spreads_, i, 0.0), refStart, refEnd, paymentDayCounter_, - telescopicValueDates_))); + telescopicValueDates_, + averagingMethod_))); } return cashflows; } diff --git a/ql/cashflows/overnightindexedcoupon.hpp b/ql/cashflows/overnightindexedcoupon.hpp index fb86411a18d..23fd454148e 100644 --- a/ql/cashflows/overnightindexedcoupon.hpp +++ b/ql/cashflows/overnightindexedcoupon.hpp @@ -44,6 +44,9 @@ namespace QuantLib { rather by the OISRateHelper which is safe, since it reinitialises the instrument each time the evaluation date changes. */ + + enum class OvernightAveraging { Simple, Compound }; + class OvernightIndexedCoupon : public FloatingRateCoupon { public: OvernightIndexedCoupon( @@ -57,7 +60,8 @@ namespace QuantLib { const Date& refPeriodStart = Date(), const Date& refPeriodEnd = Date(), const DayCounter& dayCounter = DayCounter(), - bool telescopicValueDates = false); + bool telescopicValueDates = false, + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! \name Inspectors //@{ //! fixing dates for the rates to be compounded @@ -102,6 +106,7 @@ namespace QuantLib { OvernightLeg& withSpreads(Spread spread); OvernightLeg& withSpreads(const std::vector& spreads); OvernightLeg& withTelescopicValueDates(bool telescopicValueDates); + OvernightLeg& withAveragingMethod(OvernightAveraging averagingMethod); operator Leg() const; private: Schedule schedule_; @@ -114,6 +119,7 @@ namespace QuantLib { std::vector gearings_; std::vector spreads_; bool telescopicValueDates_; + OvernightAveraging averagingMethod_; }; } diff --git a/ql/experimental/averageois/arithmeticaverageois.cpp b/ql/experimental/averageois/arithmeticaverageois.cpp index 7163ee48f94..a5d5be8b351 100644 --- a/ql/experimental/averageois/arithmeticaverageois.cpp +++ b/ql/experimental/averageois/arithmeticaverageois.cpp @@ -84,7 +84,7 @@ namespace QuantLib { .withSpreads(spread_); ext::shared_ptr arithmeticPricer( - new ArithmeticAveragedOvernightIndexedCouponPricer(byApprox_, mrs_, vol_)); + new ArithmeticAveragedOvernightIndexedCouponPricer(mrs_, vol_, byApprox_)); for (Size i = 0; i < legs_[1].size(); i++) { ext::shared_ptr diff --git a/ql/experimental/averageois/averageoiscouponpricer.hpp b/ql/experimental/averageois/averageoiscouponpricer.hpp index a7ddf052d40..2310d528c9d 100644 --- a/ql/experimental/averageois/averageoiscouponpricer.hpp +++ b/ql/experimental/averageois/averageoiscouponpricer.hpp @@ -37,11 +37,15 @@ namespace QuantLib { : public FloatingRateCouponPricer { public: ArithmeticAveragedOvernightIndexedCouponPricer( - bool byApprox = false, // TRUE to use Katsumi Takada approximation Real meanReversion = 0.03, - Real volatility = 0.00) // NO convexity adjustment by default + Real volatility = 0.00, // NO convexity adjustment by default + bool byApprox = false) // TRUE to use Katsumi Takada approximation : byApprox_(byApprox), mrs_(meanReversion), vol_(volatility) {} + ArithmeticAveragedOvernightIndexedCouponPricer( + bool byApprox = false) // Simplified constructor assuming no convexity correction + : ArithmeticAveragedOvernightIndexedCouponPricer(0.03, 0.0, byApprox) {} + void initialize(const FloatingRateCoupon& coupon) override; Rate swapletRate() const override; Real swapletPrice() const override { QL_FAIL("swapletPrice not available"); } diff --git a/ql/experimental/futures/overnightindexfuture.cpp b/ql/experimental/futures/overnightindexfuture.cpp index 1ea06e0f70c..cefaa2451c3 100644 --- a/ql/experimental/futures/overnightindexfuture.cpp +++ b/ql/experimental/futures/overnightindexfuture.cpp @@ -30,7 +30,7 @@ namespace QuantLib { const Date& maturityDate, const Handle& discountCurve, const Handle& convexityAdjustment, - const NettingType subPeriodsNettingType) + OvernightAveraging averagingMethod) : Forward(overnightIndex->dayCounter(), overnightIndex->fixingCalendar(), overnightIndex->businessDayConvention(), @@ -40,7 +40,7 @@ namespace QuantLib { maturityDate, discountCurve), overnightIndex_(overnightIndex), convexityAdjustment_(convexityAdjustment), - subPeriodsNettingType_(subPeriodsNettingType) {} + averagingMethod_(averagingMethod) {} Real OvernightIndexFuture::averagedSpotValue() const { Date today = Settings::instance().evaluationDate(); @@ -105,16 +105,15 @@ namespace QuantLib { } Real OvernightIndexFuture::spotValue() const { - switch (subPeriodsNettingType_) { - case Averaging: + switch (averagingMethod_) { + case OvernightAveraging::Simple: underlyingSpotValue_ = averagedSpotValue(); break; - case Compounding: + case OvernightAveraging::Compound: underlyingSpotValue_ = compoundedSpotValue(); break; default: - QL_FAIL("unknown compounding convention (" - << Integer(subPeriodsNettingType_) << ")"); + QL_FAIL("unknown compounding convention (" << Integer(averagingMethod_) << ")"); } return underlyingSpotValue_; } diff --git a/ql/experimental/futures/overnightindexfuture.hpp b/ql/experimental/futures/overnightindexfuture.hpp index 29826e5891d..dec2a505a52 100644 --- a/ql/experimental/futures/overnightindexfuture.hpp +++ b/ql/experimental/futures/overnightindexfuture.hpp @@ -27,6 +27,7 @@ #include #include +#include namespace QuantLib { @@ -36,15 +37,13 @@ namespace QuantLib { */ class OvernightIndexFuture : public Forward { public: - enum NettingType { Averaging, Compounding }; - OvernightIndexFuture(const ext::shared_ptr& overnightIndex, const ext::shared_ptr& payoff, const Date& valueDate, const Date& maturityDate, const Handle& discountCurve, const Handle& convexityAdjustment = Handle(), - NettingType subPeriodsNettingType = Compounding); + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! returns spot value/price of an underlying financial instrument Real spotValue() const override; @@ -61,7 +60,7 @@ namespace QuantLib { Real compoundedSpotValue() const; ext::shared_ptr overnightIndex_; Handle convexityAdjustment_; - NettingType subPeriodsNettingType_; + OvernightAveraging averagingMethod_; }; } diff --git a/ql/experimental/futures/overnightindexfutureratehelper.cpp b/ql/experimental/futures/overnightindexfutureratehelper.cpp index 79e7b384bd5..fbed874387f 100644 --- a/ql/experimental/futures/overnightindexfutureratehelper.cpp +++ b/ql/experimental/futures/overnightindexfutureratehelper.cpp @@ -53,12 +53,12 @@ namespace QuantLib { const Date& maturityDate, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment, - const OvernightIndexFuture::NettingType subPeriodsNettingType) + OvernightAveraging averagingMethod) : RateHelper(price) { ext::shared_ptr payoff; future_ = ext::make_shared( overnightIndex, payoff, valueDate, maturityDate, termStructureHandle_, - convexityAdjustment, subPeriodsNettingType); + convexityAdjustment, averagingMethod); earliestDate_ = valueDate; latestDate_ = maturityDate; } @@ -98,13 +98,13 @@ namespace QuantLib { Frequency referenceFreq, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment, - const OvernightIndexFuture::NettingType subPeriodsNettingType) + OvernightAveraging averagingMethod) : OvernightIndexFutureRateHelper(price, getValidSofrStart(referenceMonth, referenceYear, referenceFreq), getValidSofrEnd(referenceMonth, referenceYear, referenceFreq), overnightIndex, convexityAdjustment, - subPeriodsNettingType) { + averagingMethod) { QL_REQUIRE(referenceFreq == Quarterly || referenceFreq == Monthly, "only monthly and quarterly SOFR futures accepted"); if (referenceFreq == Quarterly) { @@ -121,14 +121,14 @@ namespace QuantLib { Frequency referenceFreq, const ext::shared_ptr& overnightIndex, Real convexityAdjustment, - const OvernightIndexFuture::NettingType subPeriodsNettingType) + OvernightAveraging averagingMethod) : OvernightIndexFutureRateHelper( Handle(ext::make_shared(price)), getValidSofrStart(referenceMonth, referenceYear, referenceFreq), getValidSofrEnd(referenceMonth, referenceYear, referenceFreq), overnightIndex, Handle(ext::make_shared(convexityAdjustment)), - subPeriodsNettingType) { + averagingMethod) { QL_REQUIRE(referenceFreq == Quarterly || referenceFreq == Monthly, "only monthly and quarterly SOFR futures accepted"); if (referenceFreq == Quarterly) { diff --git a/ql/experimental/futures/overnightindexfutureratehelper.hpp b/ql/experimental/futures/overnightindexfutureratehelper.hpp index 6a1efacfdbd..605cbc95ed9 100644 --- a/ql/experimental/futures/overnightindexfutureratehelper.hpp +++ b/ql/experimental/futures/overnightindexfutureratehelper.hpp @@ -40,8 +40,7 @@ namespace QuantLib { const Date& maturityDate, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment = Handle(), - OvernightIndexFuture::NettingType subPeriodsNettingType = - OvernightIndexFuture::Compounding); + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! \name RateHelper interface //@{ @@ -74,16 +73,14 @@ namespace QuantLib { Frequency referenceFreq, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment = Handle(), - OvernightIndexFuture::NettingType subPeriodsNettingType = - OvernightIndexFuture::Compounding); + OvernightAveraging averagingMethod = OvernightAveraging::Compound); SofrFutureRateHelper(Real price, Month referenceMonth, Year referenceYear, Frequency referenceFreq, const ext::shared_ptr& overnightIndex, Real convexityAdjustment = 0, - OvernightIndexFuture::NettingType subPeriodsNettingType = - OvernightIndexFuture::Compounding); + OvernightAveraging averagingMethod = OvernightAveraging::Compound); }; } diff --git a/ql/indexes/iborindex.cpp b/ql/indexes/iborindex.cpp index 6e2749c602a..daced19c1ea 100644 --- a/ql/indexes/iborindex.cpp +++ b/ql/indexes/iborindex.cpp @@ -78,10 +78,9 @@ namespace QuantLib { const Currency& curr, const Calendar& fixCal, const DayCounter& dc, - const Handle& h, - OvernightAveraging averagingMethod) - : IborIndex(familyName, 1 * Days, settlementDays, curr, fixCal, Following, false, dc, h), - averagingMethod_(averagingMethod) {} + const Handle& h) + : IborIndex(familyName, 1*Days, settlementDays, curr, + fixCal, Following, false, dc, h) {} ext::shared_ptr OvernightIndex::clone( const Handle& h) const { @@ -91,8 +90,7 @@ namespace QuantLib { currency(), fixingCalendar(), dayCounter(), - h, - averagingMethod())); + h)); } } diff --git a/ql/indexes/iborindex.hpp b/ql/indexes/iborindex.hpp index 0d169523fe6..0a956189484 100644 --- a/ql/indexes/iborindex.hpp +++ b/ql/indexes/iborindex.hpp @@ -85,7 +85,6 @@ namespace QuantLib { friend class IborCoupon; }; - enum class OvernightAveraging { Simple, Compound }; class OvernightIndex : public IborIndex { public: @@ -94,17 +93,10 @@ namespace QuantLib { const Currency& currency, const Calendar& fixingCalendar, const DayCounter& dayCounter, - const Handle& h = Handle(), - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + const Handle& h = + Handle()); //! returns a copy of itself linked to a different forwarding curve ext::shared_ptr clone(const Handle& h) const override; - - //! \name Overnight Index Inspectors - //@{ - OvernightAveraging averagingMethod() const { return averagingMethod_; } - //@} - private: - OvernightAveraging averagingMethod_; }; diff --git a/ql/instruments/makeois.cpp b/ql/instruments/makeois.cpp index 8354c045a59..1c62d3f5d49 100644 --- a/ql/instruments/makeois.cpp +++ b/ql/instruments/makeois.cpp @@ -44,7 +44,9 @@ namespace QuantLib { isDefaultEOM_(true), type_(OvernightIndexedSwap::Payer), nominal_(1.0), overnightSpread_(0.0), - fixedDayCount_(overnightIndex->dayCounter()), telescopicValueDates_(false) {} + fixedDayCount_(overnightIndex->dayCounter()), + telescopicValueDates_(false), + averagingMethod_(OvernightAveraging::Compound) {} MakeOIS::operator OvernightIndexedSwap() const { ext::shared_ptr ois = *this; @@ -124,7 +126,8 @@ namespace QuantLib { usedFixedRate, fixedDayCount_, overnightIndex_, overnightSpread_, paymentLag_, paymentAdjustment_, - paymentCalendar_, telescopicValueDates_)); + paymentCalendar_, telescopicValueDates_, + averagingMethod_)); if (engine_ == 0) { Handle disc = @@ -233,8 +236,11 @@ namespace QuantLib { MakeOIS& MakeOIS::withTelescopicValueDates(bool telescopicValueDates) { telescopicValueDates_ = telescopicValueDates; return *this; - } + MakeOIS& MakeOIS::withAveragingMethod(OvernightAveraging averagingMethod) { + averagingMethod_ = averagingMethod; + return *this; + } } diff --git a/ql/instruments/makeois.hpp b/ql/instruments/makeois.hpp index ef2ca228b65..ec7b6517d16 100644 --- a/ql/instruments/makeois.hpp +++ b/ql/instruments/makeois.hpp @@ -71,6 +71,8 @@ namespace QuantLib { MakeOIS &withTelescopicValueDates(bool telescopicValueDates); + MakeOIS& withAveragingMethod(OvernightAveraging averagingMethod); + MakeOIS& withPricingEngine( const ext::shared_ptr& engine); private: @@ -100,6 +102,7 @@ namespace QuantLib { ext::shared_ptr engine_; bool telescopicValueDates_; + OvernightAveraging averagingMethod_; }; } diff --git a/ql/instruments/overnightindexedswap.cpp b/ql/instruments/overnightindexedswap.cpp index 8ca475a9aca..ed5768051bc 100644 --- a/ql/instruments/overnightindexedswap.cpp +++ b/ql/instruments/overnightindexedswap.cpp @@ -21,7 +21,6 @@ */ #include -#include #include namespace QuantLib { @@ -37,13 +36,14 @@ namespace QuantLib { Natural paymentLag, BusinessDayConvention paymentAdjustment, const Calendar& paymentCalendar, - bool telescopicValueDates) + bool telescopicValueDates, + OvernightAveraging averagingMethod) : Swap(2), type_(type), nominals_(std::vector(1, nominal)), paymentFrequency_(schedule.tenor().frequency()), paymentCalendar_(paymentCalendar.empty() ? schedule.calendar() : paymentCalendar), paymentAdjustment_(paymentAdjustment), paymentLag_(paymentLag), fixedRate_(fixedRate), fixedDC_(fixedDC), overnightIndex_(overnightIndex), spread_(spread), - telescopicValueDates_(telescopicValueDates) { + telescopicValueDates_(telescopicValueDates), averagingMethod_(averagingMethod) { initialize(schedule); } @@ -59,12 +59,13 @@ namespace QuantLib { Natural paymentLag, BusinessDayConvention paymentAdjustment, const Calendar& paymentCalendar, - bool telescopicValueDates) + bool telescopicValueDates, + OvernightAveraging averagingMethod) : Swap(2), type_(type), nominals_(nominals), paymentFrequency_(schedule.tenor().frequency()), paymentCalendar_(paymentCalendar.empty() ? schedule.calendar() : paymentCalendar), paymentAdjustment_(paymentAdjustment), paymentLag_(paymentLag), fixedRate_(fixedRate), fixedDC_(fixedDC), overnightIndex_(overnightIndex), spread_(spread), - telescopicValueDates_(telescopicValueDates) { + telescopicValueDates_(telescopicValueDates), averagingMethod_(averagingMethod) { initialize(schedule); } @@ -85,7 +86,8 @@ namespace QuantLib { .withTelescopicValueDates(telescopicValueDates_) .withPaymentLag(paymentLag_) .withPaymentAdjustment(paymentAdjustment_) - .withPaymentCalendar(paymentCalendar_); + .withPaymentCalendar(paymentCalendar_) + .withAveragingMethod(averagingMethod_); for (Size j=0; j<2; ++j) { for (Leg::iterator i = legs_[j].begin(); i!= legs_[j].end(); ++i) diff --git a/ql/instruments/overnightindexedswap.hpp b/ql/instruments/overnightindexedswap.hpp index 007cf158880..67937238f50 100644 --- a/ql/instruments/overnightindexedswap.hpp +++ b/ql/instruments/overnightindexedswap.hpp @@ -28,6 +28,7 @@ #define quantlib_overnight_indexed_swap_hpp #include +#include #include #include #include @@ -51,7 +52,8 @@ namespace QuantLib { Natural paymentLag = 0, BusinessDayConvention paymentAdjustment = Following, const Calendar& paymentCalendar = Calendar(), - bool telescopicValueDates = false); + bool telescopicValueDates = false, + OvernightAveraging averagingMethod = OvernightAveraging::Compound); OvernightIndexedSwap(Type type, const std::vector& nominals, @@ -63,7 +65,8 @@ namespace QuantLib { Natural paymentLag = 0, BusinessDayConvention paymentAdjustment = Following, const Calendar& paymentCalendar = Calendar(), - bool telescopicValueDates = false); + bool telescopicValueDates = false, + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! \name Inspectors //@{ @@ -71,7 +74,6 @@ namespace QuantLib { Real nominal() const; std::vector nominals() const { return nominals_; } - //const Schedule& schedule() { return schedule_; } Frequency paymentFrequency() { return paymentFrequency_; } Rate fixedRate() const { return fixedRate_; } @@ -82,6 +84,8 @@ namespace QuantLib { const Leg& fixedLeg() const { return legs_[0]; } const Leg& overnightLeg() const { return legs_[1]; } + + OvernightAveraging averagingMethod() const { return averagingMethod_; } //@} //! \name Results @@ -112,6 +116,7 @@ namespace QuantLib { ext::shared_ptr overnightIndex_; Spread spread_; bool telescopicValueDates_; + OvernightAveraging averagingMethod_; }; diff --git a/ql/termstructures/yield/oisratehelper.cpp b/ql/termstructures/yield/oisratehelper.cpp index 3b5ba64d5f1..66a48f21b9e 100644 --- a/ql/termstructures/yield/oisratehelper.cpp +++ b/ql/termstructures/yield/oisratehelper.cpp @@ -39,7 +39,8 @@ namespace QuantLib { const Period& forwardStart, const Spread overnightSpread, Pillar::Choice pillar, - Date customPillarDate) + Date customPillarDate, + OvernightAveraging averagingMethod) : RelativeDateRateHelper(fixedRate), pillarChoice_(pillar), settlementDays_(settlementDays), tenor_(tenor), @@ -48,7 +49,8 @@ namespace QuantLib { paymentLag_(paymentLag), paymentConvention_(paymentConvention), paymentFrequency_(paymentFrequency), paymentCalendar_(paymentCalendar), - forwardStart_(forwardStart), overnightSpread_(overnightSpread) { + forwardStart_(forwardStart), overnightSpread_(overnightSpread), + averagingMethod_(averagingMethod) { registerWith(overnightIndex_); registerWith(discountHandle_); @@ -75,7 +77,8 @@ namespace QuantLib { .withPaymentAdjustment(paymentConvention_) .withPaymentFrequency(paymentFrequency_) .withPaymentCalendar(paymentCalendar_) - .withOvernightLegSpread(overnightSpread_); + .withOvernightLegSpread(overnightSpread_) + .withAveragingMethod(averagingMethod_); earliestDate_ = swap_->startDate(); maturityDate_ = swap_->maturityDate(); @@ -147,9 +150,11 @@ namespace QuantLib { const Handle& fixedRate, const ext::shared_ptr& overnightIndex, const Handle& discount, - bool telescopicValueDates) + bool telescopicValueDates, + OvernightAveraging averagingMethod) : RateHelper(fixedRate), discountHandle_(discount), - telescopicValueDates_(telescopicValueDates) { + telescopicValueDates_(telescopicValueDates), + averagingMethod_(averagingMethod) { registerWith(overnightIndex); registerWith(discountHandle_); @@ -167,7 +172,8 @@ namespace QuantLib { .withDiscountingTermStructure(discountRelinkableHandle_) .withEffectiveDate(startDate) .withTerminationDate(endDate) - .withTelescopicValueDates(telescopicValueDates_); + .withTelescopicValueDates(telescopicValueDates_) + .withAveragingMethod(averagingMethod_); earliestDate_ = swap_->startDate(); Date lastPaymentDate = std::max(swap_->overnightLeg().back()->date(), diff --git a/ql/termstructures/yield/oisratehelper.hpp b/ql/termstructures/yield/oisratehelper.hpp index cb72c483bc1..136ff3c0473 100644 --- a/ql/termstructures/yield/oisratehelper.hpp +++ b/ql/termstructures/yield/oisratehelper.hpp @@ -48,7 +48,8 @@ namespace QuantLib { const Period& forwardStart = 0 * Days, Spread overnightSpread = 0.0, Pillar::Choice pillar = Pillar::LastRelevantDate, - Date customPillarDate = Date()); + Date customPillarDate = Date(), + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! \name RateHelper interface //@{ Real impliedQuote() const override; @@ -83,6 +84,7 @@ namespace QuantLib { Calendar paymentCalendar_; Period forwardStart_; Spread overnightSpread_; + OvernightAveraging averagingMethod_; }; //! Rate helper for bootstrapping over Overnight Indexed Swap rates @@ -96,7 +98,8 @@ namespace QuantLib { // exogenous discounting curve const Handle& discountingCurve = Handle(), - bool telescopicValueDates = false); + bool telescopicValueDates = false, + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! \name RateHelper interface //@{ Real impliedQuote() const override; @@ -113,6 +116,7 @@ namespace QuantLib { Handle discountHandle_; bool telescopicValueDates_; RelinkableHandle discountRelinkableHandle_; + OvernightAveraging averagingMethod_; }; } diff --git a/test-suite/overnightindexedswap.cpp b/test-suite/overnightindexedswap.cpp index 88637b059ac..1ffc7f40be5 100644 --- a/test-suite/overnightindexedswap.cpp +++ b/test-suite/overnightindexedswap.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -134,30 +134,22 @@ namespace overnight_indexed_swap_test { SavedSettings backup; // utilities - ext::shared_ptr makeSwap(const ext::shared_ptr &index, - Period length, - Rate fixedRate, - Spread spread, - bool telescopicValueDates, - Date effectiveDate = Null(), - Natural paymentLag = 0) { - return MakeOIS(length, index, fixedRate) + ext::shared_ptr + makeSwap(Period length, + Rate fixedRate, + Spread spread, + bool telescopicValueDates, + Date effectiveDate = Null(), + Natural paymentLag = 0, + OvernightAveraging averagingMethod = OvernightAveraging::Compound) { + return MakeOIS(length, eoniaIndex, fixedRate, 0 * Days) .withEffectiveDate(effectiveDate == Null() ? settlement : effectiveDate) .withOvernightLegSpread(spread) .withNominal(nominal) .withPaymentLag(paymentLag) .withDiscountingTermStructure(eoniaTermStructure) - .withTelescopicValueDates(telescopicValueDates); - } - - ext::shared_ptr makeSwap(Period length, - Rate fixedRate, - Spread spread, - bool telescopicValueDates, - Date effectiveDate = Null(), - Natural paymentLag = 0) { - return makeSwap(eoniaIndex, length, fixedRate, spread, telescopicValueDates, - effectiveDate, paymentLag); + .withTelescopicValueDates(telescopicValueDates) + .withAveragingMethod(averagingMethod); } CommonVars() { @@ -324,76 +316,85 @@ void OvernightIndexedSwapTest::testCachedValue() { } namespace overnight_indexed_swap_test { - - ext::shared_ptr createIdx(const Handle& h = Handle(), - OvernightAveraging averagingMethod = OvernightAveraging::Compound) { - return ext::make_shared("Index", 0, EURCurrency(), TARGET(), - Actual360(), h, averagingMethod); - } - - void testBootstrap(bool telescopicValueDates, - OvernightAveraging averagingMethod, + void testBootstrap(bool telescopicValueDates, + OvernightAveraging averagingMethod, Real tolerance = 1.0e-8) { - CommonVars vars; - - Natural paymentLag = 2; + CommonVars vars; - std::vector > eoniaHelpers; + Natural paymentLag = 2; - ext::shared_ptr euribor3m(new Euribor3M); - ext::shared_ptr eonia = createIdx(vars.eoniaTermStructure, averagingMethod); + std::vector > eoniaHelpers; - for (Size i = 0; i < LENGTH(depositData); i++) { - Real rate = 0.01 * depositData[i].rate; - ext::shared_ptr simple = ext::make_shared(rate); - ext::shared_ptr quote(simple); - Period term = depositData[i].n * depositData[i].unit; - ext::shared_ptr helper(new DepositRateHelper( - Handle(quote), term, depositData[i].settlementDays, - euribor3m->fixingCalendar(), euribor3m->businessDayConvention(), - euribor3m->endOfMonth(), euribor3m->dayCounter())); + ext::shared_ptr euribor3m(new Euribor3M); + ext::shared_ptr eonia(new Eonia); - if (term <= 2 * Days) - eoniaHelpers.push_back(helper); - } + for (Size i = 0; i < LENGTH(depositData); i++) { + Real rate = 0.01 * depositData[i].rate; + ext::shared_ptr simple = ext::make_shared(rate); + ext::shared_ptr quote (simple); + Period term = depositData[i].n * depositData[i].unit; + ext::shared_ptr helper(new + DepositRateHelper(Handle(quote), + term, + depositData[i].settlementDays, + euribor3m->fixingCalendar(), + euribor3m->businessDayConvention(), + euribor3m->endOfMonth(), + euribor3m->dayCounter())); - for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { - Real rate = 0.01 * eoniaSwapData[i].rate; - ext::shared_ptr simple = ext::make_shared(rate); - ext::shared_ptr quote(simple); - Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; - ext::shared_ptr helper(new OISRateHelper( - eoniaSwapData[i].settlementDays, term, Handle(quote), eonia, - Handle(), telescopicValueDates, paymentLag)); + if (term <= 2*Days) eoniaHelpers.push_back(helper); - } - - ext::shared_ptr eoniaTS( - new PiecewiseFlatForward(vars.today, eoniaHelpers, Actual365Fixed())); + } - vars.eoniaTermStructure.linkTo(eoniaTS); + for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { + Real rate = 0.01 * eoniaSwapData[i].rate; + ext::shared_ptr simple = ext::make_shared(rate); + ext::shared_ptr quote (simple); + Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; + ext::shared_ptr helper(new + OISRateHelper(eoniaSwapData[i].settlementDays, + term, + Handle(quote), + eonia, + Handle(), + telescopicValueDates, + paymentLag, + Following, + Annual, + Calendar(), + 0 * Days, + 0.0, + Pillar::LastRelevantDate, + Date(), + averagingMethod)); + eoniaHelpers.push_back(helper); + } - // test curve consistency - for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { - Rate expected = eoniaSwapData[i].rate / 100; - Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; - // test telescopic value dates (in bootstrap) against non telescopic value dates (swap - // here) - ext::shared_ptr swap = - vars.makeSwap(eonia, term, 0.0, 0.0, false, Null(), paymentLag); - Rate calculated = swap->fairRate(); - Rate error = std::fabs(expected - calculated); - - if (error > tolerance) - BOOST_FAIL("curve inconsistency:" << std::setprecision(10) << - "\n swap length: " << term << - "\n quoted rate: " << expected << - "\n calculated rate: " << calculated << - "\n error: " << error << - "\n tolerance: " << tolerance); - } - } // testBootstrap(telescopicValueDates) + ext::shared_ptr eoniaTS( + new PiecewiseFlatForward (vars.today, eoniaHelpers, Actual365Fixed())); + + vars.eoniaTermStructure.linkTo(eoniaTS); + + // test curve consistency + for (Size i = 0; i < LENGTH(eoniaSwapData); i++) { + Rate expected = eoniaSwapData[i].rate/100; + Period term = eoniaSwapData[i].n * eoniaSwapData[i].unit; + // test telescopic value dates (in bootstrap) against non telescopic value dates (swap here) + ext::shared_ptr swap = + vars.makeSwap(term, 0.0, 0.0, false, Null(), paymentLag, averagingMethod); + Rate calculated = swap->fairRate(); + Rate error = std::fabs(expected-calculated); + + if (error>tolerance) + BOOST_FAIL("curve inconsistency:" << std::setprecision(10) << + "\n swap length: " << term << + "\n quoted rate: " << expected << + "\n calculated rate: " << calculated << + "\n error: " << error << + "\n tolerance: " << tolerance); + } +} // testBootstrap(telescopicValueDates) } // anonymous namespace void OvernightIndexedSwapTest::testBootstrap() { @@ -416,7 +417,7 @@ void OvernightIndexedSwapTest::testBootstrapWithTelescopicDatesAndArithmeticAver BOOST_TEST_MESSAGE( "Testing Eonia-swap curve building with telescopic value dates and AAON rates..."); // Given that we are using an approximation that omits - // the required convexity correction, a higher tolerance + // the required convexity correction, a lower tolerance // is needed. overnight_indexed_swap_test::testBootstrap(true, OvernightAveraging::Simple, 1.0e-5); } diff --git a/test-suite/quantlibtestsuite.cpp b/test-suite/quantlibtestsuite.cpp index f6ac0f1da30..556cd09f300 100644 --- a/test-suite/quantlibtestsuite.cpp +++ b/test-suite/quantlibtestsuite.cpp @@ -370,122 +370,122 @@ test_suite* init_unit_test_suite(int, char* []) { test->add(QUANTLIB_TEST_CASE(startTimer)); - test->add(AmericanOptionTest::suite()); - test->add(AndreasenHugeVolatilityInterplTest::suite(speed)); - test->add(ArrayTest::suite()); - test->add(AsianOptionTest::suite()); - test->add(AssetSwapTest::suite()); // fails with QL_USE_INDEXED_COUPON - test->add(AutocovariancesTest::suite()); - test->add(BarrierOptionTest::suite()); - test->add(BasketOptionTest::suite(speed)); - test->add(BatesModelTest::suite()); - test->add(BermudanSwaptionTest::suite(speed)); - test->add(BinaryOptionTest::suite()); - test->add(BlackFormulaTest::suite()); - test->add(BondTest::suite()); - test->add(BrownianBridgeTest::suite()); - test->add(BusinessDayConventionTest::suite()); - test->add(CalendarTest::suite()); - test->add(CapFloorTest::suite()); - test->add(CapFlooredCouponTest::suite()); - test->add(CashFlowsTest::suite()); - test->add(CliquetOptionTest::suite()); - test->add(CmsTest::suite()); - test->add(CovarianceTest::suite()); - test->add(CPISwapTest::suite()); - test->add(CreditDefaultSwapTest::suite()); - test->add(CrossCurrencyRateHelpersTest::suite()); - test->add(CurveStatesTest::suite()); - test->add(DateTest::suite(speed)); - test->add(DayCounterTest::suite()); - test->add(DefaultProbabilityCurveTest::suite()); - test->add(DigitalCouponTest::suite()); // might fail with QL_USE_INDEXED_COUPON - test->add(DigitalOptionTest::suite()); - test->add(DistributionTest::suite(speed)); - test->add(DividendOptionTest::suite()); - test->add(EuropeanOptionTest::suite()); - test->add(ExchangeRateTest::suite()); - test->add(FastFourierTransformTest::suite()); - test->add(FdHestonTest::suite(speed)); - test->add(FdmLinearOpTest::suite()); - test->add(FdCevTest::suite(speed)); - test->add(FdCIRTest::suite(speed)); - test->add(FdSabrTest::suite(speed)); - test->add(FittedBondDiscountCurveTest::suite()); - test->add(ForwardOptionTest::suite()); - test->add(ForwardRateAgreementTest::suite()); - test->add(FunctionsTest::suite()); - test->add(GARCHTest::suite()); - test->add(GaussianQuadraturesTest::suite()); - test->add(GJRGARCHModelTest::suite(speed)); - test->add(GsrTest::suite()); - test->add(HestonModelTest::suite(speed)); - test->add(HybridHestonHullWhiteProcessTest::suite(speed)); - test->add(IndexTest::suite()); - test->add(InflationTest::suite()); - test->add(InflationCapFloorTest::suite()); - test->add(InflationCapFlooredCouponTest::suite()); - test->add(InflationCPIBondTest::suite()); - test->add(InstrumentTest::suite()); - test->add(IntegralTest::suite()); - test->add(InterestRateTest::suite()); - test->add(InterpolationTest::suite()); - test->add(JumpDiffusionTest::suite()); - test->add(LazyObjectTest::suite()); - test->add(LinearLeastSquaresRegressionTest::suite()); - test->add(LookbackOptionTest::suite()); - test->add(LowDiscrepancyTest::suite()); - test->add(MarketModelTest::suite(speed)); - test->add(MarketModelCmsTest::suite(speed)); - test->add(MarketModelSmmTest::suite(speed)); - test->add(MarketModelSmmCapletAlphaCalibrationTest::suite()); - test->add(MarketModelSmmCapletCalibrationTest::suite()); - test->add(MarketModelSmmCapletHomoCalibrationTest::suite()); - test->add(MarkovFunctionalTest::suite(speed)); - test->add(MatricesTest::suite()); - test->add(MCLongstaffSchwartzEngineTest::suite()); - test->add(MersenneTwisterTest::suite()); - test->add(MoneyTest::suite()); - test->add(NumericalDifferentiationTest::suite()); - test->add(NthOrderDerivativeOpTest::suite()); - test->add(ObservableTest::suite()); - test->add(OdeTest::suite()); - test->add(OperatorTest::suite()); - test->add(OptimizersTest::suite(speed)); - test->add(OptionletStripperTest::suite()); + //test->add(AmericanOptionTest::suite()); + //test->add(AndreasenHugeVolatilityInterplTest::suite(speed)); + //test->add(ArrayTest::suite()); + //test->add(AsianOptionTest::suite()); + //test->add(AssetSwapTest::suite()); // fails with QL_USE_INDEXED_COUPON + //test->add(AutocovariancesTest::suite()); + //test->add(BarrierOptionTest::suite()); + //test->add(BasketOptionTest::suite(speed)); + //test->add(BatesModelTest::suite()); + //test->add(BermudanSwaptionTest::suite(speed)); + //test->add(BinaryOptionTest::suite()); + //test->add(BlackFormulaTest::suite()); + //test->add(BondTest::suite()); + //test->add(BrownianBridgeTest::suite()); + //test->add(BusinessDayConventionTest::suite()); + //test->add(CalendarTest::suite()); + //test->add(CapFloorTest::suite()); + //test->add(CapFlooredCouponTest::suite()); + //test->add(CashFlowsTest::suite()); + //test->add(CliquetOptionTest::suite()); + //test->add(CmsTest::suite()); + //test->add(CovarianceTest::suite()); + //test->add(CPISwapTest::suite()); + //test->add(CreditDefaultSwapTest::suite()); + //test->add(CrossCurrencyRateHelpersTest::suite()); + //test->add(CurveStatesTest::suite()); + //test->add(DateTest::suite(speed)); + //test->add(DayCounterTest::suite()); + //test->add(DefaultProbabilityCurveTest::suite()); + //test->add(DigitalCouponTest::suite()); // might fail with QL_USE_INDEXED_COUPON + //test->add(DigitalOptionTest::suite()); + //test->add(DistributionTest::suite(speed)); + //test->add(DividendOptionTest::suite()); + //test->add(EuropeanOptionTest::suite()); + //test->add(ExchangeRateTest::suite()); + //test->add(FastFourierTransformTest::suite()); + //test->add(FdHestonTest::suite(speed)); + //test->add(FdmLinearOpTest::suite()); + //test->add(FdCevTest::suite(speed)); + //test->add(FdCIRTest::suite(speed)); + //test->add(FdSabrTest::suite(speed)); + //test->add(FittedBondDiscountCurveTest::suite()); + //test->add(ForwardOptionTest::suite()); + //test->add(ForwardRateAgreementTest::suite()); + //test->add(FunctionsTest::suite()); + //test->add(GARCHTest::suite()); + //test->add(GaussianQuadraturesTest::suite()); + //test->add(GJRGARCHModelTest::suite(speed)); + //test->add(GsrTest::suite()); + //test->add(HestonModelTest::suite(speed)); + //test->add(HybridHestonHullWhiteProcessTest::suite(speed)); + //test->add(IndexTest::suite()); + //test->add(InflationTest::suite()); + //test->add(InflationCapFloorTest::suite()); + //test->add(InflationCapFlooredCouponTest::suite()); + //test->add(InflationCPIBondTest::suite()); + //test->add(InstrumentTest::suite()); + //test->add(IntegralTest::suite()); + //test->add(InterestRateTest::suite()); + //test->add(InterpolationTest::suite()); + //test->add(JumpDiffusionTest::suite()); + //test->add(LazyObjectTest::suite()); + //test->add(LinearLeastSquaresRegressionTest::suite()); + //test->add(LookbackOptionTest::suite()); + //test->add(LowDiscrepancyTest::suite()); + //test->add(MarketModelTest::suite(speed)); + //test->add(MarketModelCmsTest::suite(speed)); + //test->add(MarketModelSmmTest::suite(speed)); + //test->add(MarketModelSmmCapletAlphaCalibrationTest::suite()); + //test->add(MarketModelSmmCapletCalibrationTest::suite()); + //test->add(MarketModelSmmCapletHomoCalibrationTest::suite()); + //test->add(MarkovFunctionalTest::suite(speed)); + //test->add(MatricesTest::suite()); + //test->add(MCLongstaffSchwartzEngineTest::suite()); + //test->add(MersenneTwisterTest::suite()); + //test->add(MoneyTest::suite()); + //test->add(NumericalDifferentiationTest::suite()); + //test->add(NthOrderDerivativeOpTest::suite()); + //test->add(ObservableTest::suite()); + //test->add(OdeTest::suite()); + //test->add(OperatorTest::suite()); + //test->add(OptimizersTest::suite(speed)); + //test->add(OptionletStripperTest::suite()); test->add(OvernightIndexedSwapTest::suite()); - test->add(PathGeneratorTest::suite()); - test->add(PeriodTest::suite()); - test->add(PiecewiseYieldCurveTest::suite()); - test->add(PiecewiseZeroSpreadedTermStructureTest::suite()); - test->add(QuantoOptionTest::suite()); - test->add(QuoteTest::suite()); - test->add(RangeAccrualTest::suite()); - test->add(RiskStatisticsTest::suite()); - test->add(RngTraitsTest::suite()); - test->add(RoundingTest::suite()); - test->add(SampledCurveTest::suite()); - test->add(ScheduleTest::suite()); - test->add(ShortRateModelTest::suite(speed)); // fails with QL_USE_INDEXED_COUPON - test->add(Solver1DTest::suite()); - test->add(StatisticsTest::suite()); - test->add(SwapTest::suite()); - test->add(SwapForwardMappingsTest::suite()); - test->add(SwaptionTest::suite()); - test->add(SwaptionVolatilityCubeTest::suite()); - test->add(SwaptionVolatilityMatrixTest::suite()); - test->add(TermStructureTest::suite()); - test->add(TimeGridTest::suite()); - test->add(TimeSeriesTest::suite()); - test->add(TqrEigenDecompositionTest::suite()); - test->add(TracingTest::suite()); - test->add(TransformedGridTest::suite()); - test->add(UltimateForwardTermStructureTest::suite()); - test->add(VarianceSwapTest::suite()); - test->add(VolatilityModelsTest::suite()); + //test->add(PathGeneratorTest::suite()); + //test->add(PeriodTest::suite()); + //test->add(PiecewiseYieldCurveTest::suite()); + //test->add(PiecewiseZeroSpreadedTermStructureTest::suite()); + //test->add(QuantoOptionTest::suite()); + //test->add(QuoteTest::suite()); + //test->add(RangeAccrualTest::suite()); + //test->add(RiskStatisticsTest::suite()); + //test->add(RngTraitsTest::suite()); + //test->add(RoundingTest::suite()); + //test->add(SampledCurveTest::suite()); + //test->add(ScheduleTest::suite()); + //test->add(ShortRateModelTest::suite(speed)); // fails with QL_USE_INDEXED_COUPON + //test->add(Solver1DTest::suite()); + //test->add(StatisticsTest::suite()); + //test->add(SwapTest::suite()); + //test->add(SwapForwardMappingsTest::suite()); + //test->add(SwaptionTest::suite()); + //test->add(SwaptionVolatilityCubeTest::suite()); + //test->add(SwaptionVolatilityMatrixTest::suite()); + //test->add(TermStructureTest::suite()); + //test->add(TimeGridTest::suite()); + //test->add(TimeSeriesTest::suite()); + //test->add(TqrEigenDecompositionTest::suite()); + //test->add(TracingTest::suite()); + //test->add(TransformedGridTest::suite()); + //test->add(UltimateForwardTermStructureTest::suite()); + //test->add(VarianceSwapTest::suite()); + //test->add(VolatilityModelsTest::suite()); // tests for experimental classes - test->add(AmortizingBondTest::suite()); + /*test->add(AmortizingBondTest::suite()); test->add(AsianOptionTest::experimental()); test->add(BasismodelsTest::suite()); test->add(BarrierOptionTest::experimental()); @@ -521,9 +521,9 @@ test_suite* init_unit_test_suite(int, char* []) { test->add(PagodaOptionTest::suite()); test->add(PartialTimeBarrierOptionTest::suite()); test->add(QuantoOptionTest::experimental()); - test->add(RiskNeutralDensityCalculatorTest::experimental(speed)); + test->add(RiskNeutralDensityCalculatorTest::experimental(speed));*/ test->add(SofrFuturesTest::suite()); - test->add(SpreadOptionTest::suite()); + /*test->add(SpreadOptionTest::suite()); test->add(SquareRootCLVModelTest::experimental()); test->add(SwingOptionTest::suite(speed)); test->add(TwoAssetBarrierOptionTest::suite()); @@ -531,11 +531,11 @@ test_suite* init_unit_test_suite(int, char* []) { test->add(VarianceGammaTest::suite()); test->add(VarianceOptionTest::suite()); test->add(VPPTest::suite(speed)); - test->add(ZabrTest::suite(speed)); + test->add(ZabrTest::suite(speed));*/ // tests for deprecated classes - test->add(LiborMarketModelTest::suite(speed)); - test->add(LiborMarketModelProcessTest::suite(speed)); + //test->add(LiborMarketModelTest::suite(speed)); + //test->add(LiborMarketModelProcessTest::suite(speed)); test->add(QUANTLIB_TEST_CASE(stopTimer)); diff --git a/test-suite/sofrfutures.cpp b/test-suite/sofrfutures.cpp index af2e64de5be..799df05958d 100644 --- a/test-suite/sofrfutures.cpp +++ b/test-suite/sofrfutures.cpp @@ -36,7 +36,7 @@ namespace { Month month; Year year; Real price; - OvernightIndexFuture::NettingType subPeriodsNettingType; + OvernightAveraging averagingMethod; }; } @@ -51,22 +51,19 @@ void SofrFuturesTest::testBootstrap() { Settings::instance().evaluationDate() = today; const SofrQuotes sofrQuotes[] = { - {Monthly, Oct, 2018, 97.8175, OvernightIndexFuture::Averaging}, - {Monthly, Nov, 2018, 97.770, OvernightIndexFuture::Averaging}, - {Monthly, Dec, 2018, 97.685, OvernightIndexFuture::Averaging}, - {Monthly, Jan, 2019, 97.595, OvernightIndexFuture::Averaging}, - {Monthly, Feb, 2019, 97.590, OvernightIndexFuture::Averaging}, - {Monthly, Mar, 2019, 97.525, OvernightIndexFuture::Averaging}, - // removed due to overlap in bootstrap - // {Quarterly, Sep, 2018, 97.8175, OvernightIndexFuture::Compounding}, - // {Quarterly, Dec, 2018, 97.600, OvernightIndexFuture::Compounding}, - {Quarterly, Mar, 2019, 97.440, OvernightIndexFuture::Compounding}, - {Quarterly, Jun, 2019, 97.295, OvernightIndexFuture::Compounding}, - {Quarterly, Sep, 2019, 97.220, OvernightIndexFuture::Compounding}, - {Quarterly, Dec, 2019, 97.170, OvernightIndexFuture::Compounding}, - {Quarterly, Mar, 2020, 97.160, OvernightIndexFuture::Compounding}, - {Quarterly, Jun, 2020, 97.165, OvernightIndexFuture::Compounding}, - {Quarterly, Sep, 2020, 97.175, OvernightIndexFuture::Compounding}, + {Monthly, Oct, 2018, 97.8175, OvernightAveraging::Simple}, + {Monthly, Nov, 2018, 97.770, OvernightAveraging::Simple}, + {Monthly, Dec, 2018, 97.685, OvernightAveraging::Simple}, + {Monthly, Jan, 2019, 97.595, OvernightAveraging::Simple}, + {Monthly, Feb, 2019, 97.590, OvernightAveraging::Simple}, + {Monthly, Mar, 2019, 97.525, OvernightAveraging::Simple}, + {Quarterly, Mar, 2019, 97.440, OvernightAveraging::Compound}, + {Quarterly, Jun, 2019, 97.295, OvernightAveraging::Compound}, + {Quarterly, Sep, 2019, 97.220, OvernightAveraging::Compound}, + {Quarterly, Dec, 2019, 97.170, OvernightAveraging::Compound}, + {Quarterly, Mar, 2020, 97.160, OvernightAveraging::Compound}, + {Quarterly, Jun, 2020, 97.165, OvernightAveraging::Compound}, + {Quarterly, Sep, 2020, 97.175, OvernightAveraging::Compound}, }; ext::shared_ptr index = ext::make_shared(); @@ -93,7 +90,7 @@ void SofrFuturesTest::testBootstrap() { for (Size i = 0; i < LENGTH(sofrQuotes); i++) { helpers.push_back(ext::make_shared( sofrQuotes[i].price, sofrQuotes[i].month, sofrQuotes[i].year, - sofrQuotes[i].freq, index)); + sofrQuotes[i].freq, index, 0.0, sofrQuotes[i].averagingMethod)); } ext::shared_ptr > curve = From 5cbdecdb7a6b0449700dff435dd70826fb11fc54 Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Tue, 9 Feb 2021 16:31:54 +0100 Subject: [PATCH 06/16] Reverted accidentally committed changes. --- test-suite/quantlibtestsuite.cpp | 236 +++++++++++++++---------------- 1 file changed, 118 insertions(+), 118 deletions(-) diff --git a/test-suite/quantlibtestsuite.cpp b/test-suite/quantlibtestsuite.cpp index 556cd09f300..f6ac0f1da30 100644 --- a/test-suite/quantlibtestsuite.cpp +++ b/test-suite/quantlibtestsuite.cpp @@ -370,122 +370,122 @@ test_suite* init_unit_test_suite(int, char* []) { test->add(QUANTLIB_TEST_CASE(startTimer)); - //test->add(AmericanOptionTest::suite()); - //test->add(AndreasenHugeVolatilityInterplTest::suite(speed)); - //test->add(ArrayTest::suite()); - //test->add(AsianOptionTest::suite()); - //test->add(AssetSwapTest::suite()); // fails with QL_USE_INDEXED_COUPON - //test->add(AutocovariancesTest::suite()); - //test->add(BarrierOptionTest::suite()); - //test->add(BasketOptionTest::suite(speed)); - //test->add(BatesModelTest::suite()); - //test->add(BermudanSwaptionTest::suite(speed)); - //test->add(BinaryOptionTest::suite()); - //test->add(BlackFormulaTest::suite()); - //test->add(BondTest::suite()); - //test->add(BrownianBridgeTest::suite()); - //test->add(BusinessDayConventionTest::suite()); - //test->add(CalendarTest::suite()); - //test->add(CapFloorTest::suite()); - //test->add(CapFlooredCouponTest::suite()); - //test->add(CashFlowsTest::suite()); - //test->add(CliquetOptionTest::suite()); - //test->add(CmsTest::suite()); - //test->add(CovarianceTest::suite()); - //test->add(CPISwapTest::suite()); - //test->add(CreditDefaultSwapTest::suite()); - //test->add(CrossCurrencyRateHelpersTest::suite()); - //test->add(CurveStatesTest::suite()); - //test->add(DateTest::suite(speed)); - //test->add(DayCounterTest::suite()); - //test->add(DefaultProbabilityCurveTest::suite()); - //test->add(DigitalCouponTest::suite()); // might fail with QL_USE_INDEXED_COUPON - //test->add(DigitalOptionTest::suite()); - //test->add(DistributionTest::suite(speed)); - //test->add(DividendOptionTest::suite()); - //test->add(EuropeanOptionTest::suite()); - //test->add(ExchangeRateTest::suite()); - //test->add(FastFourierTransformTest::suite()); - //test->add(FdHestonTest::suite(speed)); - //test->add(FdmLinearOpTest::suite()); - //test->add(FdCevTest::suite(speed)); - //test->add(FdCIRTest::suite(speed)); - //test->add(FdSabrTest::suite(speed)); - //test->add(FittedBondDiscountCurveTest::suite()); - //test->add(ForwardOptionTest::suite()); - //test->add(ForwardRateAgreementTest::suite()); - //test->add(FunctionsTest::suite()); - //test->add(GARCHTest::suite()); - //test->add(GaussianQuadraturesTest::suite()); - //test->add(GJRGARCHModelTest::suite(speed)); - //test->add(GsrTest::suite()); - //test->add(HestonModelTest::suite(speed)); - //test->add(HybridHestonHullWhiteProcessTest::suite(speed)); - //test->add(IndexTest::suite()); - //test->add(InflationTest::suite()); - //test->add(InflationCapFloorTest::suite()); - //test->add(InflationCapFlooredCouponTest::suite()); - //test->add(InflationCPIBondTest::suite()); - //test->add(InstrumentTest::suite()); - //test->add(IntegralTest::suite()); - //test->add(InterestRateTest::suite()); - //test->add(InterpolationTest::suite()); - //test->add(JumpDiffusionTest::suite()); - //test->add(LazyObjectTest::suite()); - //test->add(LinearLeastSquaresRegressionTest::suite()); - //test->add(LookbackOptionTest::suite()); - //test->add(LowDiscrepancyTest::suite()); - //test->add(MarketModelTest::suite(speed)); - //test->add(MarketModelCmsTest::suite(speed)); - //test->add(MarketModelSmmTest::suite(speed)); - //test->add(MarketModelSmmCapletAlphaCalibrationTest::suite()); - //test->add(MarketModelSmmCapletCalibrationTest::suite()); - //test->add(MarketModelSmmCapletHomoCalibrationTest::suite()); - //test->add(MarkovFunctionalTest::suite(speed)); - //test->add(MatricesTest::suite()); - //test->add(MCLongstaffSchwartzEngineTest::suite()); - //test->add(MersenneTwisterTest::suite()); - //test->add(MoneyTest::suite()); - //test->add(NumericalDifferentiationTest::suite()); - //test->add(NthOrderDerivativeOpTest::suite()); - //test->add(ObservableTest::suite()); - //test->add(OdeTest::suite()); - //test->add(OperatorTest::suite()); - //test->add(OptimizersTest::suite(speed)); - //test->add(OptionletStripperTest::suite()); + test->add(AmericanOptionTest::suite()); + test->add(AndreasenHugeVolatilityInterplTest::suite(speed)); + test->add(ArrayTest::suite()); + test->add(AsianOptionTest::suite()); + test->add(AssetSwapTest::suite()); // fails with QL_USE_INDEXED_COUPON + test->add(AutocovariancesTest::suite()); + test->add(BarrierOptionTest::suite()); + test->add(BasketOptionTest::suite(speed)); + test->add(BatesModelTest::suite()); + test->add(BermudanSwaptionTest::suite(speed)); + test->add(BinaryOptionTest::suite()); + test->add(BlackFormulaTest::suite()); + test->add(BondTest::suite()); + test->add(BrownianBridgeTest::suite()); + test->add(BusinessDayConventionTest::suite()); + test->add(CalendarTest::suite()); + test->add(CapFloorTest::suite()); + test->add(CapFlooredCouponTest::suite()); + test->add(CashFlowsTest::suite()); + test->add(CliquetOptionTest::suite()); + test->add(CmsTest::suite()); + test->add(CovarianceTest::suite()); + test->add(CPISwapTest::suite()); + test->add(CreditDefaultSwapTest::suite()); + test->add(CrossCurrencyRateHelpersTest::suite()); + test->add(CurveStatesTest::suite()); + test->add(DateTest::suite(speed)); + test->add(DayCounterTest::suite()); + test->add(DefaultProbabilityCurveTest::suite()); + test->add(DigitalCouponTest::suite()); // might fail with QL_USE_INDEXED_COUPON + test->add(DigitalOptionTest::suite()); + test->add(DistributionTest::suite(speed)); + test->add(DividendOptionTest::suite()); + test->add(EuropeanOptionTest::suite()); + test->add(ExchangeRateTest::suite()); + test->add(FastFourierTransformTest::suite()); + test->add(FdHestonTest::suite(speed)); + test->add(FdmLinearOpTest::suite()); + test->add(FdCevTest::suite(speed)); + test->add(FdCIRTest::suite(speed)); + test->add(FdSabrTest::suite(speed)); + test->add(FittedBondDiscountCurveTest::suite()); + test->add(ForwardOptionTest::suite()); + test->add(ForwardRateAgreementTest::suite()); + test->add(FunctionsTest::suite()); + test->add(GARCHTest::suite()); + test->add(GaussianQuadraturesTest::suite()); + test->add(GJRGARCHModelTest::suite(speed)); + test->add(GsrTest::suite()); + test->add(HestonModelTest::suite(speed)); + test->add(HybridHestonHullWhiteProcessTest::suite(speed)); + test->add(IndexTest::suite()); + test->add(InflationTest::suite()); + test->add(InflationCapFloorTest::suite()); + test->add(InflationCapFlooredCouponTest::suite()); + test->add(InflationCPIBondTest::suite()); + test->add(InstrumentTest::suite()); + test->add(IntegralTest::suite()); + test->add(InterestRateTest::suite()); + test->add(InterpolationTest::suite()); + test->add(JumpDiffusionTest::suite()); + test->add(LazyObjectTest::suite()); + test->add(LinearLeastSquaresRegressionTest::suite()); + test->add(LookbackOptionTest::suite()); + test->add(LowDiscrepancyTest::suite()); + test->add(MarketModelTest::suite(speed)); + test->add(MarketModelCmsTest::suite(speed)); + test->add(MarketModelSmmTest::suite(speed)); + test->add(MarketModelSmmCapletAlphaCalibrationTest::suite()); + test->add(MarketModelSmmCapletCalibrationTest::suite()); + test->add(MarketModelSmmCapletHomoCalibrationTest::suite()); + test->add(MarkovFunctionalTest::suite(speed)); + test->add(MatricesTest::suite()); + test->add(MCLongstaffSchwartzEngineTest::suite()); + test->add(MersenneTwisterTest::suite()); + test->add(MoneyTest::suite()); + test->add(NumericalDifferentiationTest::suite()); + test->add(NthOrderDerivativeOpTest::suite()); + test->add(ObservableTest::suite()); + test->add(OdeTest::suite()); + test->add(OperatorTest::suite()); + test->add(OptimizersTest::suite(speed)); + test->add(OptionletStripperTest::suite()); test->add(OvernightIndexedSwapTest::suite()); - //test->add(PathGeneratorTest::suite()); - //test->add(PeriodTest::suite()); - //test->add(PiecewiseYieldCurveTest::suite()); - //test->add(PiecewiseZeroSpreadedTermStructureTest::suite()); - //test->add(QuantoOptionTest::suite()); - //test->add(QuoteTest::suite()); - //test->add(RangeAccrualTest::suite()); - //test->add(RiskStatisticsTest::suite()); - //test->add(RngTraitsTest::suite()); - //test->add(RoundingTest::suite()); - //test->add(SampledCurveTest::suite()); - //test->add(ScheduleTest::suite()); - //test->add(ShortRateModelTest::suite(speed)); // fails with QL_USE_INDEXED_COUPON - //test->add(Solver1DTest::suite()); - //test->add(StatisticsTest::suite()); - //test->add(SwapTest::suite()); - //test->add(SwapForwardMappingsTest::suite()); - //test->add(SwaptionTest::suite()); - //test->add(SwaptionVolatilityCubeTest::suite()); - //test->add(SwaptionVolatilityMatrixTest::suite()); - //test->add(TermStructureTest::suite()); - //test->add(TimeGridTest::suite()); - //test->add(TimeSeriesTest::suite()); - //test->add(TqrEigenDecompositionTest::suite()); - //test->add(TracingTest::suite()); - //test->add(TransformedGridTest::suite()); - //test->add(UltimateForwardTermStructureTest::suite()); - //test->add(VarianceSwapTest::suite()); - //test->add(VolatilityModelsTest::suite()); + test->add(PathGeneratorTest::suite()); + test->add(PeriodTest::suite()); + test->add(PiecewiseYieldCurveTest::suite()); + test->add(PiecewiseZeroSpreadedTermStructureTest::suite()); + test->add(QuantoOptionTest::suite()); + test->add(QuoteTest::suite()); + test->add(RangeAccrualTest::suite()); + test->add(RiskStatisticsTest::suite()); + test->add(RngTraitsTest::suite()); + test->add(RoundingTest::suite()); + test->add(SampledCurveTest::suite()); + test->add(ScheduleTest::suite()); + test->add(ShortRateModelTest::suite(speed)); // fails with QL_USE_INDEXED_COUPON + test->add(Solver1DTest::suite()); + test->add(StatisticsTest::suite()); + test->add(SwapTest::suite()); + test->add(SwapForwardMappingsTest::suite()); + test->add(SwaptionTest::suite()); + test->add(SwaptionVolatilityCubeTest::suite()); + test->add(SwaptionVolatilityMatrixTest::suite()); + test->add(TermStructureTest::suite()); + test->add(TimeGridTest::suite()); + test->add(TimeSeriesTest::suite()); + test->add(TqrEigenDecompositionTest::suite()); + test->add(TracingTest::suite()); + test->add(TransformedGridTest::suite()); + test->add(UltimateForwardTermStructureTest::suite()); + test->add(VarianceSwapTest::suite()); + test->add(VolatilityModelsTest::suite()); // tests for experimental classes - /*test->add(AmortizingBondTest::suite()); + test->add(AmortizingBondTest::suite()); test->add(AsianOptionTest::experimental()); test->add(BasismodelsTest::suite()); test->add(BarrierOptionTest::experimental()); @@ -521,9 +521,9 @@ test_suite* init_unit_test_suite(int, char* []) { test->add(PagodaOptionTest::suite()); test->add(PartialTimeBarrierOptionTest::suite()); test->add(QuantoOptionTest::experimental()); - test->add(RiskNeutralDensityCalculatorTest::experimental(speed));*/ + test->add(RiskNeutralDensityCalculatorTest::experimental(speed)); test->add(SofrFuturesTest::suite()); - /*test->add(SpreadOptionTest::suite()); + test->add(SpreadOptionTest::suite()); test->add(SquareRootCLVModelTest::experimental()); test->add(SwingOptionTest::suite(speed)); test->add(TwoAssetBarrierOptionTest::suite()); @@ -531,11 +531,11 @@ test_suite* init_unit_test_suite(int, char* []) { test->add(VarianceGammaTest::suite()); test->add(VarianceOptionTest::suite()); test->add(VPPTest::suite(speed)); - test->add(ZabrTest::suite(speed));*/ + test->add(ZabrTest::suite(speed)); // tests for deprecated classes - //test->add(LiborMarketModelTest::suite(speed)); - //test->add(LiborMarketModelProcessTest::suite(speed)); + test->add(LiborMarketModelTest::suite(speed)); + test->add(LiborMarketModelProcessTest::suite(speed)); test->add(QUANTLIB_TEST_CASE(stopTimer)); From c92005c68696626de024a165962e7afdda6c8fa7 Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Tue, 9 Feb 2021 16:34:32 +0100 Subject: [PATCH 07/16] Added whitespace. --- ql/experimental/averageois/arithmeticaverageois.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ql/experimental/averageois/arithmeticaverageois.cpp b/ql/experimental/averageois/arithmeticaverageois.cpp index a5d5be8b351..450a39e130b 100644 --- a/ql/experimental/averageois/arithmeticaverageois.cpp +++ b/ql/experimental/averageois/arithmeticaverageois.cpp @@ -84,7 +84,7 @@ namespace QuantLib { .withSpreads(spread_); ext::shared_ptr arithmeticPricer( - new ArithmeticAveragedOvernightIndexedCouponPricer(mrs_, vol_, byApprox_)); + new ArithmeticAveragedOvernightIndexedCouponPricer(mrs_, vol_, byApprox_)); for (Size i = 0; i < legs_[1].size(); i++) { ext::shared_ptr From 0d66db07ceca155bb5d51d1bcd5c74598045e434 Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Wed, 10 Feb 2021 18:10:22 +0100 Subject: [PATCH 08/16] Don't send notifications unless the evaluation date actually changes --- ql/settings.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ql/settings.hpp b/ql/settings.hpp index 0a3aeedf55d..3bbd4e7bca5 100644 --- a/ql/settings.hpp +++ b/ql/settings.hpp @@ -138,7 +138,8 @@ namespace QuantLib { } inline Settings::DateProxy& Settings::DateProxy::operator=(const Date& d) { - ObservableValue::operator=(d); + if (value() != d) // avoid notifications if the date doesn't actually change + ObservableValue::operator=(d); return *this; } From 0ea6042ae2d0b362d7947cab5eba7e46acf59e00 Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Thu, 11 Feb 2021 09:58:50 +0100 Subject: [PATCH 09/16] Add test --- test-suite/CMakeLists.txt | 2 + test-suite/Makefile.am | 2 + test-suite/quantlibtestsuite.cpp | 2 + test-suite/settings.cpp | 67 ++++++++++++++++++++++++++++ test-suite/settings.hpp | 35 +++++++++++++++ test-suite/testsuite.vcxproj | 4 +- test-suite/testsuite.vcxproj.filters | 8 +++- 7 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 test-suite/settings.cpp create mode 100644 test-suite/settings.hpp diff --git a/test-suite/CMakeLists.txt b/test-suite/CMakeLists.txt index 5639491455a..be4cf03629a 100644 --- a/test-suite/CMakeLists.txt +++ b/test-suite/CMakeLists.txt @@ -131,6 +131,7 @@ set(QuantLib-Test_SRC rounding.cpp sampledcurve.cpp schedule.cpp + settings.cpp shortratemodels.cpp sofrfutures.cpp solvers.cpp @@ -293,6 +294,7 @@ set(QuantLib-Test_HDR rounding.hpp sampledcurve.hpp schedule.hpp + settings.hpp shortratemodels.hpp sofrfutures.hpp solvers.hpp diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index 1ba7e58d9b1..dc86b3de527 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -129,6 +129,7 @@ QL_TEST_SRCS = \ rounding.cpp \ sampledcurve.cpp \ schedule.cpp \ + settings.cpp \ shortratemodels.cpp \ sofrfutures.cpp \ solvers.cpp \ @@ -288,6 +289,7 @@ QL_TEST_HDRS = \ rounding.hpp \ sampledcurve.hpp \ schedule.hpp \ + settings.hpp \ shortratemodels.hpp \ sofrfutures.hpp \ solvers.hpp \ diff --git a/test-suite/quantlibtestsuite.cpp b/test-suite/quantlibtestsuite.cpp index 139c5946209..437daa617ae 100644 --- a/test-suite/quantlibtestsuite.cpp +++ b/test-suite/quantlibtestsuite.cpp @@ -190,6 +190,7 @@ #include "rounding.hpp" #include "sampledcurve.hpp" #include "schedule.hpp" +#include "settings.hpp" #include "shortratemodels.hpp" #include "sofrfutures.hpp" #include "solvers.hpp" @@ -466,6 +467,7 @@ test_suite* init_unit_test_suite(int, char* []) { test->add(RoundingTest::suite()); test->add(SampledCurveTest::suite()); test->add(ScheduleTest::suite()); + test->add(SettingsTest::suite()); test->add(ShortRateModelTest::suite(speed)); // fails with QL_USE_INDEXED_COUPON test->add(Solver1DTest::suite()); test->add(StatisticsTest::suite()); diff --git a/test-suite/settings.cpp b/test-suite/settings.cpp new file mode 100644 index 00000000000..4d02ce44afb --- /dev/null +++ b/test-suite/settings.cpp @@ -0,0 +1,67 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2021 StatPro Italia srl + + 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 "settings.hpp" +#include "utilities.hpp" +#include + +using namespace QuantLib; +using namespace boost::unit_test_framework; + + +void SettingsTest::testNotificationsOnDateChange() { + BOOST_TEST_MESSAGE("Testing notifications on evaluation-date change..."); + + SavedSettings rollback; + +#ifdef QL_HIGH_RESOLUTION_DATE + + Date d1(11, February, 2021, 9, 17); + Date d2(11, February, 2021, 10, 21); + +#else + + Date d1(11, February, 2021); + Date d2(12, February, 2021); + +#endif + + Settings::instance().evaluationDate() = d1; + + Flag flag; + flag.registerWith(Settings::instance().evaluationDate()); + + // Set to same date, no notification + Settings::instance().evaluationDate() = d1; + + if (flag.isUp()) + BOOST_ERROR("unexpected notification"); + + // Set to different date, notification expected + Settings::instance().evaluationDate() = d2; + + if (!flag.isUp()) + BOOST_ERROR("missing notification"); +} + +test_suite* SettingsTest::suite() { + auto* suite = BOOST_TEST_SUITE("SettingsTest tests"); + suite->add(QUANTLIB_TEST_CASE(&SettingsTest::testNotificationsOnDateChange)); + return suite; +} diff --git a/test-suite/settings.hpp b/test-suite/settings.hpp new file mode 100644 index 00000000000..b1543e12e2b --- /dev/null +++ b/test-suite/settings.hpp @@ -0,0 +1,35 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2021 StatPro Italia srl + + 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. +*/ + +#ifndef quantlib_test_settings_hpp +#define quantlib_test_settings_hpp + +#include + +/* remember to document new and/or updated tests in the Doxygen + comment block of the corresponding class */ + +class SettingsTest { + public: + static void testNotificationsOnDateChange(); + static boost::unit_test_framework::test_suite* suite(); +}; + + +#endif diff --git a/test-suite/testsuite.vcxproj b/test-suite/testsuite.vcxproj index cf40a7627f5..414ea6c2c65 100644 --- a/test-suite/testsuite.vcxproj +++ b/test-suite/testsuite.vcxproj @@ -763,6 +763,7 @@ + @@ -923,6 +924,7 @@ + @@ -965,4 +967,4 @@ - \ No newline at end of file + diff --git a/test-suite/testsuite.vcxproj.filters b/test-suite/testsuite.vcxproj.filters index 6849f3bd9c2..20488fc3643 100644 --- a/test-suite/testsuite.vcxproj.filters +++ b/test-suite/testsuite.vcxproj.filters @@ -353,6 +353,9 @@ Source Files + + Source Files + Source Files @@ -827,6 +830,9 @@ Header Files + + Header Files + Header Files @@ -960,4 +966,4 @@ Header Files - \ No newline at end of file + From f18c90e11ea0c964363e1e58a119af81d4ea7cf7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 11 Feb 2021 09:31:55 +0000 Subject: [PATCH 10/16] Update copyright list in license --- LICENSE.TXT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.TXT b/LICENSE.TXT index 4ccedc0b718..33e98d89ea2 100644 --- a/LICENSE.TXT +++ b/LICENSE.TXT @@ -10,7 +10,7 @@ QuantLib is Copyright (C) 2003 Kawanishi Tomoya Copyright (C) 2003 Niels Elken Sønderby Copyright (C) 2003, 2004 Roman Gitlin - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017, 2018, 2019, 2020 StatPro Italia srl + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 StatPro Italia srl Copyright (C) 2003, 2004, 2007 Neil Firth Copyright (C) 2004 FIMAT Group From 28b67687be3181fd8180cb7fd2dfdf396ab84474 Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Thu, 11 Feb 2021 11:06:35 +0100 Subject: [PATCH 11/16] Change warning options in headers check --- tools/check_header.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/check_header.py b/tools/check_header.py index 9fafce3a7e6..45b0e96fc2f 100755 --- a/tools/check_header.py +++ b/tools/check_header.py @@ -20,11 +20,11 @@ ) fd, fname = tempfile.mkstemp(suffix=".cpp", dir=".", text=True) - os.write(fd, bytes(str(main).encode("utf-8"))) + os.write(fd, bytes(str(main).encode("utf-8"))) os.close(fd) print("Checking %s" % header) - command = "g++ -c -Wno-unknown-pragmas -Wno-deprecated-declarations -I. %s -o /dev/null" % fname + command = "g++ -c -Wno-unknown-pragmas -Wall -Werror -I. %s -o /dev/null" % fname code = os.system(command) if code != 0: errors += 1 From 602f939e75908f2022fbfab6abe86cc2634284bb Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Thu, 11 Feb 2021 14:43:45 +0100 Subject: [PATCH 12/16] Fix test setup in intraday case. --- test-suite/settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-suite/settings.cpp b/test-suite/settings.cpp index 4d02ce44afb..590c8ac182a 100644 --- a/test-suite/settings.cpp +++ b/test-suite/settings.cpp @@ -32,8 +32,8 @@ void SettingsTest::testNotificationsOnDateChange() { #ifdef QL_HIGH_RESOLUTION_DATE - Date d1(11, February, 2021, 9, 17); - Date d2(11, February, 2021, 10, 21); + Date d1(11, February, 2021, 9, 17, 0); + Date d2(11, February, 2021, 10, 21, 0); #else From 04663b1a48a1bee6f4c23ea973437e88a72d71cc Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Thu, 11 Feb 2021 19:14:47 +0100 Subject: [PATCH 13/16] Added a docstring for the new enum class. --- ql/cashflows/overnightindexedcoupon.hpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/ql/cashflows/overnightindexedcoupon.hpp b/ql/cashflows/overnightindexedcoupon.hpp index 23fd454148e..a2ee53e2054 100644 --- a/ql/cashflows/overnightindexedcoupon.hpp +++ b/ql/cashflows/overnightindexedcoupon.hpp @@ -34,8 +34,24 @@ namespace QuantLib { + //! overnight coupon averaging method + /*! It allows to configure how interest is accrued in the overnight coupon. + */ + enum class OvernightAveraging { + Simple, /*!< Under the simple convention the amount of + interest is calculated by applying the daily + rate to the principal, and the payment due + at the end of the period is the sum of those + amounts. */ + Compound /*!< Under the compound convention, the additional + amount of interest owed each day is calculated + by applying the rate both to the principal + and the accumulated unpaid interest. */ + }; + //! overnight coupon - /*! %Coupon paying the compounded interest due to daily overnight fixings. + /*! %Coupon paying the interest, depending on the averaging convention, + due to daily overnight fixings. \warning telescopicValueDates optimizes the schedule for calculation speed, but might fail to produce correct results if the coupon ages by more than @@ -44,9 +60,6 @@ namespace QuantLib { rather by the OISRateHelper which is safe, since it reinitialises the instrument each time the evaluation date changes. */ - - enum class OvernightAveraging { Simple, Compound }; - class OvernightIndexedCoupon : public FloatingRateCoupon { public: OvernightIndexedCoupon( From 8ca1808ae9de1e5b2908d8c0edc182efa238ddf6 Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Thu, 11 Feb 2021 19:25:22 +0100 Subject: [PATCH 14/16] Incorporated OvernightAveraging in OvernightIndexedSwapIndex. --- ql/indexes/swapindex.cpp | 10 +++++++--- ql/indexes/swapindex.hpp | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ql/indexes/swapindex.cpp b/ql/indexes/swapindex.cpp index f6cc3387f9f..f7b2bab2f6d 100644 --- a/ql/indexes/swapindex.cpp +++ b/ql/indexes/swapindex.cpp @@ -187,7 +187,8 @@ namespace QuantLib { Natural settlementDays, const Currency& currency, const ext::shared_ptr& overnightIndex, - bool telescopicValueDates) + bool telescopicValueDates, + OvernightAveraging averagingMethod) : SwapIndex(familyName, tenor, settlementDays, @@ -197,7 +198,9 @@ namespace QuantLib { ModifiedFollowing, overnightIndex->dayCounter(), overnightIndex), - overnightIndex_(overnightIndex), telescopicValueDates_(telescopicValueDates) {} + overnightIndex_(overnightIndex), + telescopicValueDates_(telescopicValueDates), + averagingMethod_(averagingMethod) {} ext::shared_ptr @@ -211,7 +214,8 @@ namespace QuantLib { lastSwap_ = MakeOIS(tenor_, overnightIndex_, fixedRate) .withEffectiveDate(valueDate(fixingDate)) .withFixedLegDayCount(dayCounter_) - .withTelescopicValueDates(telescopicValueDates_); + .withTelescopicValueDates(telescopicValueDates_) + .withAveragingMethod(averagingMethod_); lastFixingDate_ = fixingDate; } return lastSwap_; diff --git a/ql/indexes/swapindex.hpp b/ql/indexes/swapindex.hpp index d99198eb0ad..a5826b20b93 100644 --- a/ql/indexes/swapindex.hpp +++ b/ql/indexes/swapindex.hpp @@ -25,6 +25,7 @@ #include #include +#include namespace QuantLib { @@ -113,7 +114,8 @@ namespace QuantLib { Natural settlementDays, const Currency& currency, const ext::shared_ptr& overnightIndex, - bool telescopicValueDates = false); + bool telescopicValueDates = false, + OvernightAveraging averagingMethod = OvernightAveraging::Compound); //! \name Inspectors //@{ ext::shared_ptr overnightIndex() const; @@ -126,6 +128,7 @@ namespace QuantLib { protected: ext::shared_ptr overnightIndex_; bool telescopicValueDates_; + OvernightAveraging averagingMethod_; // cache data to avoid swap recreation when the same fixing date // is used multiple time to forecast changing fixing mutable ext::shared_ptr lastSwap_; From 9e57978e50bcc38a9cc9e2dc15065c457ece4b52 Mon Sep 17 00:00:00 2001 From: Marcin Rybacki Date: Thu, 11 Feb 2021 22:43:48 +0100 Subject: [PATCH 15/16] Changed OvernightAveraging into struct with scoped enum. --- ql/cashflows/overnightindexedcoupon.cpp | 4 +-- ql/cashflows/overnightindexedcoupon.hpp | 28 ++++++++++--------- .../futures/overnightindexfuture.cpp | 2 +- .../futures/overnightindexfuture.hpp | 4 +-- .../overnightindexfutureratehelper.cpp | 6 ++-- .../overnightindexfutureratehelper.hpp | 6 ++-- ql/indexes/swapindex.cpp | 2 +- ql/indexes/swapindex.hpp | 4 +-- ql/instruments/makeois.cpp | 2 +- ql/instruments/makeois.hpp | 4 +-- ql/instruments/overnightindexedswap.cpp | 4 +-- ql/instruments/overnightindexedswap.hpp | 8 +++--- ql/termstructures/yield/oisratehelper.cpp | 4 +-- ql/termstructures/yield/oisratehelper.hpp | 8 +++--- test-suite/overnightindexedswap.cpp | 4 +-- test-suite/sofrfutures.cpp | 2 +- 16 files changed, 47 insertions(+), 45 deletions(-) diff --git a/ql/cashflows/overnightindexedcoupon.cpp b/ql/cashflows/overnightindexedcoupon.cpp index fcaa6e774e4..786a1c01ac1 100644 --- a/ql/cashflows/overnightindexedcoupon.cpp +++ b/ql/cashflows/overnightindexedcoupon.cpp @@ -126,7 +126,7 @@ namespace QuantLib { const Date& refPeriodEnd, const DayCounter& dayCounter, bool telescopicValueDates, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : FloatingRateCoupon(paymentDate, nominal, startDate, endDate, overnightIndex->fixingDays(), overnightIndex, gearing, spread, @@ -286,7 +286,7 @@ namespace QuantLib { return *this; } - OvernightLeg& OvernightLeg::withAveragingMethod(OvernightAveraging averagingMethod) { + OvernightLeg& OvernightLeg::withAveragingMethod(OvernightAveraging::Type averagingMethod) { averagingMethod_ = averagingMethod; return *this; } diff --git a/ql/cashflows/overnightindexedcoupon.hpp b/ql/cashflows/overnightindexedcoupon.hpp index d595d8b251f..6c226495e7a 100644 --- a/ql/cashflows/overnightindexedcoupon.hpp +++ b/ql/cashflows/overnightindexedcoupon.hpp @@ -37,16 +37,18 @@ namespace QuantLib { //! overnight coupon averaging method /*! It allows to configure how interest is accrued in the overnight coupon. */ - enum class OvernightAveraging { - Simple, /*!< Under the simple convention the amount of - interest is calculated by applying the daily - rate to the principal, and the payment due - at the end of the period is the sum of those - amounts. */ - Compound /*!< Under the compound convention, the additional - amount of interest owed each day is calculated - by applying the rate both to the principal - and the accumulated unpaid interest. */ + struct OvernightAveraging { + enum Type { + Simple, /*!< Under the simple convention the amount of + interest is calculated by applying the daily + rate to the principal, and the payment due + at the end of the period is the sum of those + amounts. */ + Compound /*!< Under the compound convention, the additional + amount of interest owed each day is calculated + by applying the rate both to the principal + and the accumulated unpaid interest. */ + }; }; //! overnight coupon @@ -74,7 +76,7 @@ namespace QuantLib { const Date& refPeriodEnd = Date(), const DayCounter& dayCounter = DayCounter(), bool telescopicValueDates = false, - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); //! \name Inspectors //@{ //! fixing dates for the rates to be compounded @@ -118,7 +120,7 @@ namespace QuantLib { OvernightLeg& withSpreads(Spread spread); OvernightLeg& withSpreads(const std::vector& spreads); OvernightLeg& withTelescopicValueDates(bool telescopicValueDates); - OvernightLeg& withAveragingMethod(OvernightAveraging averagingMethod); + OvernightLeg& withAveragingMethod(OvernightAveraging::Type averagingMethod); operator Leg() const; private: Schedule schedule_; @@ -131,7 +133,7 @@ namespace QuantLib { std::vector gearings_; std::vector spreads_; bool telescopicValueDates_; - OvernightAveraging averagingMethod_; + OvernightAveraging::Type averagingMethod_; }; } diff --git a/ql/experimental/futures/overnightindexfuture.cpp b/ql/experimental/futures/overnightindexfuture.cpp index 6467f4fa37a..686183806fa 100644 --- a/ql/experimental/futures/overnightindexfuture.cpp +++ b/ql/experimental/futures/overnightindexfuture.cpp @@ -31,7 +31,7 @@ namespace QuantLib { const Date& maturityDate, const Handle& discountCurve, Handle convexityAdjustment, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : Forward(overnightIndex->dayCounter(), overnightIndex->fixingCalendar(), overnightIndex->businessDayConvention(), diff --git a/ql/experimental/futures/overnightindexfuture.hpp b/ql/experimental/futures/overnightindexfuture.hpp index ce784a9540f..71e9bcb2847 100644 --- a/ql/experimental/futures/overnightindexfuture.hpp +++ b/ql/experimental/futures/overnightindexfuture.hpp @@ -43,7 +43,7 @@ namespace QuantLib { const Date& maturityDate, const Handle& discountCurve, Handle convexityAdjustment = Handle(), - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); //! returns spot value/price of an underlying financial instrument Real spotValue() const override; @@ -60,7 +60,7 @@ namespace QuantLib { Real compoundedSpotValue() const; ext::shared_ptr overnightIndex_; Handle convexityAdjustment_; - OvernightAveraging averagingMethod_; + OvernightAveraging::Type averagingMethod_; }; } diff --git a/ql/experimental/futures/overnightindexfutureratehelper.cpp b/ql/experimental/futures/overnightindexfutureratehelper.cpp index 1ca012d5a8b..1ba321e7c59 100644 --- a/ql/experimental/futures/overnightindexfutureratehelper.cpp +++ b/ql/experimental/futures/overnightindexfutureratehelper.cpp @@ -53,7 +53,7 @@ namespace QuantLib { const Date& maturityDate, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : RateHelper(price) { ext::shared_ptr payoff; future_ = ext::make_shared( @@ -97,7 +97,7 @@ namespace QuantLib { Frequency referenceFreq, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : OvernightIndexFutureRateHelper(price, getValidSofrStart(referenceMonth, referenceYear, referenceFreq), getValidSofrEnd(referenceMonth, referenceYear, referenceFreq), @@ -120,7 +120,7 @@ namespace QuantLib { Frequency referenceFreq, const ext::shared_ptr& overnightIndex, Real convexityAdjustment, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : OvernightIndexFutureRateHelper( Handle(ext::make_shared(price)), getValidSofrStart(referenceMonth, referenceYear, referenceFreq), diff --git a/ql/experimental/futures/overnightindexfutureratehelper.hpp b/ql/experimental/futures/overnightindexfutureratehelper.hpp index 605cbc95ed9..a2b734fdfaa 100644 --- a/ql/experimental/futures/overnightindexfutureratehelper.hpp +++ b/ql/experimental/futures/overnightindexfutureratehelper.hpp @@ -40,7 +40,7 @@ namespace QuantLib { const Date& maturityDate, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment = Handle(), - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); //! \name RateHelper interface //@{ @@ -73,14 +73,14 @@ namespace QuantLib { Frequency referenceFreq, const ext::shared_ptr& overnightIndex, const Handle& convexityAdjustment = Handle(), - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); SofrFutureRateHelper(Real price, Month referenceMonth, Year referenceYear, Frequency referenceFreq, const ext::shared_ptr& overnightIndex, Real convexityAdjustment = 0, - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); }; } diff --git a/ql/indexes/swapindex.cpp b/ql/indexes/swapindex.cpp index e389e8d38d0..af64e395157 100644 --- a/ql/indexes/swapindex.cpp +++ b/ql/indexes/swapindex.cpp @@ -189,7 +189,7 @@ namespace QuantLib { const Currency& currency, const ext::shared_ptr& overnightIndex, bool telescopicValueDates, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : SwapIndex(familyName, tenor, settlementDays, diff --git a/ql/indexes/swapindex.hpp b/ql/indexes/swapindex.hpp index 2eef8fe36ca..a888a84ea7d 100644 --- a/ql/indexes/swapindex.hpp +++ b/ql/indexes/swapindex.hpp @@ -115,7 +115,7 @@ namespace QuantLib { const Currency& currency, const ext::shared_ptr& overnightIndex, bool telescopicValueDates = false, - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); //! \name Inspectors //@{ ext::shared_ptr overnightIndex() const; @@ -128,7 +128,7 @@ namespace QuantLib { protected: ext::shared_ptr overnightIndex_; bool telescopicValueDates_; - OvernightAveraging averagingMethod_; + OvernightAveraging::Type averagingMethod_; // cache data to avoid swap recreation when the same fixing date // is used multiple time to forecast changing fixing mutable ext::shared_ptr lastSwap_; diff --git a/ql/instruments/makeois.cpp b/ql/instruments/makeois.cpp index 5fe145cdece..55b36f9d0cc 100644 --- a/ql/instruments/makeois.cpp +++ b/ql/instruments/makeois.cpp @@ -238,7 +238,7 @@ namespace QuantLib { return *this; } - MakeOIS& MakeOIS::withAveragingMethod(OvernightAveraging averagingMethod) { + MakeOIS& MakeOIS::withAveragingMethod(OvernightAveraging::Type averagingMethod) { averagingMethod_ = averagingMethod; return *this; } diff --git a/ql/instruments/makeois.hpp b/ql/instruments/makeois.hpp index ec7b6517d16..1cf92dc1082 100644 --- a/ql/instruments/makeois.hpp +++ b/ql/instruments/makeois.hpp @@ -71,7 +71,7 @@ namespace QuantLib { MakeOIS &withTelescopicValueDates(bool telescopicValueDates); - MakeOIS& withAveragingMethod(OvernightAveraging averagingMethod); + MakeOIS& withAveragingMethod(OvernightAveraging::Type averagingMethod); MakeOIS& withPricingEngine( const ext::shared_ptr& engine); @@ -102,7 +102,7 @@ namespace QuantLib { ext::shared_ptr engine_; bool telescopicValueDates_; - OvernightAveraging averagingMethod_; + OvernightAveraging::Type averagingMethod_; }; } diff --git a/ql/instruments/overnightindexedswap.cpp b/ql/instruments/overnightindexedswap.cpp index d63d713c4d1..52c209572b5 100644 --- a/ql/instruments/overnightindexedswap.cpp +++ b/ql/instruments/overnightindexedswap.cpp @@ -37,7 +37,7 @@ namespace QuantLib { BusinessDayConvention paymentAdjustment, const Calendar& paymentCalendar, bool telescopicValueDates, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : Swap(2), type_(type), nominals_(std::vector(1, nominal)), paymentFrequency_(schedule.tenor().frequency()), paymentCalendar_(paymentCalendar.empty() ? schedule.calendar() : paymentCalendar), @@ -59,7 +59,7 @@ namespace QuantLib { BusinessDayConvention paymentAdjustment, const Calendar& paymentCalendar, bool telescopicValueDates, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : Swap(2), type_(type), nominals_(std::move(nominals)), paymentFrequency_(schedule.tenor().frequency()), paymentCalendar_(paymentCalendar.empty() ? schedule.calendar() : paymentCalendar), diff --git a/ql/instruments/overnightindexedswap.hpp b/ql/instruments/overnightindexedswap.hpp index 411540ae495..00d527ad660 100644 --- a/ql/instruments/overnightindexedswap.hpp +++ b/ql/instruments/overnightindexedswap.hpp @@ -53,7 +53,7 @@ namespace QuantLib { BusinessDayConvention paymentAdjustment = Following, const Calendar& paymentCalendar = Calendar(), bool telescopicValueDates = false, - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); OvernightIndexedSwap(Type type, std::vector nominals, @@ -66,7 +66,7 @@ namespace QuantLib { BusinessDayConvention paymentAdjustment = Following, const Calendar& paymentCalendar = Calendar(), bool telescopicValueDates = false, - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); //! \name Inspectors //@{ @@ -85,7 +85,7 @@ namespace QuantLib { const Leg& fixedLeg() const { return legs_[0]; } const Leg& overnightLeg() const { return legs_[1]; } - OvernightAveraging averagingMethod() const { return averagingMethod_; } + OvernightAveraging::Type averagingMethod() const { return averagingMethod_; } //@} //! \name Results @@ -116,7 +116,7 @@ namespace QuantLib { ext::shared_ptr overnightIndex_; Spread spread_; bool telescopicValueDates_; - OvernightAveraging averagingMethod_; + OvernightAveraging::Type averagingMethod_; }; diff --git a/ql/termstructures/yield/oisratehelper.cpp b/ql/termstructures/yield/oisratehelper.cpp index 22f51790704..c8237e804af 100644 --- a/ql/termstructures/yield/oisratehelper.cpp +++ b/ql/termstructures/yield/oisratehelper.cpp @@ -40,7 +40,7 @@ namespace QuantLib { const Spread overnightSpread, Pillar::Choice pillar, Date customPillarDate, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : RelativeDateRateHelper(fixedRate), pillarChoice_(pillar), settlementDays_(settlementDays), tenor_(tenor), overnightIndex_(std::move(overnightIndex)), discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates), @@ -146,7 +146,7 @@ namespace QuantLib { const ext::shared_ptr& overnightIndex, Handle discount, bool telescopicValueDates, - OvernightAveraging averagingMethod) + OvernightAveraging::Type averagingMethod) : RateHelper(fixedRate), discountHandle_(std::move(discount)), telescopicValueDates_(telescopicValueDates), averagingMethod_(averagingMethod) { diff --git a/ql/termstructures/yield/oisratehelper.hpp b/ql/termstructures/yield/oisratehelper.hpp index 668142711d1..c3cd66bffa4 100644 --- a/ql/termstructures/yield/oisratehelper.hpp +++ b/ql/termstructures/yield/oisratehelper.hpp @@ -48,7 +48,7 @@ namespace QuantLib { Spread overnightSpread = 0.0, Pillar::Choice pillar = Pillar::LastRelevantDate, Date customPillarDate = Date(), - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); //! \name RateHelper interface //@{ Real impliedQuote() const override; @@ -83,7 +83,7 @@ namespace QuantLib { Calendar paymentCalendar_; Period forwardStart_; Spread overnightSpread_; - OvernightAveraging averagingMethod_; + OvernightAveraging::Type averagingMethod_; }; //! Rate helper for bootstrapping over Overnight Indexed Swap rates @@ -97,7 +97,7 @@ namespace QuantLib { // exogenous discounting curve Handle discountingCurve = Handle(), bool telescopicValueDates = false, - OvernightAveraging averagingMethod = OvernightAveraging::Compound); + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound); //! \name RateHelper interface //@{ Real impliedQuote() const override; @@ -114,7 +114,7 @@ namespace QuantLib { Handle discountHandle_; bool telescopicValueDates_; RelinkableHandle discountRelinkableHandle_; - OvernightAveraging averagingMethod_; + OvernightAveraging::Type averagingMethod_; }; } diff --git a/test-suite/overnightindexedswap.cpp b/test-suite/overnightindexedswap.cpp index a3f85ad6bc4..7a5cb9a7586 100644 --- a/test-suite/overnightindexedswap.cpp +++ b/test-suite/overnightindexedswap.cpp @@ -141,7 +141,7 @@ namespace overnight_indexed_swap_test { bool telescopicValueDates, Date effectiveDate = Null(), Natural paymentLag = 0, - OvernightAveraging averagingMethod = OvernightAveraging::Compound) { + OvernightAveraging::Type averagingMethod = OvernightAveraging::Compound) { return MakeOIS(length, eoniaIndex, fixedRate, 0 * Days) .withEffectiveDate(effectiveDate == Null() ? settlement : effectiveDate) .withOvernightLegSpread(spread) @@ -317,7 +317,7 @@ void OvernightIndexedSwapTest::testCachedValue() { namespace overnight_indexed_swap_test { void testBootstrap(bool telescopicValueDates, - OvernightAveraging averagingMethod, + OvernightAveraging::Type averagingMethod, Real tolerance = 1.0e-8) { CommonVars vars; diff --git a/test-suite/sofrfutures.cpp b/test-suite/sofrfutures.cpp index 015adb18505..3f815a5f255 100644 --- a/test-suite/sofrfutures.cpp +++ b/test-suite/sofrfutures.cpp @@ -36,7 +36,7 @@ namespace { Month month; Year year; Real price; - OvernightAveraging averagingMethod; + OvernightAveraging::Type averagingMethod; }; } From 8ebcae50ee9ac5c38f20001bfd90fd59c3c921e6 Mon Sep 17 00:00:00 2001 From: francis Date: Thu, 11 Feb 2021 22:39:36 +0000 Subject: [PATCH 16/16] Remove the deleted readme files from the example VS projects. --- Examples/BermudanSwaption/BermudanSwaption.vcxproj | 3 --- Examples/BermudanSwaption/BermudanSwaption.vcxproj.filters | 3 --- Examples/Bonds/Bonds.vcxproj | 3 --- Examples/Bonds/Bonds.vcxproj.filters | 3 --- Examples/CDS/CDS.vcxproj | 3 --- Examples/CDS/CDS.vcxproj.filters | 3 --- Examples/CallableBonds/CallableBonds.vcxproj | 3 --- Examples/CallableBonds/CallableBonds.vcxproj.filters | 3 --- Examples/ConvertibleBonds/ConvertibleBonds.vcxproj | 3 --- Examples/ConvertibleBonds/ConvertibleBonds.vcxproj.filters | 3 --- Examples/DiscreteHedging/DiscreteHedging.vcxproj | 3 --- Examples/DiscreteHedging/DiscreteHedging.vcxproj.filters | 3 --- Examples/EquityOption/EquityOption.vcxproj | 3 --- Examples/EquityOption/EquityOption.vcxproj.filters | 3 --- Examples/FRA/FRA.vcxproj | 3 --- Examples/FRA/FRA.vcxproj.filters | 3 --- Examples/FittedBondCurve/FittedBondCurve.vcxproj | 3 --- Examples/FittedBondCurve/FittedBondCurve.vcxproj.filters | 3 --- Examples/Gaussian1dModels/Gaussian1dModels.vcxproj | 3 --- Examples/Gaussian1dModels/Gaussian1dModels.vcxproj.filters | 5 +---- Examples/GlobalOptimizer/GlobalOptimizer.vcxproj | 3 --- Examples/GlobalOptimizer/GlobalOptimizer.vcxproj.filters | 3 --- Examples/MarketModels/MarketModels.vcxproj | 3 --- Examples/MarketModels/MarketModels.vcxproj.filters | 3 --- Examples/Replication/Replication.vcxproj | 3 --- Examples/Replication/Replication.vcxproj.filters | 3 --- Examples/Repo/Repo.vcxproj | 3 --- Examples/Repo/Repo.vcxproj.filters | 3 --- 28 files changed, 1 insertion(+), 85 deletions(-) diff --git a/Examples/BermudanSwaption/BermudanSwaption.vcxproj b/Examples/BermudanSwaption/BermudanSwaption.vcxproj index 10e0742a28b..8d4016855db 100644 --- a/Examples/BermudanSwaption/BermudanSwaption.vcxproj +++ b/Examples/BermudanSwaption/BermudanSwaption.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/BermudanSwaption/BermudanSwaption.vcxproj.filters b/Examples/BermudanSwaption/BermudanSwaption.vcxproj.filters index 5b7af0d4a19..004440ef99e 100644 --- a/Examples/BermudanSwaption/BermudanSwaption.vcxproj.filters +++ b/Examples/BermudanSwaption/BermudanSwaption.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/Bonds/Bonds.vcxproj b/Examples/Bonds/Bonds.vcxproj index 2a64851b84a..3b4d358d64b 100644 --- a/Examples/Bonds/Bonds.vcxproj +++ b/Examples/Bonds/Bonds.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/Bonds/Bonds.vcxproj.filters b/Examples/Bonds/Bonds.vcxproj.filters index ac42798ff69..6e10879169d 100644 --- a/Examples/Bonds/Bonds.vcxproj.filters +++ b/Examples/Bonds/Bonds.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/CDS/CDS.vcxproj b/Examples/CDS/CDS.vcxproj index 8e9b380ee54..865994bf49b 100644 --- a/Examples/CDS/CDS.vcxproj +++ b/Examples/CDS/CDS.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/CDS/CDS.vcxproj.filters b/Examples/CDS/CDS.vcxproj.filters index 40cad38d9c4..8e1cb235c33 100644 --- a/Examples/CDS/CDS.vcxproj.filters +++ b/Examples/CDS/CDS.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/CallableBonds/CallableBonds.vcxproj b/Examples/CallableBonds/CallableBonds.vcxproj index 0d723dc1f83..643f6ad5f60 100644 --- a/Examples/CallableBonds/CallableBonds.vcxproj +++ b/Examples/CallableBonds/CallableBonds.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/CallableBonds/CallableBonds.vcxproj.filters b/Examples/CallableBonds/CallableBonds.vcxproj.filters index a0b20df3419..f2a71ae5f92 100644 --- a/Examples/CallableBonds/CallableBonds.vcxproj.filters +++ b/Examples/CallableBonds/CallableBonds.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj b/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj index 14f8cf443b1..0bdc2db8ceb 100644 --- a/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj +++ b/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj.filters b/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj.filters index 3179756bb72..883f48e300c 100644 --- a/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj.filters +++ b/Examples/ConvertibleBonds/ConvertibleBonds.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/DiscreteHedging/DiscreteHedging.vcxproj b/Examples/DiscreteHedging/DiscreteHedging.vcxproj index 090d68e0176..8e99c3b6535 100644 --- a/Examples/DiscreteHedging/DiscreteHedging.vcxproj +++ b/Examples/DiscreteHedging/DiscreteHedging.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/DiscreteHedging/DiscreteHedging.vcxproj.filters b/Examples/DiscreteHedging/DiscreteHedging.vcxproj.filters index 2fd3d9dfe14..71b9eafe734 100644 --- a/Examples/DiscreteHedging/DiscreteHedging.vcxproj.filters +++ b/Examples/DiscreteHedging/DiscreteHedging.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/EquityOption/EquityOption.vcxproj b/Examples/EquityOption/EquityOption.vcxproj index cadb435b1c5..85aa7b4381b 100644 --- a/Examples/EquityOption/EquityOption.vcxproj +++ b/Examples/EquityOption/EquityOption.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/EquityOption/EquityOption.vcxproj.filters b/Examples/EquityOption/EquityOption.vcxproj.filters index 4cb6c92e385..8a96eee6e22 100644 --- a/Examples/EquityOption/EquityOption.vcxproj.filters +++ b/Examples/EquityOption/EquityOption.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/FRA/FRA.vcxproj b/Examples/FRA/FRA.vcxproj index 7a46954545a..14422084dca 100644 --- a/Examples/FRA/FRA.vcxproj +++ b/Examples/FRA/FRA.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/FRA/FRA.vcxproj.filters b/Examples/FRA/FRA.vcxproj.filters index d840cc9983e..80f0c29acde 100644 --- a/Examples/FRA/FRA.vcxproj.filters +++ b/Examples/FRA/FRA.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/FittedBondCurve/FittedBondCurve.vcxproj b/Examples/FittedBondCurve/FittedBondCurve.vcxproj index ee1f87c7113..b45c62b2978 100644 --- a/Examples/FittedBondCurve/FittedBondCurve.vcxproj +++ b/Examples/FittedBondCurve/FittedBondCurve.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/FittedBondCurve/FittedBondCurve.vcxproj.filters b/Examples/FittedBondCurve/FittedBondCurve.vcxproj.filters index d607a2e8c64..daabc39980b 100644 --- a/Examples/FittedBondCurve/FittedBondCurve.vcxproj.filters +++ b/Examples/FittedBondCurve/FittedBondCurve.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj b/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj index b2f23031c9d..754e4ec84b1 100644 --- a/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj +++ b/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj.filters b/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj.filters index 20bc3244771..d604deb5a99 100644 --- a/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj.filters +++ b/Examples/Gaussian1dModels/Gaussian1dModels.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - - + \ No newline at end of file diff --git a/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj b/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj index 7871d1808d4..c71632d12d0 100644 --- a/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj +++ b/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj.filters b/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj.filters index d18a3fce861..c9b80673ba5 100644 --- a/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj.filters +++ b/Examples/GlobalOptimizer/GlobalOptimizer.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/MarketModels/MarketModels.vcxproj b/Examples/MarketModels/MarketModels.vcxproj index b0cd019851b..9574d384aaa 100644 --- a/Examples/MarketModels/MarketModels.vcxproj +++ b/Examples/MarketModels/MarketModels.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/MarketModels/MarketModels.vcxproj.filters b/Examples/MarketModels/MarketModels.vcxproj.filters index 27b031d5ad0..35fe4aa9438 100644 --- a/Examples/MarketModels/MarketModels.vcxproj.filters +++ b/Examples/MarketModels/MarketModels.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/Replication/Replication.vcxproj b/Examples/Replication/Replication.vcxproj index d011e0af002..b5498e0b72a 100644 --- a/Examples/Replication/Replication.vcxproj +++ b/Examples/Replication/Replication.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/Replication/Replication.vcxproj.filters b/Examples/Replication/Replication.vcxproj.filters index 81d2dd2dfbd..d5e7a80a0ee 100644 --- a/Examples/Replication/Replication.vcxproj.filters +++ b/Examples/Replication/Replication.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file diff --git a/Examples/Repo/Repo.vcxproj b/Examples/Repo/Repo.vcxproj index 2a2caad3a91..8e3b4891b1c 100644 --- a/Examples/Repo/Repo.vcxproj +++ b/Examples/Repo/Repo.vcxproj @@ -541,9 +541,6 @@ - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} diff --git a/Examples/Repo/Repo.vcxproj.filters b/Examples/Repo/Repo.vcxproj.filters index 4acaf8e19f8..e6b3e66fefd 100644 --- a/Examples/Repo/Repo.vcxproj.filters +++ b/Examples/Repo/Repo.vcxproj.filters @@ -19,7 +19,4 @@ Source Files - - - \ No newline at end of file