19#include <ql/utilities/null_deleter.hpp>
26 const Period& swapTenor,
28 const Period& fixedTenor,
const DayCounter& fixedDayCounter,
29 const Calendar& fixedCalendar, BusinessDayConvention fixedConvention,
30 BusinessDayConvention fixedPaymentAdjustment,
32 const QuantLib::ext::shared_ptr<OvernightIndex>& overnightIndex,
33 const Period& onTenor,
const Handle<Quote>& onSpread, Natural rateCutoff,
35 const Handle<YieldTermStructure>& discountCurve,
36 const bool telescopicValueDates)
37 :
RelativeDateRateHelper(fixedRate), spotLagTenor_(spotLagTenor), swapTenor_(swapTenor), fixedTenor_(fixedTenor),
38 fixedDayCounter_(fixedDayCounter), fixedCalendar_(fixedCalendar), fixedConvention_(fixedConvention),
39 fixedPaymentAdjustment_(fixedPaymentAdjustment), overnightIndex_(overnightIndex), onTenor_(onTenor),
40 onSpread_(onSpread), rateCutoff_(rateCutoff), discountHandle_(discountCurve),
41 telescopicValueDates_(telescopicValueDates) {
43 bool onIndexHasCurve = !
overnightIndex_->forwardingTermStructure().empty();
45 QL_REQUIRE(!(onIndexHasCurve && haveDiscountCurve),
"Have both curves nothing to solve for.");
47 if (!onIndexHasCurve) {
49 overnightIndex_ = QuantLib::ext::dynamic_pointer_cast<OvernightIndex>(clonedIborIndex);
77 QL_REQUIRE(termStructure_ != 0,
"term structure not set");
83 static const Spread basisPoint = 1.0e-4;
87 Real onLegNPVwithSpread = onLegNPV + spreadNPV;
88 Real result = -onLegNPVwithSpread / (
averageOIS_->fixedLegBPS() / basisPoint);
94 bool observer =
false;
95 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
103 RelativeDateRateHelper::setTermStructure(t);
112 Visitor<AverageOISRateHelper>* v1 =
dynamic_cast<Visitor<AverageOISRateHelper>*
>(&v);
116 RateHelper::accept(v);
Rate helpers to facilitate usage of AverageOIS in bootstrapping.
RelinkableHandle< YieldTermStructure > discountRelinkableHandle_
void setTermStructure(YieldTermStructure *) override
BusinessDayConvention fixedConvention_
QuantLib::ext::shared_ptr< OvernightIndex > overnightIndex_
bool telescopicValueDates_
DayCounter fixedDayCounter_
RelinkableHandle< YieldTermStructure > termStructureHandle_
BusinessDayConvention fixedPaymentAdjustment_
QuantLib::ext::shared_ptr< AverageOIS > averageOIS_
Handle< YieldTermStructure > discountHandle_
void accept(AcyclicVisitor &) override
QuantLib::ext::shared_ptr< AverageOIS > averageOIS() const
AverageOISRateHelper(const Handle< Quote > &fixedRate, const Period &spotLagTenor, const Period &swapTenor, const Period &fixedTenor, const DayCounter &fixedDayCounter, const Calendar &fixedCalendar, BusinessDayConvention fixedConvention, BusinessDayConvention fixedPaymentAdjustment, const QuantLib::ext::shared_ptr< OvernightIndex > &overnightIndex, const Period &onTenor, const Handle< Quote > &onSpread, Natural rateCutoff, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const bool telescopicValueDates=false)
void initializeDates() override
Real impliedQuote() const override
Handle< Quote > onSpread_
MakeAverageOIS & withFixedConvention(BusinessDayConvention fixedConvention)
MakeAverageOIS & withTelescopicValueDates(bool telescopicValueDates)
MakeAverageOIS & withRateCutoff(Natural rateCutoff)
MakeAverageOIS & withFixedPaymentAdjustment(BusinessDayConvention fixedPaymentAdjustment)
MakeAverageOIS & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountCurve)
MakeAverageOIS & withFixedTerminationDateConvention(BusinessDayConvention fixedTerminationDateConvention)
MakeAverageOIS & withFixedCalendar(const Calendar &fixedCalendar)
Helper class to instantiate standard average ON indexed swaps.