19#include <ql/pricingengines/swap/discountingswapengine.hpp>
20#include <ql/utilities/null_deleter.hpp>
29 const QuantLib::ext::shared_ptr<BRLCdi>& brlCdiIndex,
30 const Handle<YieldTermStructure>& discountingCurve,
bool telescopicValueDates)
32 telescopicValueDates_(telescopicValueDates), discountHandle_(discountingCurve) {
34 bool onIndexHasCurve = !
brlCdiIndex_->forwardingTermStructure().empty();
36 QL_REQUIRE(!(onIndexHasCurve && haveDiscountCurve),
"Have both curves nothing to solve for.");
38 if (!onIndexHasCurve) {
40 brlCdiIndex_ = QuantLib::ext::dynamic_pointer_cast<BRLCdi>(clonedIborIndex);
55 Date referenceDate = Settings::instance().evaluationDate();
56 referenceDate = calendar.adjust(referenceDate);
59 Date startDate = calendar.advance(referenceDate, 2 * Days);
60 startDate = calendar.adjust(startDate, Following);
66 swap_ = QuantLib::ext::make_shared<BRLCdiSwap>(OvernightIndexedSwap::Payer, 1.0, startDate, endDate, 0.01,
brlCdiIndex_,
73 earliestDate_ =
swap_->startDate();
74 latestDate_ =
swap_->maturityDate();
79 bool observer =
false;
80 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
88 RelativeDateRateHelper::setTermStructure(t);
92 QL_REQUIRE(termStructure_ != 0,
"BRLCdiRateHelper's term structure not set");
94 return swap_->fairRate();
98 if (Visitor<BRLCdiRateHelper>* v1 =
dynamic_cast<Visitor<BRLCdiRateHelper>*
>(&v))
101 RateHelper::accept(v);
105 const QuantLib::ext::shared_ptr<BRLCdi>& brlCdiIndex,
106 const Handle<YieldTermStructure>& discountingCurve,
107 bool telescopicValueDates)
108 : RateHelper(fixedRate), brlCdiIndex_(brlCdiIndex), telescopicValueDates_(telescopicValueDates),
109 discountHandle_(discountingCurve) {
111 bool onIndexHasCurve = !
brlCdiIndex_->forwardingTermStructure().empty();
113 QL_REQUIRE(!(onIndexHasCurve && haveDiscountCurve),
"Have both curves nothing to solve for.");
115 if (!onIndexHasCurve) {
117 brlCdiIndex_ = QuantLib::ext::dynamic_pointer_cast<BRLCdi>(clonedIborIndex);
124 swap_ = QuantLib::ext::make_shared<BRLCdiSwap>(OvernightIndexedSwap::Payer, 1.0, startDate, endDate, 0.01,
brlCdiIndex_,
131 earliestDate_ =
swap_->startDate();
132 latestDate_ =
swap_->maturityDate();
137 bool observer =
false;
138 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
146 RateHelper::setTermStructure(t);
150 QL_REQUIRE(termStructure_ != 0,
"DatedBRLCdiRateHelper's term structure not set");
152 return swap_->fairRate();
156 if (Visitor<DatedBRLCdiRateHelper>* v1 =
dynamic_cast<Visitor<DatedBRLCdiRateHelper>*
>(&v))
159 RateHelper::accept(v);
Rate helper based on standard BRL CDI swap.
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > discountRelinkableHandle_
QuantLib::Period swapTenor_
bool telescopicValueDates_
QuantLib::ext::shared_ptr< BRLCdiSwap > swap_
void accept(QuantLib::AcyclicVisitor &) override
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > termStructureHandle_
QuantLib::ext::shared_ptr< BRLCdi > brlCdiIndex_
void initializeDates() override
BRLCdiRateHelper(const QuantLib::Period &swapTenor, const QuantLib::Handle< QuantLib::Quote > &fixedRate, const QuantLib::ext::shared_ptr< BRLCdi > &brlCdiIndex, const QuantLib::Handle< QuantLib::YieldTermStructure > &discountingCurve=QuantLib::Handle< QuantLib::YieldTermStructure >(), bool telescopicValueDates=false)
QuantLib::Real impliedQuote() const override
void setTermStructure(QuantLib::YieldTermStructure *) override
QuantLib::Handle< QuantLib::YieldTermStructure > discountHandle_
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > discountRelinkableHandle_
bool telescopicValueDates_
QuantLib::ext::shared_ptr< BRLCdiSwap > swap_
void accept(QuantLib::AcyclicVisitor &) override
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > termStructureHandle_
QuantLib::ext::shared_ptr< BRLCdi > brlCdiIndex_
DatedBRLCdiRateHelper(const QuantLib::Date &startDate, const QuantLib::Date &endDate, const QuantLib::Handle< QuantLib::Quote > &fixedRate, const QuantLib::ext::shared_ptr< BRLCdi > &brlCdiIndex, const QuantLib::Handle< QuantLib::YieldTermStructure > &discountingCurve=QuantLib::Handle< QuantLib::YieldTermStructure >(), bool telescopicValueDates=false)
QuantLib::Real impliedQuote() const override
void setTermStructure(QuantLib::YieldTermStructure *) override
QuantLib::Handle< QuantLib::YieldTermStructure > discountHandle_
RelativeDateBootstrapHelper< YieldTermStructure > RelativeDateRateHelper