17#include <boost/make_shared.hpp>
23#include <ql/errors.hpp>
24#include <ql/exercise.hpp>
25#include <ql/instruments/compositeinstrument.hpp>
26#include <ql/instruments/payoffs.hpp>
27#include <ql/instruments/vanillaoption.hpp>
39 additionalData_[
"isdaSubProduct"] = string(
"Price Return Basic Performance");
47 QL_REQUIRE(
tradeActions().empty(),
"TradeActions not supported for EquityDigitalOption");
63 QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff(
new CashOrNothingPayoff(type,
strike,
payoffAmount_));
67 QuantLib::ext::shared_ptr<Exercise> exercise = QuantLib::ext::make_shared<EuropeanExercise>(expiryDate);
71 QuantLib::ext::shared_ptr<Instrument> vanilla = QuantLib::ext::make_shared<VanillaOption>(payoff, exercise);
74 QuantLib::ext::shared_ptr<EngineBuilder> builder = engineFactory->builder(
tradeType_);
75 QL_REQUIRE(builder,
"No builder found for " <<
tradeType_);
76 QuantLib::ext::shared_ptr<EquityDigitalOptionEngineBuilder> eqOptBuilder =
77 QuantLib::ext::dynamic_pointer_cast<EquityDigitalOptionEngineBuilder>(builder);
78 vanilla->setPricingEngine(eqOptBuilder->engine(assetName, ccy));
82 Real bsInd = (positionType == QuantLib::Position::Long ? 1.0 : -1.0);
85 std::vector<QuantLib::ext::shared_ptr<Instrument>> additionalInstruments;
86 std::vector<Real> additionalMultipliers;
87 Date lastPremiumDate =
91 instrument_ = QuantLib::ext::shared_ptr<InstrumentWrapper>(
97 maturity_ = std::max(lastPremiumDate, expiryDate);
106 QL_REQUIRE(eqNode,
"No EquityDigitalOptionData Node");
Engine builder for equity options.
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Build QuantLib/QuantExt instrument, link pricing engine.
const string & equityName() const
EquityUnderlying equityUnderlying_
void fromXML(XMLNode *node) override
XMLNode * toXML(XMLDocument &doc) const override
const string & callPut() const
const string & longShort() const
const string & style() const
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
const bool & payoffAtExpiry() const
const PremiumData & premiumData() const
const vector< string > & exerciseDates() const
TradeActions & tradeActions()
Set the trade actions.
virtual void fromXML(XMLNode *node) override
Date addPremiums(std::vector< QuantLib::ext::shared_ptr< Instrument > > &instruments, std::vector< Real > &multipliers, const Real tradeMultiplier, const PremiumData &premiumData, const Real premiumMultiplier, const Currency &tradeCurrency, const QuantLib::ext::shared_ptr< EngineFactory > &factory, const string &configuration)
void setSensitivityTemplate(const EngineBuilder &builder)
virtual XMLNode * toXML(XMLDocument &doc) const override
QuantLib::ext::shared_ptr< InstrumentWrapper > instrument_
std::map< std::string, boost::any > additionalData_
Vanilla Instrument Wrapper.
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static void appendNode(XMLNode *parent, XMLNode *child)
EQ Digital Option data model and serialization.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Position::Type parsePositionType(const std::string &s)
Convert text to QuantLib::Position::Type.
Option::Type parseOptionType(const std::string &s)
Convert text to QuantLib::Option::Type.
Classes and functions for log message handling.
Serializable Credit Default Swap.