From 1f7ba67bb7225d43b16c3d851b0acb9fdec63f46 Mon Sep 17 00:00:00 2001 From: ralfkonrad Date: Tue, 16 Jul 2024 15:50:00 +0200 Subject: [PATCH 01/10] Expose the OvernightIndexedCouponPricer --- ql/cashflows/overnightindexedcoupon.cpp | 291 +++++++++++------------- ql/cashflows/overnightindexedcoupon.hpp | 27 ++- 2 files changed, 161 insertions(+), 157 deletions(-) diff --git a/ql/cashflows/overnightindexedcoupon.cpp b/ql/cashflows/overnightindexedcoupon.cpp index db1e8019d4c..f23eafc57e2 100644 --- a/ql/cashflows/overnightindexedcoupon.cpp +++ b/ql/cashflows/overnightindexedcoupon.cpp @@ -48,155 +48,6 @@ namespace QuantLib { return n == interestDates.size() && applyObservationShift ? n - 1 : n; } - class OvernightIndexedCouponPricer : public FloatingRateCouponPricer { - public: - void initialize(const FloatingRateCoupon& coupon) override { - coupon_ = dynamic_cast(&coupon); - QL_ENSURE(coupon_, "wrong coupon type"); - } - - Rate averageRate(const Date& date) const { - - const Date today = Settings::instance().evaluationDate(); - - const ext::shared_ptr index = - ext::dynamic_pointer_cast(coupon_->index()); - const auto& pastFixings = IndexManager::instance().getHistory(index->name()); - - const vector& fixingDates = coupon_->fixingDates(); - const vector& valueDates = coupon_->valueDates(); - const vector& interestDates = coupon_->interestDates(); - const vector