24#ifndef quantext_equity_coupon_hpp
25#define quantext_equity_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 EquityCouponPricer;
55 EquityCoupon(
const Date& paymentDate, Real
nominal,
const Date& startDate,
const Date& endDate, Natural fixingDays,
59 const Date&
fixingEndDate = Date(),
const Date& refPeriodStart = Date(),
60 const Date& refPeriodEnd = Date(),
const Date& exCouponDate = Date(),
75 Rate
rate()
const override;
106 QL_FAIL(
"Equity Coupons have 2 fixings, not 1.");
117 void update()
override { notifyObservers(); }
122 virtual void accept(AcyclicVisitor&)
override;
124 void setPricer(
const QuantLib::ext::shared_ptr<EquityCouponPricer>&);
125 QuantLib::ext::shared_ptr<EquityCouponPricer>
pricer()
const;
128 QuantLib::ext::shared_ptr<EquityCouponPricer>
pricer_;
149 Visitor<EquityCoupon>* v1 =
dynamic_cast<Visitor<EquityCoupon>*
>(&v);
163 EquityLeg(
const Schedule& schedule,
const QuantLib::ext::shared_ptr<QuantExt::EquityIndex2>& equityCurve,
164 const QuantLib::ext::shared_ptr<FxIndex>& fxIndex =
nullptr);
179 operator Leg()
const;
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equityCurve_
Date fixingDate() const
This function is called for other coupon types.
void setPricer(const QuantLib::ext::shared_ptr< EquityCouponPricer > &)
EquityReturnType returnType() const
the return type of the coupon
QuantLib::ext::shared_ptr< EquityCouponPricer > pricer() const
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
Date legFixingDate() const
Fixing date of the first equity coupon, to compute quantity if not provided in the resetting case.
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
EquityReturnType returnType_
Real legInitialNotional() const
Initial notional of the equity leg, to compute quantity if not provided in the resetting case.
DayCounter dayCounter() const override
Real accruedAmount(const Date &) const override
QuantLib::ext::shared_ptr< EquityCouponPricer > pricer_
Real quantity() const
Number of equity shares held.
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 coupons
EquityLeg & withInitialPriceIsInTargetCcy(bool)
QuantLib::ext::shared_ptr< QuantExt::EquityIndex2 > equityCurve_
BusinessDayConvention paymentAdjustment_
EquityLeg & withDividendFactor(Real)
EquityLeg & withPaymentCalendar(const Calendar &calendar)
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
EquityLeg & withNotional(Real notional)
Calendar paymentCalendar_
EquityLeg & withFixingDays(Natural)
Schedule valuationSchedule_
bool initialPriceIsInTargetCcy_
std::vector< Real > notionals_
EquityReturnType returnType_
EquityLeg & withNotionalReset(bool)
EquityLeg & withQuantity(Real)
EquityLeg & withNotionals(const std::vector< Real > ¬ionals)
EquityLeg & withInitialPrice(Real)
EquityLeg & withPaymentDayCounter(const DayCounter &dayCounter)
EquityLeg & withValuationSchedule(const Schedule &valuationSchedule)
EquityLeg & withPaymentAdjustment(BusinessDayConvention convention)
EquityLeg & withPaymentLag(Natural paymentLag)
EquityLeg & withReturnType(EquityReturnType)
DayCounter paymentDayCounter_
equity index class for holding equity fixing histories and forwarding.
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
EquityReturnType parseEquityReturnType(const std::string &str)