31 bool isCallATMIncluded,
32 Rate callDigitalPayoff,
35 bool isPutATMIncluded,
36 Rate putDigitalPayoff,
37 ext::shared_ptr<DigitalReplication> replication,
38 const bool nakedOption)
40 underlying->nominal(),
41 underlying->accrualStartDate(),
42 underlying->accrualEndDate(),
43 underlying->fixingDays(),
45 underlying->gearing(),
47 underlying->referencePeriodStart(),
48 underlying->referencePeriodEnd(),
49 underlying->dayCounter(),
50 underlying->isInArrears()),
51 underlying_(underlying), isCallATMIncluded_(isCallATMIncluded),
52 isPutATMIncluded_(isPutATMIncluded), nakedOption_(nakedOption) {
54 if (replication ==
nullptr)
55 replication = ext::make_shared<DigitalReplication>();
57 QL_REQUIRE(replication->gap()>0.0,
"Non positive epsilon not allowed");
64 "Put Cash rate non allowed if put strike is null");
68 "Call Cash rate non allowed if call strike is null");
73 switch (callPosition) {
81 QL_FAIL(
"unsupported position type");
91 switch (putPosition) {
99 QL_FAIL(
"unsupported position type");
113 switch (callPosition) {
123 QL_FAIL(
"unsupported position type");
127 switch (putPosition) {
137 QL_FAIL(
"unsupported position type");
143 switch (callPosition) {
153 QL_FAIL(
"unsupported position type");
157 switch (putPosition) {
167 QL_FAIL(
"unsupported position type");
172 QL_FAIL(
"unsupported replication type");
232 bool enforceTodaysHistoricFixings =
236 ((
fixingDate == today) && enforceTodaysHistoricFixings)) {
308 if ( std::abs(
callStrike_ - underlyingRate) <= 1.e-16 )
321 if ( (
putStrike_ - underlyingRate) > 1.e-16 ) {
326 if ( std::abs(
putStrike_ - underlyingRate) <= 1.e-16 )
Floating rate coupon with additional cap/floor.
degenerate base class for the Acyclic Visitor pattern
Capped and/or floored floating-rate coupon.
Rate rate() const override
accrued rate
Real callLeftEps_
the left and right gaps applied in payoff replication for call
void performCalculations() const override
Rate putDigitalPayoff() const
Rate putDigitalPayoff_
digital put option payoff rate, if any
Rate putOptionRate() const
ext::shared_ptr< FloatingRateCoupon > underlying() const
void deepUpdate() override
bool isPutCashOrNothing_
digital put option type: if true, cash-or-nothing, if false asset-or-nothing
ext::shared_ptr< FloatingRateCoupon > underlying_
Rate rate() const override
accrued rate
Rate callOptionRate() const
bool isCallATMIncluded_
inclusion flag og the call payoff if the call option ends at-the-money
void accept(AcyclicVisitor &) override
bool isPutATMIncluded_
inclusion flag og the put payoff if the put option ends at-the-money
bool nakedOption_
underlying excluded from the payoff
Rate callStrike_
strike rate for the the call option
bool isCallCashOrNothing_
digital call option type: if true, cash-or-nothing, if false asset-or-nothing
Real callCsi_
multiplicative factor of call payoff
Replication::Type replicationType_
Type of replication.
Rate callDigitalPayoff() const
Rate putStrike_
strike rate for the the put option
Rate callDigitalPayoff_
digital call option payoff rate, if any
Real putLeftEps_
the left and right gaps applied in payoff replication for put
Rate convexityAdjustment() const override
convexity adjustment
DigitalCoupon(const ext::shared_ptr< FloatingRateCoupon > &underlying, Rate callStrike=Null< Rate >(), Position::Type callPosition=Position::Long, bool isCallITMIncluded=false, Rate callDigitalPayoff=Null< Rate >(), Rate putStrike=Null< Rate >(), Position::Type putPosition=Position::Long, bool isPutITMIncluded=false, Rate putDigitalPayoff=Null< Rate >(), ext::shared_ptr< DigitalReplication > replication={}, bool nakedOption=false)
general constructor
Real putCsi_
multiplicative factor of put payoff
base floating-rate coupon class
virtual Date fixingDate() const
fixing date
const TimeSeries< Real > & getHistory(const std::string &name) const
returns the (possibly empty) history of the index fixings
virtual void calculate() const
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
DateProxy & evaluationDate()
the date at which pricing is to be performed.
bool & enforcesTodaysHistoricFixings()
static Settings & instance()
access to the unique instance
Visitor for a specific class
virtual void visit(T &)=0
Floating-rate coupon with digital call/put option.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
global repository for past index fixings
ext::shared_ptr< QuantLib::Payoff > payoff
base class for interest rate indexes
ext::shared_ptr< BlackVolTermStructure > v