Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions ql/termstructures/yield/overnightindexfutureratehelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ namespace QuantLib {
const Date& maturityDate,
const ext::shared_ptr<OvernightIndex>& overnightIndex,
const Handle<Quote>& convexityAdjustment,
RateAveraging::Type averagingMethod)
RateAveraging::Type averagingMethod,
const Date& customPillarDate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ideally this should use the Pillar::Choice enum like the other rate helpers that support custom pillars.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True

: RateHelper(price) {
ext::shared_ptr<OvernightIndex> index =
ext::dynamic_pointer_cast<OvernightIndex>(overnightIndex->clone(termStructureHandle_));
Expand All @@ -60,6 +61,13 @@ namespace QuantLib {
registerWithObservables(future_);
earliestDate_ = valueDate;
latestDate_ = maturityDate;
if (customPillarDate != Date()) {
QL_REQUIRE(customPillarDate >= valueDate,
"custom pillar date before start of reference period");
QL_REQUIRE(customPillarDate <= maturityDate,
"custom pillar date after end of reference period");
pillarDate_ = customPillarDate;
}
}

Real OvernightIndexFutureRateHelper::impliedQuote() const {
Expand Down Expand Up @@ -90,19 +98,20 @@ namespace QuantLib {
return future_->convexityAdjustment();
}


SofrFutureRateHelper::SofrFutureRateHelper(
const Handle<Quote>& price,
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
const Handle<Quote>& convexityAdjustment)
const Handle<Quote>& convexityAdjustment,
const Date& customPillarDate)
: OvernightIndexFutureRateHelper(price,
getSofrStart(referenceMonth, referenceYear, referenceFreq),
getSofrEnd(referenceMonth, referenceYear, referenceFreq),
ext::make_shared<Sofr>(),
convexityAdjustment,
referenceFreq == Quarterly ? RateAveraging::Compound : RateAveraging::Simple) {
referenceFreq == Quarterly ? RateAveraging::Compound : RateAveraging::Simple, customPillarDate) {
QL_REQUIRE(referenceFreq == Quarterly || referenceFreq == Monthly,
"only monthly and quarterly SOFR futures accepted");
}
Expand All @@ -112,14 +121,15 @@ namespace QuantLib {
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
Real convexityAdjustment)
Real convexityAdjustment,
const Date& customPillarDate)
: OvernightIndexFutureRateHelper(
Handle<Quote>(ext::make_shared<SimpleQuote>(price)),
getSofrStart(referenceMonth, referenceYear, referenceFreq),
getSofrEnd(referenceMonth, referenceYear, referenceFreq),
ext::make_shared<Sofr>(),
Handle<Quote>(ext::make_shared<SimpleQuote>(convexityAdjustment)),
referenceFreq == Quarterly ? RateAveraging::Compound : RateAveraging::Simple) {
referenceFreq == Quarterly ? RateAveraging::Compound : RateAveraging::Simple, customPillarDate) {
QL_REQUIRE(referenceFreq == Quarterly || referenceFreq == Monthly,
"only monthly and quarterly SOFR futures accepted");
}
Expand Down
9 changes: 6 additions & 3 deletions ql/termstructures/yield/overnightindexfutureratehelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ namespace QuantLib {
const Date& maturityDate,
const ext::shared_ptr<OvernightIndex>& overnightIndex,
const Handle<Quote>& convexityAdjustment = {},
RateAveraging::Type averagingMethod = RateAveraging::Compound);
RateAveraging::Type averagingMethod = RateAveraging::Compound,
const Date& customPillarDate = Date());

//! \name RateHelper interface
//@{
Expand Down Expand Up @@ -71,13 +72,15 @@ namespace QuantLib {
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
const Handle<Quote>& convexityAdjustment = {});
const Handle<Quote>& convexityAdjustment = {},
const Date& customPillarDate = Date());

SofrFutureRateHelper(Real price,
Month referenceMonth,
Year referenceYear,
Frequency referenceFreq,
Real convexityAdjustment = 0.0);
Real convexityAdjustment = 0.0,
const Date& customPillarDate = Date());
};

}
Expand Down
Loading