26#include <ql/instruments/doublebarriertype.hpp>
27#include <ql/instruments/barriertype.hpp>
28#include <ql/index.hpp>
43 const QuantLib::ext::shared_ptr<QuantLib::Instrument>& undInst, Barrier::Type barrierType,
44 Handle<Quote> spot, Real rebate,
const QuantLib::Currency ccy,
45 const QuantLib::Date& startDate,
const QuantLib::ext::shared_ptr<QuantLib::Index>& index,
50 const Real undMultiplier = 1.0,
52 std::vector<QuantLib::ext::shared_ptr<QuantLib::Instrument>>(),
67 QuantLib::Real
NPV()
const override;
71 const QuantLib::Currency
ccy_;
73 QuantLib::ext::shared_ptr<QuantLib::Index>
index_;
81 const QuantLib::ext::shared_ptr<QuantLib::Instrument>& undInst, Barrier::Type barrierType,
82 Handle<Quote> spot, Real barrier, Real rebate,
const QuantLib::Currency ccy,
83 const QuantLib::Date& startDate,
const QuantLib::ext::shared_ptr<QuantLib::Index>& index,
88 const Real undMultiplier = 1.0,
90 std::vector<QuantLib::ext::shared_ptr<QuantLib::Instrument>>(),
96 bool checkBarrier(Real spot,
bool isTouchingOnly)
const override;
107 const QuantLib::ext::shared_ptr<QuantLib::Instrument>& undInst, DoubleBarrier::Type barrierType,
108 Handle<Quote> spot, Real barrierLow, Real barrierHigh, Real rebate,
109 const QuantLib::Currency ccy,
const QuantLib::Date& startDate,
114 const Real undMultiplier = 1.0,
116 std::vector<QuantLib::ext::shared_ptr<QuantLib::Instrument>>(),
120 (barrierType == DoubleBarrier::Type::KnockOut ? Barrier::Type::UpOut : Barrier::Type::UpIn), spot, rebate,
123 QL_REQUIRE(barrierType == DoubleBarrier::Type::KnockOut || barrierType == DoubleBarrier::Type::KnockIn,
124 "Invalid barrier type " << barrierType <<
". Only KnockOut and KnockIn are supported.");
125 QL_REQUIRE(barrierLow < barrierHigh,
"barrierLow has to be less than barrierHigh");
128 bool checkBarrier(Real spot,
bool isTouchingOnly)
const override;
QuantLib::Real NPV() const override
Return the NPV of this instrument.
Barrier::Type barrierType_
const QuantLib::Date startDate_
const std::map< std::string, boost::any > & additionalResults() const override
Return the additional results of this instrument.
const QuantLib::Currency ccy_
QuantLib::Calendar calendar_
BarrierOptionWrapper(const QuantLib::ext::shared_ptr< QuantLib::Instrument > &inst, const bool isLongOption, const QuantLib::Date &exerciseDate, const bool isPhysicalDelivery, const QuantLib::ext::shared_ptr< QuantLib::Instrument > &undInst, Barrier::Type barrierType, Handle< Quote > spot, Real rebate, const QuantLib::Currency ccy, const QuantLib::Date &startDate, const QuantLib::ext::shared_ptr< QuantLib::Index > &index, const QuantLib::Calendar &calendar, const Real multiplier=1.0, const Real undMultiplier=1.0, const std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > > &additionalInstruments=std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > >(), const std::vector< Real > &additionalMultipliers=std::vector< Real >())
virtual bool checkBarrier(Real, bool) const =0
QuantLib::ext::shared_ptr< QuantLib::Index > index_
bool checkBarrier(Real spot, bool isTouchingOnly) const override
bool exercise() const override
DoubleBarrierOptionWrapper(const QuantLib::ext::shared_ptr< QuantLib::Instrument > &inst, const bool isLongOption, const QuantLib::Date &exerciseDate, const bool isPhysicalDelivery, const QuantLib::ext::shared_ptr< QuantLib::Instrument > &undInst, DoubleBarrier::Type barrierType, Handle< Quote > spot, Real barrierLow, Real barrierHigh, Real rebate, const QuantLib::Currency ccy, const QuantLib::Date &startDate, const QuantLib::ext::shared_ptr< QuantLib::Index > &index, const QuantLib::Calendar &calendar, const Real multiplier=1.0, const Real undMultiplier=1.0, const std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > > &additionalInstruments=std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > >(), const std::vector< Real > &additionalMultipliers=std::vector< Real >())
const std::vector< Real > & additionalMultipliers() const
const std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > > & additionalInstruments() const
const QuantLib::Date & exerciseDate() const
the (actual) date the option was exercised
bool isPhysicalDelivery() const
return true for physical delivery, false for cash settlement
void reset() override
reset is called every time a new path is about to be priced.
bool checkBarrier(Real spot, bool isTouchingOnly) const override
bool exercise() const override
SingleBarrierOptionWrapper(const QuantLib::ext::shared_ptr< QuantLib::Instrument > &inst, const bool isLongOption, const QuantLib::Date &exerciseDate, const bool isPhysicalDelivery, const QuantLib::ext::shared_ptr< QuantLib::Instrument > &undInst, Barrier::Type barrierType, Handle< Quote > spot, Real barrier, Real rebate, const QuantLib::Currency ccy, const QuantLib::Date &startDate, const QuantLib::ext::shared_ptr< QuantLib::Index > &index, const QuantLib::Calendar &calendar, const Real multiplier=1.0, const Real undMultiplier=1.0, const std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > > &additionalInstruments=std::vector< QuantLib::ext::shared_ptr< QuantLib::Instrument > >(), const std::vector< Real > &additionalMultipliers=std::vector< Real >())
Base class for wrapper of QL instrument, used to store "state" of trade under each scenario.
Serializable Credit Default Swap.
Wrapper for option instruments, tracks whether option has been exercised or not.