34 const ext::shared_ptr<OvernightIndex>& overnightIndex,
36 bool telescopicValueDates,
41 const Period& forwardStart,
44 Date customPillarDate,
46 ext::optional<bool> endOfMonth,
47 ext::optional<Frequency> fixedPaymentFrequency,
51 bool applyObservationShift,
52 ext::shared_ptr<FloatingRateCouponPricer> pricer,
56 discountHandle_(
std::move(discount)), telescopicValueDates_(telescopicValueDates),
57 paymentLag_(paymentLag), paymentConvention_(paymentConvention),
59 forwardStart_(forwardStart), overnightSpread_(
handleFromVariant(overnightSpread)), pillarChoice_(pillar),
60 averagingMethod_(averagingMethod), endOfMonth_(endOfMonth),
61 fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(
std::move(fixedCalendar)),
62 overnightCalendar_(
std::move(overnightCalendar)), lookbackDays_(lookbackDays), lockoutDays_(lockoutDays),
63 applyObservationShift_(applyObservationShift),
pricer_(
std::move(pricer)), rule_(rule) {
70 const ext::shared_ptr<OvernightIndex>& overnightIndex,
72 bool telescopicValueDates,
79 Date customPillarDate,
81 ext::optional<bool> endOfMonth,
82 ext::optional<Frequency> fixedPaymentFrequency,
86 bool applyObservationShift,
87 ext::shared_ptr<FloatingRateCouponPricer> pricer,
91 discountHandle_(
std::move(discount)), telescopicValueDates_(telescopicValueDates),
92 paymentLag_(paymentLag), paymentConvention_(paymentConvention),
95 averagingMethod_(averagingMethod), endOfMonth_(endOfMonth),
96 fixedPaymentFrequency_(fixedPaymentFrequency), fixedCalendar_(
std::move(fixedCalendar)),
97 overnightCalendar_(
std::move(overnightCalendar)), lookbackDays_(lookbackDays), lockoutDays_(lockoutDays),
98 applyObservationShift_(applyObservationShift),
pricer_(
std::move(pricer)), rule_(rule) {
103 Date customPillarDate) {
162 Date lastPaymentDate = std::max(
swap_->overnightLeg().back()->date(),
163 swap_->fixedLeg().back()->date());
176 "pillar date (" <<
pillarDate_ <<
") must be later "
177 "than or equal to the instrument's earliest date (" <<
180 "pillar date (" <<
pillarDate_ <<
") must be before "
181 "or equal to the instrument's latest relevant date (" <<
192 bool observer =
false;
210 static const Spread basisPoint = 1.0e-4;
211 Real floatingLegNPV =
swap_->overnightLegNPV();
213 Real spreadNPV =
swap_->overnightLegBPS()/basisPoint*spread;
214 Real totNPV = - (floatingLegNPV+spreadNPV);
215 Real result = totNPV/(
swap_->fixedLegBPS()/basisPoint);
230 const ext::shared_ptr<OvernightIndex>& overnightIndex,
232 bool telescopicValueDates,
239 ext::optional<bool> endOfMonth,
240 ext::optional<Frequency> fixedPaymentFrequency,
244 bool applyObservationShift,
245 const ext::shared_ptr<FloatingRateCouponPricer>& pricer)
246 :
OISRateHelper(startDate, endDate, fixedRate, overnightIndex,
std::move(discount), telescopicValueDates,
247 paymentLag, paymentConvention, paymentFrequency, paymentCalendar,
249 Pillar::LastRelevantDate,
Date(), averagingMethod, endOfMonth, fixedPaymentFrequency,
250 fixedCalendar, lookbackDays, lockoutDays, applyObservationShift, pricer) {}
255 const ext::shared_ptr<OvernightIndex>& overnightIndex,
257 bool telescopicValueDates,
265 ext::optional<bool> endOfMonth,
266 ext::optional<Frequency> fixedPaymentFrequency,
268 :
DatedOISRateHelper(startDate, endDate, fixedRate, overnightIndex,
std::move(discount), telescopicValueDates,
269 averagingMethod, paymentLag, paymentConvention, paymentFrequency, paymentCalendar,
270 overnightSpread, endOfMonth, fixedPaymentFrequency, fixedCalendar) {}
degenerate base class for the Acyclic Visitor pattern
virtual void accept(AcyclicVisitor &)
virtual void setTermStructure(TS *)
sets the term structure to be used for pricing
bool empty() const
Returns whether or not the calendar is initialized.
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, Integer paymentLag=0, BusinessDayConvention paymentConvention=Following, Frequency paymentFrequency=Annual, const Calendar &paymentCalendar=Calendar(), Spread overnightSpread={}, ext::optional< bool > endOfMonth=ext::nullopt, ext::optional< Frequency > fixedPaymentFrequency=ext::nullopt, const Calendar &fixedCalendar=Calendar(), Natural lookbackDays=Null< Natural >(), Natural lockoutDays=0, bool applyObservationShift=false, const ext::shared_ptr< FloatingRateCouponPricer > &pricer={})
Shared handle to an observable.
MakeOIS & withPaymentAdjustment(BusinessDayConvention convention)
MakeOIS & withPaymentLag(Integer lag)
MakeOIS & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountingTermStructure)
MakeOIS & withLockoutDays(Natural lockoutDays)
MakeOIS & withSettlementDays(Natural settlementDays)
MakeOIS & withPaymentFrequency(Frequency f)
MakeOIS & withRule(DateGeneration::Rule r)
MakeOIS & withLookbackDays(Natural lookbackDays)
MakeOIS & withFixedLegCalendar(const Calendar &cal)
MakeOIS & withPaymentCalendar(const Calendar &cal)
MakeOIS & withTerminationDate(const Date &)
MakeOIS & withEffectiveDate(const Date &)
MakeOIS & withEndOfMonth(bool flag=true)
MakeOIS & withFixedLegPaymentFrequency(Frequency f)
MakeOIS & withAveragingMethod(RateAveraging::Type averagingMethod)
MakeOIS & withTelescopicValueDates(bool telescopicValueDates)
MakeOIS & withObservationShift(bool applyObservationShift=true)
MakeOIS & withOvernightLegCalendar(const Calendar &cal)
Rate helper for bootstrapping over Overnight Indexed Swap rates.
ext::shared_ptr< OvernightIndex > overnightIndex_
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
void setTermStructure(YieldTermStructure *) override
bool telescopicValueDates_
void initialize(const ext::shared_ptr< OvernightIndex > &overnightIndex, Date customPillarDate)
RelinkableHandle< YieldTermStructure > termStructureHandle_
Calendar paymentCalendar_
Pillar::Choice pillarChoice_
Handle< YieldTermStructure > discountHandle_
OISRateHelper(Natural settlementDays, const Period &tenor, const Handle< Quote > &fixedRate, const ext::shared_ptr< OvernightIndex > &overnightIndex, Handle< YieldTermStructure > discountingCurve={}, bool telescopicValueDates=false, Integer paymentLag=0, BusinessDayConvention paymentConvention=Following, Frequency paymentFrequency=Annual, Calendar paymentCalendar=Calendar(), const Period &forwardStart=0 *Days, const std::variant< Spread, Handle< Quote > > &overnightSpread=Spread(0.0), Pillar::Choice pillar=Pillar::LastRelevantDate, Date customPillarDate=Date(), RateAveraging::Type averagingMethod=RateAveraging::Compound, ext::optional< bool > endOfMonth=ext::nullopt, ext::optional< Frequency > fixedPaymentFrequency=ext::nullopt, Calendar fixedCalendar=Calendar(), Natural lookbackDays=Null< Natural >(), Natural lockoutDays=0, bool applyObservationShift=false, ext::shared_ptr< FloatingRateCouponPricer > pricer={}, DateGeneration::Rule rule=DateGeneration::Backward, Calendar overnightCalendar=Calendar())
ext::shared_ptr< FloatingRateCouponPricer > pricer_
void accept(AcyclicVisitor &) override
bool applyObservationShift_
ext::optional< bool > endOfMonth_
DateGeneration::Rule rule_
RateAveraging::Type averagingMethod_
void initializeDates() override
ext::shared_ptr< OvernightIndexedSwap > swap_
Calendar overnightCalendar_
BusinessDayConvention paymentConvention_
Real impliedQuote() const override
Frequency paymentFrequency_
Handle< Quote > overnightSpread_
ext::optional< Frequency > fixedPaymentFrequency_
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
purely virtual base class for market observables
Bootstrap helper with date schedule relative to global evaluation date.
Visitor for a specific class
virtual void visit(T &)=0
Interest-rate term structure.
ext::shared_ptr< FloatingRateCouponPricer > pricer_
Calendar paymentCalendar_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
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
Helper class to instantiate overnight indexed swaps.
Handle< Quote > handleFromVariant(const std::variant< Real, Handle< Quote > > &value)
void setCouponPricer(const Leg &leg, const ext::shared_ptr< FloatingRateCouponPricer > &pricer)
void simplifyNotificationGraph(Instrument &instrument, const Leg &leg, bool unregisterCoupons)
Utility function to optimize the observability graph of an instrument.
empty deleter for shared_ptr
Overnight Indexed Swap (aka OIS) rate helpers.
ext::shared_ptr< BlackVolTermStructure > v
utility functions to reduce number of notifications sent by observables
Choice
Alternatives ways of determining the pillar date.
@ CustomDate
last date relevant for instrument pricing
@ LastRelevantDate
instruments maturity date