24#ifndef quantext_equity_margin_coupon_hpp
25#define quantext_equity_margin_coupon_hpp
27#include <ql/cashflows/coupon.hpp>
28#include <ql/handle.hpp>
29#include <ql/patterns/visitor.hpp>
30#include <ql/termstructures/yieldtermstructure.hpp>
31#include <ql/time/daycounter.hpp>
32#include <ql/time/schedule.hpp>
42class EquityMarginCouponPricer;
54 const Date&
fixingEndDate = Date(),
const Date& refPeriodStart = Date(),
55 const Date& refPeriodEnd = Date(),
const Date& exCouponDate = Date(), Real
multiplier = Null<Real>(),
66 Real
amount()
const override;
68 Rate
rate()
const override;
99 QL_FAIL(
"Equity Coupons have 2 fixings, not 1.");
109 void update()
override { notifyObservers(); }
114 virtual void accept(AcyclicVisitor&)
override;
117 void setPricer(
const QuantLib::ext::shared_ptr<EquityMarginCouponPricer>&);
118 QuantLib::ext::shared_ptr<EquityMarginCouponPricer>
pricer()
const;
121 QuantLib::ext::shared_ptr<EquityMarginCouponPricer>
pricer_;
143 Visitor<EquityMarginCoupon>* v1 =
dynamic_cast<Visitor<EquityMarginCoupon>*
>(&v);
155 EquityMarginLeg(
const Schedule& schedule,
const QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>& equityCurve,
156 const QuantLib::ext::shared_ptr<FxIndex>& fxIndex =
nullptr);
159 const DayCounter& paymentDayCounter,
160 Compounding comp = Simple,
161 Frequency freq = Annual);
163 const DayCounter& paymentDayCounter,
164 Compounding comp = Simple,
165 Frequency freq = Annual);
187 operator Leg()
const;
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equityCurve_
Date fixingDate() const
This function is called for other coupon types.
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
const QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > & equityCurve() const
equity reference rate curve
std::vector< Date > fixingDates() const
return both fixing dates
void setPricer(const QuantLib::ext::shared_ptr< EquityMarginCouponPricer > &)
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex() const
fx index curve
Real dividendFactor() const
are dividends scaled (e.g. to account for tax)
bool initialPriceIsInTargetCcy_
bool initialPriceIsInTargetCcy() const
initial price is in target ccy (if applicable, i.e. if fxIndex != null, otherwise ignored)
Rate rate() const override
Real amount() const override
virtual void accept(AcyclicVisitor &) override
Date fixingEndDate() const
The date at which performance is measured.
Real fxRate() const
FX conversion rate (or 1.0 if not applicable)
Real nominal() const override
DayCounter dayCounter() const override
bool isTotalReturn() const
total return or price return?
InterestRate fixedRate() const
Real accruedAmount(const Date &) const override
QuantLib::ext::shared_ptr< EquityMarginCouponPricer > pricer_
Real marginFactor() const
Real quantity() const
Number of equity shares held.
QuantLib::ext::shared_ptr< EquityMarginCouponPricer > pricer() const
Date fixingStartDate() const
The date at which the starting equity price is fixed.
Real initialPrice() const
initial price
helper class building a sequence of equity margin coupons
EquityMarginLeg & withPaymentCalendar(const Calendar &calendar)
EquityMarginLeg & withPaymentLag(Natural paymentLag)
EquityMarginLeg & withQuantity(Real)
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equityCurve_
BusinessDayConvention paymentAdjustment_
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
EquityMarginLeg & withNotionalReset(bool)
EquityMarginLeg & withNotionals(const std::vector< Real > ¬ionals)
Calendar paymentCalendar_
EquityMarginLeg & withFixingDays(Natural)
EquityMarginLeg & withCouponRates(const std::vector< Rate > &, const DayCounter &paymentDayCounter, Compounding comp=Simple, Frequency freq=Annual)
Schedule valuationSchedule_
std::vector< InterestRate > couponRates_
EquityMarginLeg & withDividendFactor(Real)
bool initialPriceIsInTargetCcy_
EquityMarginLeg & withInitialPrice(Real)
std::vector< Real > notionals_
EquityMarginLeg & withNotional(Real notional)
EquityMarginLeg & withInitialPriceIsInTargetCcy(bool)
EquityMarginLeg & withPaymentAdjustment(BusinessDayConvention convention)
EquityMarginLeg & withTotalReturn(bool)
EquityMarginLeg & withPaymentDayCounter(const DayCounter &dayCounter)
EquityMarginLeg & withMultiplier(Real)
EquityMarginLeg & withValuationSchedule(const Schedule &valuationSchedule)
EquityMarginLeg & withInitialMarginFactor(const Real &marginFactor)
EquityMarginLeg & withCouponRates(Rate, const DayCounter &paymentDayCounter, Compounding comp=Simple, Frequency freq=Annual)
DayCounter paymentDayCounter_
equity index class for holding equity fixing histories and forwarding.