21#include <ql/instruments/makeois.hpp>
22#include <ql/instruments/simplifynotificationgraph.hpp>
23#include <ql/pricingengines/swap/discountingswapengine.hpp>
24#include <ql/termstructures/yield/oisratehelper.hpp>
25#include <ql/utilities/null_deleter.hpp>
33 const ext::shared_ptr<OvernightIndex>& overnightIndex,
35 bool telescopicValueDates,
40 const Period& forwardStart,
41 const Spread overnightSpread,
43 Date customPillarDate,
45 ext::optional<bool> endOfMonth)
46 :
RelativeDateRateHelper(fixedRate), pillarChoice_(pillar), settlementDays_(settlementDays), tenor_(tenor),
47 discountHandle_(
std::move(discount)), telescopicValueDates_(telescopicValueDates),
48 paymentLag_(paymentLag), paymentConvention_(paymentConvention),
49 paymentFrequency_(paymentFrequency), paymentCalendar_(
std::move(paymentCalendar)),
50 forwardStart_(forwardStart), overnightSpread_(overnightSpread),
51 averagingMethod_(averagingMethod), endOfMonth_(endOfMonth) {
92 Date lastPaymentDate = std::max(
swap_->overnightLeg().back()->date(),
93 swap_->fixedLeg().back()->date());
106 "pillar date (" <<
pillarDate_ <<
") must be later "
107 "than or equal to the instrument's earliest date (" <<
110 "pillar date (" <<
pillarDate_ <<
") must be before "
111 "or equal to the instrument's latest relevant date (" <<
124 bool observer =
false;
126 ext::shared_ptr<YieldTermStructure> temp(t,
null_deleter());
141 return swap_->fairRate();
155 const ext::shared_ptr<OvernightIndex>& overnightIndex,
157 bool telescopicValueDates,
163 const Period& forwardStart,
165 ext::optional<bool> endOfMonth)
166 :
RateHelper(fixedRate), discountHandle_(
std::move(discount)),
167 telescopicValueDates_(telescopicValueDates), averagingMethod_(averagingMethod) {
169 auto clonedOvernightIndex =
181 auto tmp =
MakeOIS(
Period(), clonedOvernightIndex, 0.0, forwardStart)
193 swap_ = tmp.withEndOfMonth(*endOfMonth);
199 Date lastPaymentDate = std::max(
swap_->overnightLeg().back()->date(),
200 swap_->fixedLeg().back()->date());
207 bool observer =
false;
209 ext::shared_ptr<YieldTermStructure> temp(t,
null_deleter());
224 return swap_->fairRate();
degenerate base class for the Acyclic Visitor pattern
Base helper class for bootstrapping.
virtual void accept(AcyclicVisitor &)
virtual void setTermStructure(TS *)
sets the term structure to be used for pricing
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
void setTermStructure(YieldTermStructure *) override
bool telescopicValueDates_
RelinkableHandle< YieldTermStructure > termStructureHandle_
Handle< YieldTermStructure > discountHandle_
void accept(AcyclicVisitor &) override
RateAveraging::Type averagingMethod_
DatedOISRateHelper(const Date &startDate, const Date &endDate, const Handle< Quote > &fixedRate, const ext::shared_ptr< OvernightIndex > &overnightIndex, Handle< YieldTermStructure > discountingCurve={}, bool telescopicValueDates=false, RateAveraging::Type averagingMethod=RateAveraging::Compound, Natural paymentLag=0, BusinessDayConvention paymentConvention=Following, Frequency paymentFrequency=Annual, const Calendar &paymentCalendar=Calendar(), const Period &forwardStart=0 *Days, Spread overnightSpread=0.0, ext::optional< bool > endOfMonth=ext::nullopt)
ext::shared_ptr< OvernightIndexedSwap > swap_
Real impliedQuote() const override
Shared handle to an observable.
MakeOIS & withPaymentAdjustment(BusinessDayConvention convention)
MakeOIS & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountingTermStructure)
MakeOIS & withSettlementDays(Natural settlementDays)
MakeOIS & withPaymentFrequency(Frequency f)
MakeOIS & withPaymentLag(Natural lag)
MakeOIS & withPaymentCalendar(const Calendar &cal)
MakeOIS & withTerminationDate(const Date &)
MakeOIS & withEffectiveDate(const Date &)
MakeOIS & withOvernightLegSpread(Spread sp)
MakeOIS & withEndOfMonth(bool flag=true)
MakeOIS & withAveragingMethod(RateAveraging::Type averagingMethod)
MakeOIS & withTelescopicValueDates(bool telescopicValueDates)
ext::shared_ptr< OvernightIndex > overnightIndex_
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
void setTermStructure(YieldTermStructure *) override
bool telescopicValueDates_
RelinkableHandle< YieldTermStructure > termStructureHandle_
Calendar paymentCalendar_
Pillar::Choice pillarChoice_
Handle< YieldTermStructure > discountHandle_
void accept(AcyclicVisitor &) override
ext::optional< bool > endOfMonth_
RateAveraging::Type averagingMethod_
void initializeDates() override
ext::shared_ptr< OvernightIndexedSwap > swap_
BusinessDayConvention paymentConvention_
Real impliedQuote() const override
Frequency paymentFrequency_
OISRateHelper(Natural settlementDays, const Period &tenor, const Handle< Quote > &fixedRate, const ext::shared_ptr< OvernightIndex > &overnightIndex, Handle< YieldTermStructure > discountingCurve={}, bool telescopicValueDates=false, Natural paymentLag=0, BusinessDayConvention paymentConvention=Following, Frequency paymentFrequency=Annual, Calendar paymentCalendar=Calendar(), const Period &forwardStart=0 *Days, Spread overnightSpread=0.0, Pillar::Choice pillar=Pillar::LastRelevantDate, Date customPillarDate=Date(), RateAveraging::Type averagingMethod=RateAveraging::Compound, ext::optional< bool > endOfMonth=ext::nullopt)
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Bootstrap helper with date schedule relative to global evaluation date.
Visitor for a specific class
virtual void visit(T &)=0
Interest-rate term structure.
Frequency
Frequency of events.
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
QL_INTEGER Integer
integer number
Real Spread
spreads on interest rates
void simplifyNotificationGraph(Instrument &instrument, const Leg &leg, bool unregisterCoupons)
Utility function to optimize the observability graph of an instrument.
Choice
Enumeration for pillar determination alternatives.
@ CustomDate
last date relevant for instrument pricing
@ LastRelevantDate
instruments maturity date