36#include <ql/cashflow.hpp>
37#include <ql/instrument.hpp>
38#include <ql/time/date.hpp>
72 virtual void build(
const QuantLib::ext::shared_ptr<EngineFactory>&) = 0;
84 virtual std::map<std::string, RequiredFixings::FixingDates>
85 fixings(
const QuantLib::Date& settlementDate = QuantLib::Date())
const {
92 virtual std::map<AssetClass, std::set<std::string>>
93 underlyingIndices(
const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager =
nullptr)
const {
108 const boost::timer::nanosecond_type cumulativePricingTime = 0) {
131 const string&
id()
const {
return id_; }
143 const std::vector<QuantLib::Leg>&
legs()
const {
return legs_; }
166 const virtual std::map<std::string,boost::any>&
additionalData()
const;
218 Date
addPremiums(std::vector<QuantLib::ext::shared_ptr<Instrument>>& instruments, std::vector<Real>& multipliers,
219 const Real tradeMultiplier,
const PremiumData& premiumData,
const Real premiumMultiplier,
220 const Currency& tradeCurrency,
const QuantLib::ext::shared_ptr<EngineFactory>& factory,
221 const string& configuration);
243 std::map<std::string,boost::any>::const_iterator
value =
246 tag <<
" not provided");
247 return boost::any_cast<T>(
value->second);
Base PricingEngine Builder class for a specific model and engine.
Serializable object holding generic trade data, reporting dimensions.
const set< string > & portfolioIds() const
Serializable object holding premium data.
std::map< std::string, FixingDates > fixingDatesIndices(const QuantLib::Date &settlementDate=QuantLib::Date()) const
Serializable object holding generic trade actions.
TradeActions & tradeActions()
Set the trade actions.
const string & issuer() const
void setEnvelope(const Envelope &envelope)
Set the envelope with counterparty and portfolio info.
virtual bool isExpired(const Date &d)
const std::string & sensitivityTemplate() const
const string & id() const
void resetPricingStats(const std::size_t numberOfPricings=0, const boost::timer::nanosecond_type cumulativePricingTime=0)
Reset accumulated timings to given values.
std::vector< bool > legPayers_
string sensitivityTemplate_
std::vector< string > legCurrencies_
std::size_t getNumberOfPricings() const
Get number of pricings.
T additionalDatum(const std::string &tag) const
returns any additional datum.
const TradeActions & tradeActions() const
const std::vector< QuantLib::Leg > & legs() const
const Date & maturity() const
const set< string > & portfolioIds() const
std::vector< QuantLib::Leg > legs_
TradeActions tradeActions_
const RequiredFixings & requiredFixings() const
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
const std::vector< string > & legCurrencies() const
string & id()
Set the trade id.
bool sensitivityTemplateSet_
virtual const std::map< std::string, boost::any > & additionalData() const
returns all additional data returned by the trade once built
const std::vector< bool > & legPayers() const
void setAdditionalData(const std::map< std::string, boost::any > &additionalData)
virtual ~Trade()
Default destructor.
virtual bool hasCashflows() const
RequiredFixings requiredFixings_
void validate() const
Utility to validate that everything that needs to be set in this base class is actually set.
const QuantLib::ext::shared_ptr< InstrumentWrapper > & instrument() const
virtual QuantLib::Real notional() const
Return the current notional in npvCurrency. See individual sub-classes for the precise definition.
const string & npvCurrency() const
const Envelope & envelope() const
boost::timer::nanosecond_type savedCumulativePricingTime_
QuantLib::ext::shared_ptr< InstrumentWrapper > instrument_
boost::timer::nanosecond_type getCumulativePricingTime() const
Get cumulative timing spent on pricing.
void reset()
Reset trade, clear all base class data. This does not reset accumulated timings for this trade.
virtual std::map< std::string, RequiredFixings::FixingDates > fixings(const QuantLib::Date &settlementDate=QuantLib::Date()) const
Trade(const string &tradeType, const Envelope &env=Envelope(), const TradeActions &ta=TradeActions())
Base class constructor.
virtual std::map< AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const
Trade()
Default constructor.
std::size_t savedNumberOfPricings_
virtual string notionalCurrency() const
const string & tradeType() const
void setLegBasedAdditionalData(const Size legNo, Size resultLegId=Null< Size >()) const
std::map< std::string, boost::any > additionalData_
virtual void build(const QuantLib::ext::shared_ptr< EngineFactory > &)=0
Small XML Document wrapper class.
Base class for all serializable classes.
SafeStack< ValueType > value
trade envelope data model and serialization
Logic for calculating required fixing dates on legs.
Base class for wrapper of QL instrument, used to store "state" of trade under each scenario.
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.