20#include <ql/cashflows/equitycashflow.hpp>
21#include <ql/cashflows/indexedcashflow.hpp>
22#include <ql/indexes/equityindex.hpp>
23#include <ql/termstructures/yield/quantotermstructure.hpp>
24#include <ql/termstructures/yield/flatforward.hpp>
25#include <ql/time/calendars/nullcalendar.hpp>
26#include <ql/quotes/simplequote.hpp>
27#include <ql/time/daycounters/actual365fixed.hpp>
32 Handle<YieldTermStructure>
33 configureDividendHandle(
const Handle<YieldTermStructure>& dividendHandle) {
34 if (dividendHandle.empty()) {
35 ext::shared_ptr<YieldTermStructure> flatTs(ext::make_shared<FlatForward>(
36 0, NullCalendar(), Handle<Quote>(ext::make_shared<SimpleQuote>(0.0)),
38 return Handle<YieldTermStructure>(flatTs);
40 return dividendHandle;
45 for (
const auto& i : leg) {
46 ext::shared_ptr<EquityCashFlow> c =
47 ext::dynamic_pointer_cast<EquityCashFlow>(i);
54 ext::shared_ptr<EquityIndex> index,
56 const Date& fixingDate,
57 const Date& paymentDate,
59 :
IndexedCashFlow(notional,
std::move(index), baseDate, fixingDate, paymentDate, growthOnly) {}
82 : quantoCurrencyTermStructure_(
std::move(quantoCurrencyTermStructure)),
83 equityVolatility_(
std::move(equityVolatility)), fxVolatility_(
std::move(fxVolatility)),
84 correlation_(
std::move(correlation)){
92 index_ = ext::dynamic_pointer_cast<EquityIndex>(cashFlow.
index());
94 QL_FAIL(
"Equity index required.");
102 "Quanto currency term structure handle cannot be empty.");
104 "Equity volatility term structure handle cannot be empty.");
106 "FX volatility term structure handle cannot be empty.");
107 QL_REQUIRE(!
correlation_.empty(),
"Correlation handle cannot be empty.");
112 "Quanto currency term structure, equity and FX volatility need to have the same "
119 configureDividendHandle(
index_->equityDividendCurve());
125 ext::shared_ptr<EquityIndex> quantoIndex =
132 return I1 / I0 - 1.0;
ext::shared_ptr< EquityCashFlowPricer > pricer_
const ext::shared_ptr< EquityCashFlowPricer > & pricer() const
Real amount() const override
returns the amount of the cash flow
void setPricer(const ext::shared_ptr< EquityCashFlowPricer > &)
EquityCashFlow(Real notional, ext::shared_ptr< EquityIndex > index, const Date &baseDate, const Date &fixingDate, const Date &paymentDate, bool growthOnly=true)
ext::shared_ptr< EquityIndex > index_
Handle< Quote > correlation_
EquityQuantoCashFlowPricer(Handle< YieldTermStructure > quantoCurrencyTermStructure, Handle< BlackVolTermStructure > equityVolatility, Handle< BlackVolTermStructure > fxVolatility, Handle< Quote > correlation)
void initialize(const EquityCashFlow &) override
Real price() const override
Handle< YieldTermStructure > quantoTermStructure
Handle< BlackVolTermStructure > fxVolatility_
Handle< YieldTermStructure > quantoCurrencyTermStructure_
Handle< BlackVolTermStructure > equityVolatility_
Shared handle to an observable.
Cash flow dependent on an index ratio.
virtual Date fixingDate() const
virtual Real notional() const
Real amount() const override
returns the amount of the cash flow
virtual Date baseDate() const
virtual bool growthOnly() const
virtual ext::shared_ptr< Index > index() const
Size unregisterWith(const ext::shared_ptr< Observable > &)
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
void setCouponPricer(const Leg &leg, const ext::shared_ptr< FloatingRateCouponPricer > &pricer)
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.