Skip to content

Commit

Permalink
Remove redundant index from signature
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Nov 17, 2021
1 parent e64e9ca commit 7086e1d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
20 changes: 9 additions & 11 deletions ql/termstructures/yield/overnightindexfutureratehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
*/

#include <ql/termstructures/yield/overnightindexfutureratehelper.hpp>
#include <ql/indexes/ibor/sofr.hpp>
#include <ql/utilities/null_deleter.hpp>

namespace QuantLib {

namespace {

Date getValidSofrStart(Month month, Year year, Frequency freq) {
return freq == Monthly ?
return freq == Monthly ?
UnitedStates(UnitedStates::GovernmentBond).adjust(Date(1, month, year)) :
Date::nthWeekday(3, Wednesday, month, year);
}
Expand Down Expand Up @@ -91,8 +92,8 @@ namespace QuantLib {
Real OvernightIndexFutureRateHelper::convexityAdjustment() const {
return future_->convexityAdjustment();
}
QL_DEPRECATED


SofrFutureRateHelper::SofrFutureRateHelper(
const Handle<Quote>& price,
Month referenceMonth,
Expand All @@ -115,8 +116,7 @@ namespace QuantLib {
"quarterly SOFR futures can only start in Mar,Jun,Sep,Dec");
}
}

QL_DEPRECATED

SofrFutureRateHelper::SofrFutureRateHelper(
Real price,
Month referenceMonth,
Expand Down Expand Up @@ -146,12 +146,11 @@ namespace QuantLib {
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
const ext::shared_ptr<OvernightIndex>& overnightIndex,
const Handle<Quote>& convexityAdjustment)
: OvernightIndexFutureRateHelper(price,
: OvernightIndexFutureRateHelper(price,
getValidSofrStart(referenceMonth, referenceYear, referenceFreq),
getValidSofrEnd(referenceMonth, referenceYear, referenceFreq),
overnightIndex,
ext::make_shared<Sofr>(),
convexityAdjustment,
referenceFreq == Quarterly ? RateAveraging::Compound : RateAveraging::Simple) {
QL_REQUIRE(referenceFreq == Quarterly || referenceFreq == Monthly,
Expand All @@ -168,13 +167,12 @@ namespace QuantLib {
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
const ext::shared_ptr<OvernightIndex>& overnightIndex,
Real convexityAdjustment)
: OvernightIndexFutureRateHelper(
: OvernightIndexFutureRateHelper(
Handle<Quote>(ext::make_shared<SimpleQuote>(price)),
getValidSofrStart(referenceMonth, referenceYear, referenceFreq),
getValidSofrEnd(referenceMonth, referenceYear, referenceFreq),
overnightIndex,
ext::make_shared<Sofr>(),
Handle<Quote>(ext::make_shared<SimpleQuote>(convexityAdjustment)),
referenceFreq == Quarterly ? RateAveraging::Compound : RateAveraging::Simple) {
QL_REQUIRE(referenceFreq == Quarterly || referenceFreq == Monthly,
Expand Down
26 changes: 16 additions & 10 deletions ql/termstructures/yield/overnightindexfutureratehelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ namespace QuantLib {
*/
class SofrFutureRateHelper : public OvernightIndexFutureRateHelper {
public:
/*! \deprecated Use the constructor without index and averaging method.
Deprecated in version 1.25.
*/
QL_DEPRECATED
SofrFutureRateHelper(const Handle<Quote>& price,
Month referenceMonth,
Expand All @@ -75,6 +78,10 @@ namespace QuantLib {
const ext::shared_ptr<OvernightIndex>& overnightIndex,
const Handle<Quote>& convexityAdjustment,
RateAveraging::Type averagingMethod);

/*! \deprecated Use the constructor without index and averaging method.
Deprecated in version 1.25.
*/
QL_DEPRECATED
SofrFutureRateHelper(Real price,
Month referenceMonth,
Expand All @@ -85,17 +92,16 @@ namespace QuantLib {
RateAveraging::Type averagingMethod);

SofrFutureRateHelper(const Handle<Quote>& price,
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
const ext::shared_ptr<OvernightIndex>& overnightIndex,
const Handle<Quote>& convexityAdjustment = Handle<Quote>());
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
const Handle<Quote>& convexityAdjustment = Handle<Quote>());

SofrFutureRateHelper(Real price,
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
const ext::shared_ptr<OvernightIndex>& overnightIndex,
Real convexityAdjustment = 0);
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
Real convexityAdjustment = 0);
};

}
Expand Down
3 changes: 1 addition & 2 deletions test-suite/sofrfutures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ void SofrFuturesTest::testBootstrap() {
std::vector<ext::shared_ptr<RateHelper> > helpers;
for (const auto& sofrQuote : sofrQuotes) {
helpers.push_back(ext::make_shared<SofrFutureRateHelper>(
sofrQuote.price, sofrQuote.month, sofrQuote.year, sofrQuote.freq,
index, 0.0));
sofrQuote.price, sofrQuote.month, sofrQuote.year, sofrQuote.freq));
}

ext::shared_ptr<PiecewiseYieldCurve<Discount, Linear> > curve =
Expand Down

0 comments on commit 7086e1d

Please sign in to comment.