22#include <ql/quotes/compositequote.hpp>
23#include <ql/time/calendars/jointcalendar.hpp>
28 const QuantLib::ext::shared_ptr<FxIndex>& fxIndex,
const Date& dividendCutoffDate)
30 JointCalendar(source->fixingCalendar(), fxIndex->fixingCalendar()), fxIndex->targetCurrency(),
31 Handle<Quote>(
QuantLib::ext::make_shared<CompositeQuote<std::function<Real(Real, Real)>>>(
32 source->equitySpot(), fxIndex->fxQuote(),
33 std::function<Real(Real, Real)>([](Real x, Real y) {
return x * y; }))),
34 Handle<YieldTermStructure>(QuantLib::ext::make_shared<DiscountRatioModifiedCurve>(
35 source->equityForecastCurve(), fxIndex->targetCurve(), fxIndex->sourceCurve())),
36 source->equityDividendCurve()),
37 source_(source), fxIndex_(fxIndex), dividendCutoffDate_(dividendCutoffDate) {
38 LazyObject::registerWith(source_);
39 LazyObject::registerWith(fxIndex_);
48 source_->addDividend(newDiv, forceOverwrite);
55 auto const& ts =
source_->dividendFixings();
56 for (
auto const& d : ts) {
58 Dividend div(d.exDate, d.name, d.rate *
fxIndex_->fixing(
fxIndex_->fixingCalendar().adjust(d.exDate, Preceding)), d.payDate);
74 const Handle<YieldTermStructure>& rate,
75 const Handle<YieldTermStructure>& dividend)
const {
76 return QuantLib::ext::make_shared<CompoEquityIndex>(
source_->clone(spotQuote, rate, dividend),
fxIndex_);
void performCalculations() const override
const std::set< Dividend > & dividendFixings() const override
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > clone(const Handle< Quote > spotQuote, const Handle< YieldTermStructure > &rate, const Handle< YieldTermStructure > ÷nd) const override
std::set< Dividend > dividendFixings_
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > source() const
void addDividend(const Dividend ÷nd, bool forceOverwrite=false) override
stores the historical dividend at the given date
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > source_
Real pastFixing(const Date &fixingDate) const override
returns a past fixing at the given date
CompoEquityIndex(const QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > &source, const QuantLib::ext::shared_ptr< FxIndex > &fxIndex, const Date ÷ndCutoffDate=Date())
equity index converting the original equity currency to another currency
discount curve modified by the ratio of two other discount curves
QuantLib::Real rate
Dividend rate.
std::string name
Index name.
QuantLib::Date payDate
Dividend Payment date.
QuantLib::Date exDate
Ex dividend date.