Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
EquityFutureOption Class Reference

Serializable EQ Futures Option. More...

#include <ored/portfolio/equityfuturesoption.hpp>

+ Inheritance diagram for EquityFutureOption:
+ Collaboration diagram for EquityFutureOption:

Public Member Functions

 EquityFutureOption ()
 Default constructor. More...
 
 EquityFutureOption (Envelope &env, OptionData option, const string &currency, Real quantity, const QuantLib::ext::shared_ptr< ore::data::Underlying > &underlying, TradeStrike strike, QuantLib::Date forwardDate, const QuantLib::ext::shared_ptr< QuantLib::Index > &index=nullptr, const std::string &indexName="")
 Constructor. More...
 
void build (const QuantLib::ext::shared_ptr< EngineFactory > &) override
 Build QuantLib/QuantExt instrument, link pricing engine. More...
 
Inspectors
const std::string & name () const
 
const QuantLib::ext::shared_ptr< ore::data::Underlying > & underlying () const
 
- Public Member Functions inherited from VanillaOptionTrade
void build (const QuantLib::ext::shared_ptr< EngineFactory > &) override
 Build QuantLib/QuantExt instrument, link pricing engine. More...
 
void setNotionalAndCurrencies ()
 
const OptionDataoption () const
 
const string & asset () const
 
const string & currency () const
 
TradeStrike strike () const
 
double quantity () const
 
const QuantLib::Date forwardDate () const
 
const QuantLib::Date paymentDate () const
 
- Public Member Functions inherited from Trade
 Trade ()
 Default constructor. More...
 
 Trade (const string &tradeType, const Envelope &env=Envelope(), const TradeActions &ta=TradeActions())
 Base class constructor. More...
 
virtual ~Trade ()
 Default destructor. More...
 
virtual void build (const QuantLib::ext::shared_ptr< EngineFactory > &)=0
 
virtual std::map< std::string, RequiredFixings::FixingDatesfixings (const QuantLib::Date &settlementDate=QuantLib::Date()) const
 
const RequiredFixingsrequiredFixings () const
 
virtual std::map< AssetClass, std::set< std::string > > underlyingIndices (const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const
 
void reset ()
 Reset trade, clear all base class data. This does not reset accumulated timings for this trade. More...
 
void resetPricingStats (const std::size_t numberOfPricings=0, const boost::timer::nanosecond_type cumulativePricingTime=0)
 Reset accumulated timings to given values. More...
 
string & id ()
 Set the trade id. More...
 
void setEnvelope (const Envelope &envelope)
 Set the envelope with counterparty and portfolio info. More...
 
void setAdditionalData (const std::map< std::string, boost::any > &additionalData)
 
TradeActionstradeActions ()
 Set the trade actions. More...
 
const string & id () const
 
const string & tradeType () const
 
const Envelopeenvelope () const
 
const set< string > & portfolioIds () const
 
const TradeActionstradeActions () const
 
const QuantLib::ext::shared_ptr< InstrumentWrapper > & instrument () const
 
const std::vector< QuantLib::Leg > & legs () const
 
const std::vector< string > & legCurrencies () const
 
const std::vector< bool > & legPayers () const
 
const string & npvCurrency () const
 
virtual QuantLib::Real notional () const
 Return the current notional in npvCurrency. See individual sub-classes for the precise definition. More...
 
virtual string notionalCurrency () const
 
const Date & maturity () const
 
virtual bool isExpired (const Date &d)
 
const string & issuer () const
 
template<typename T >
additionalDatum (const std::string &tag) const
 returns any additional datum. More...
 
virtual const std::map< std::string, boost::any > & additionalData () const
 returns all additional data returned by the trade once built More...
 
const std::string & sensitivityTemplate () const
 
void validate () const
 Utility to validate that everything that needs to be set in this base class is actually set. More...
 
virtual bool hasCashflows () const
 
boost::timer::nanosecond_type getCumulativePricingTime () const
 Get cumulative timing spent on pricing. More...
 
std::size_t getNumberOfPricings () const
 Get number of pricings. More...
 
- Public Member Functions inherited from XMLSerializable
virtual ~XMLSerializable ()
 
virtual void fromXML (XMLNode *node)=0
 
virtual XMLNodetoXML (XMLDocument &doc) const =0
 
void fromFile (const std::string &filename)
 
void toFile (const std::string &filename) const
 
void fromXMLString (const std::string &xml)
 Parse from XML string. More...
 
std::string toXMLString () const
 Parse from XML string. More...
 

Serialisation

QuantLib::ext::shared_ptr< ore::data::Underlyingunderlying_
 
virtual void fromXML (XMLNode *node) override
 
virtual XMLNodetoXML (XMLDocument &doc) const override
 
std::map< AssetClass, std::set< std::string > > underlyingIndices (const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const override
 Add underlying Equity names. More...
 

Additional Inherited Members

- Protected Member Functions inherited from VanillaOptionTrade
 VanillaOptionTrade (AssetClass assetClassUnderlying)
 
 VanillaOptionTrade (const Envelope &env, AssetClass assetClassUnderlying, OptionData option, string assetName, string currency, double quantity, TradeStrike strike, const QuantLib::ext::shared_ptr< QuantLib::Index > &index=nullptr, const std::string &indexName="", QuantLib::Date forwardDate=QuantLib::Date())
 
- Protected Member Functions inherited from Trade
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 setLegBasedAdditionalData (const Size legNo, Size resultLegId=Null< Size >()) const
 
void setSensitivityTemplate (const EngineBuilder &builder)
 
void setSensitivityTemplate (const std::string &id)
 
- Protected Attributes inherited from VanillaOptionTrade
AssetClass assetClassUnderlying_
 
OptionData option_
 
string assetName_
 
string currency_
 
Currency underlyingCurrency_
 
double quantity_
 
TradeStrike strike_
 
QuantLib::ext::shared_ptr< QuantLib::Index > index_
 An index is needed if the option is to be automatically exercised on expiry. More...
 
std::string indexName_
 Hold the external index name if needed e.g. in the case of an FX index. More...
 
QuantLib::Date expiryDate_
 Store the option expiry date. More...
 
QuantLib::Date forwardDate_
 Store the (optional) forward date. More...
 
QuantLib::Date paymentDate_
 Store the (optional) payment date. More...
 
- Protected Attributes inherited from Trade
string tradeType_
 
QuantLib::ext::shared_ptr< InstrumentWrapperinstrument_
 
std::vector< QuantLib::Leg > legs_
 
std::vector< string > legCurrencies_
 
std::vector< boollegPayers_
 
string npvCurrency_
 
QuantLib::Real notional_
 
string notionalCurrency_
 
Date maturity_
 
string issuer_
 
string sensitivityTemplate_
 
bool sensitivityTemplateSet_ = false
 
std::size_t savedNumberOfPricings_ = 0
 
boost::timer::nanosecond_type savedCumulativePricingTime_ = 0
 
RequiredFixings requiredFixings_
 
std::map< std::string, boost::any > additionalData_
 

Detailed Description

Serializable EQ Futures Option.

Definition at line 38 of file equityfuturesoption.hpp.

Constructor & Destructor Documentation

◆ EquityFutureOption() [1/2]

Default constructor.

Definition at line 42 of file equityfuturesoption.hpp.

42: VanillaOptionTrade(AssetClass::EQ) { tradeType_ = "EquityFutureOption"; }
string tradeType_
Definition: trade.hpp:196
VanillaOptionTrade(AssetClass assetClassUnderlying)

◆ EquityFutureOption() [2/2]

EquityFutureOption ( Envelope env,
OptionData  option,
const string &  currency,
Real  quantity,
const QuantLib::ext::shared_ptr< ore::data::Underlying > &  underlying,
TradeStrike  strike,
QuantLib::Date  forwardDate,
const QuantLib::ext::shared_ptr< QuantLib::Index > &  index = nullptr,
const std::string &  indexName = "" 
)

Constructor.

Definition at line 33 of file equityfuturesoption.cpp.

37 : VanillaOptionTrade(env, AssetClass::EQ, option, underlying->name(), currency, quantity, strike, index, indexName,
40 tradeType_ = "EquityFutureOption";
41}
QuantLib::ext::shared_ptr< ore::data::Underlying > underlying_
const QuantLib::ext::shared_ptr< ore::data::Underlying > & underlying() const
const string & currency() const
const OptionData & option() const
TradeStrike strike() const
const QuantLib::Date forwardDate() const

Member Function Documentation

◆ build()

void build ( const QuantLib::ext::shared_ptr< EngineFactory > &  engineFactory)
overridevirtual

Build QuantLib/QuantExt instrument, link pricing engine.

Implements Trade.

Definition at line 43 of file equityfuturesoption.cpp.

43 {
44 QL_REQUIRE(quantity_ > 0, "Equity futures option requires a positive quantity");
45 assetName_ = name();
46 // FIXME: use index once implemented
47 // const QuantLib::ext::shared_ptr<Market>& market = engineFactory->market();
48 // Handle<PriceTermStructure> priceCurve =
49 // market->equityPriceCurve(underlying_->name(), engineFactory->configuration(MarketContext::pricing));
50 // index_ = QuantLib::ext::make_shared<EquityFuturesIndex>(underlying_->name(), forwardDate, NullCalendar(), priceCurve);
51
52 // FIXME: we set the automatic exercise to false until the Equity Futures Index is implemented
53
54 QuantLib::Exercise::Type exerciseType = parseExerciseType(option_.style());
55 QL_REQUIRE(exerciseType == Exercise::European, "only european option currently supported");
57 VanillaOptionTrade::build(engineFactory);
58}
const std::string & name() const
void setAutomaticExercise(bool automaticExercise)
Definition: optiondata.hpp:100
const string & style() const
Definition: optiondata.hpp:74
void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Build QuantLib/QuantExt instrument, link pricing engine.
Exercise::Type parseExerciseType(const std::string &s)
Convert text to QuantLib::Exercise::Type.
Definition: parsers.cpp:466
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ name()

const std::string & name ( ) const

Definition at line 53 of file equityfuturesoption.hpp.

53{ return underlying_->name(); }
+ Here is the caller graph for this function:

◆ underlying()

const QuantLib::ext::shared_ptr< ore::data::Underlying > & underlying ( ) const

Definition at line 54 of file equityfuturesoption.hpp.

54{ return underlying_; }

◆ fromXML()

void fromXML ( XMLNode node)
overridevirtual

Reimplemented from Trade.

Definition at line 60 of file equityfuturesoption.cpp.

60 {
61 Trade::fromXML(node);
62 XMLNode* eqNode = XMLUtils::getChildNode(node, "EquityFutureOptionData");
63 QL_REQUIRE(eqNode, "No EquityFutureOptionData Node");
64 option_.fromXML(XMLUtils::getChildNode(eqNode, "OptionData"));
65 currency_ = XMLUtils::getChildValue(eqNode, "Currency", true);
66 quantity_ = XMLUtils::getChildValueAsDouble(eqNode, "Quantity", true);
67
68 XMLNode* tmp = XMLUtils::getChildNode(eqNode, "Underlying");
69 if (!tmp)
70 tmp = XMLUtils::getChildNode(eqNode, "Name");
71 UnderlyingBuilder underlyingBuilder("Underlying", "Name");
72 underlyingBuilder.fromXML(tmp);
73 underlying_ = underlyingBuilder.underlying();
74
75 strike_.fromXML(eqNode);
76
77 forwardDate_ = parseDate(XMLUtils::getChildValue(eqNode, "FutureExpiryDate", true));
78}
virtual void fromXML(XMLNode *node) override
Definition: optiondata.cpp:32
virtual void fromXML(XMLNode *node) override
Definition: trade.cpp:34
void fromXML(XMLNode *node, const bool isRequired=true, const bool allowYieldStrike=false)
Definition: tradestrike.cpp:50
QuantLib::Date forwardDate_
Store the (optional) forward date.
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
Definition: xmlutils.cpp:286
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
rapidxml::xml_node< char > XMLNode
Definition: xmlutils.hpp:60
+ Here is the call graph for this function:

◆ toXML()

XMLNode * toXML ( XMLDocument doc) const
overridevirtual

Reimplemented from Trade.

Definition at line 80 of file equityfuturesoption.cpp.

80 {
81 XMLNode* node = Trade::toXML(doc);
82 XMLNode* eqNode = doc.allocNode("EquityFutureOptionData");
83 XMLUtils::appendNode(node, eqNode);
85
86 XMLUtils::addChild(doc, eqNode, "Currency", currency_);
87 XMLUtils::addChild(doc, eqNode, "Quantity", quantity_);
88
89 XMLUtils::appendNode(eqNode, underlying_->toXML(doc));
90
92 XMLUtils::addChild(doc, eqNode, "FutureExpiryDate", to_string(forwardDate_));
93
94 return node;
95}
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: optiondata.cpp:86
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: trade.cpp:46
XMLNode * toXML(XMLDocument &doc) const
Definition: tradestrike.cpp:86
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
Definition: xmlutils.cpp:181
static void appendNode(XMLNode *parent, XMLNode *child)
Definition: xmlutils.cpp:406
std::string to_string(const LocationInfo &l)
Definition: ast.cpp:28
+ Here is the call graph for this function:

◆ underlyingIndices()

std::map< AssetClass, std::set< std::string > > underlyingIndices ( const QuantLib::ext::shared_ptr< ReferenceDataManager > &  referenceDataManager = nullptr) const
overridevirtual

Add underlying Equity names.

Reimplemented from Trade.

Definition at line 98 of file equityfuturesoption.cpp.

98 {
99 return {{AssetClass::EQ, std::set<std::string>({name()})}};
100}
+ Here is the call graph for this function:

Member Data Documentation

◆ underlying_

QuantLib::ext::shared_ptr<ore::data::Underlying> underlying_
private

Definition at line 68 of file equityfuturesoption.hpp.