Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
referencedata.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file portfolio/referencedata.hpp
20 \brief Reference data model and serialization
21 \ingroup tradedata
22*/
23
24#pragma once
25
31#include <ql/patterns/singleton.hpp>
32#include <ql/time/date.hpp>
33#include <ql/time/period.hpp>
34#include <set>
35#include <tuple>
36
37namespace ore {
38namespace data {
39
40//! Base class for reference data
41/*! Each reference datum object is a subclass of this base and has it's own accessor functions.
42 * Instances of ReferenceDatum can be gotten from the ReferenceDataManager below, and then cast up as required.
43 * Each instance should be uniquely identified by it's type (which defines it's subclass, e.g. "Bond" for
44 * BondReferenceDatum) and it's id, which is a string. Here it can be any string but in applications there can be
45 * a naming scheme like ISIN for Bonds.
46 */
48public:
49 //! Default Constructor
50 ReferenceDatum() : validFrom_(QuantLib::Date::minDate()) {}
51 //! Base class constructor
52 ReferenceDatum(const std::string& type, const std::string& id)
53 : type_(type), id_(id), validFrom_(QuantLib::Date::minDate()) {}
54 //! Base class constructor
55 ReferenceDatum(const std::string& type, const std::string& id, const QuantLib::Date& validFrom)
57
58 //! setters
59 void setType(const string& type) { type_ = type; }
60 void setId(const string& id) { id_ = id; }
61 void setValidFrom(const QuantLib::Date& validFrom) { validFrom_ = validFrom; }
62
63 //! getters
64 const std::string& type() const { return type_; }
65 const std::string& id() const { return id_; }
66 const QuantLib::Date& validFrom() const { return validFrom_; }
67
68 void fromXML(XMLNode* node) override;
69 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
70
71private:
72 std::string type_;
73 std::string id_;
74 QuantLib::Date validFrom_;
75};
76
77/*
78<ReferenceDatum id="US12345678">
79 <Type>Bond</Type>
80 <BondReferenceData>
81 <IssuerId>...</IssuerId>
82 <SettlementDays>...</SettlementDays>
83 <Calendar>...</Calendar>
84 <IssueDate>...</IssueDate>
85 <CreditCurveId>...</CreditCurveId>
86 <ReferenceCurveId>...</ReferenceCurveId>
87 <IncomCurveId>...</IncomeCurveId>
88 <LegData>...</LegData>
89 </BondReferenceData>
90</ReferenceDatum>
91*/
92class LegData;
94public:
95 static constexpr const char* TYPE = "Bond";
96
98 string issuerId;
100 string calendar;
101 string issueDate;
109 std::vector<LegData> legData;
110 string subType;
111 void fromXML(XMLNode* node) override;
112 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
113 };
114
116
117 BondReferenceDatum(const string& id) : ReferenceDatum(TYPE, id) {}
118
119 BondReferenceDatum(const string& id, const QuantLib::Date& validFrom) : ReferenceDatum(TYPE, id, validFrom) {}
120
122
123 BondReferenceDatum(const string& id, const QuantLib::Date& validFrom, const BondData& bondData)
125
126 void fromXML(XMLNode* node) override;
127 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
128
129 const BondData& bondData() const { return bondData_; }
131
132private:
134};
135
136/*! Hold reference data on a constituent of a credit index.
137
138 Gives the name and the weight of the credit index constituent. A weight of zero indicates that there has been a
139 credit event relating to the constituent. In this case, the weight of the constituent prior to the credit event
140 is supplied along with the recovery rate, i.e. final auction price, default date, event determination date,
141 auction date and auction cash settlement date. Not all of these fields are required by every engine in the event
142 of default.
143*/
145public:
147
148 CreditIndexConstituent(const std::string& name,
149 QuantLib::Real weight,
150 QuantLib::Real priorWeight = QuantLib::Null<QuantLib::Real>(),
151 QuantLib::Real recovery = QuantLib::Null<QuantLib::Real>(),
152 const QuantLib::Date& auctionDate = QuantLib::Date(),
153 const QuantLib::Date& auctionSettlementDate = QuantLib::Date(),
154 const QuantLib::Date& defaultDate = QuantLib::Date(),
155 const QuantLib::Date& eventDeterminationDate = QuantLib::Date());
156
157 void fromXML(XMLNode* node) override;
158 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
159
160 const std::string& name() const;
161 QuantLib::Real weight() const;
162 QuantLib::Real priorWeight() const;
163 QuantLib::Real recovery() const;
164 const QuantLib::Date& auctionDate() const;
165 const QuantLib::Date& auctionSettlementDate() const;
166 const QuantLib::Date& defaultDate() const;
167 const QuantLib::Date& eventDeterminationDate() const;
168
169private:
170 std::string name_;
171 QuantLib::Real weight_;
172 QuantLib::Real priorWeight_;
173 QuantLib::Real recovery_;
174 QuantLib::Date auctionDate_;
176 QuantLib::Date defaultDate_;
178};
179
180//! Compare CreditIndexConstituent instances using their name
181bool operator<(const CreditIndexConstituent& lhs, const CreditIndexConstituent& rhs);
182
183//! Credit index reference data, contains a set of index constituents.
185public:
186 static constexpr const char* TYPE = "CreditIndex";
187
189
190 CreditIndexReferenceDatum(const std::string& name);
191
192 CreditIndexReferenceDatum(const string& id, const QuantLib::Date& validFrom);
193
194 void fromXML(XMLNode* node) override;
195 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
196
197 //! Add a constituent. The constituent is not added if already present.
198 void add(const CreditIndexConstituent& c);
199
200 //! Get all of the underlying constituents.
201 const std::set<CreditIndexConstituent>& constituents() const;
202
203 const std::string& indexFamily() const { return indexFamily_; }
204
205 void setIndexFamily(const std::string& indexFamily) { indexFamily_ = indexFamily; }
206
207private:
208 std::set<CreditIndexConstituent> constituents_;
209 std::string indexFamily_;
210};
211
212
213/*
214<ReferenceDatum id="SP500">
215 <Type>EquityIndex</Type>
216 <EquityIndexReferenceData>
217 <Underlying>
218 <Name>Apple</Name>
219 <Weight>0.03</Weight>
220 </Underlying>
221 ...
222 </EquityIndexReferenceData>
223</ReferenceDatum>
224*/
225//! Base class for indices - lets see if we can keep this, they might diverge too much...
227protected:
229 IndexReferenceDatum(const string& type, const string& id) : ReferenceDatum(type, id) {}
230 IndexReferenceDatum(const string& type, const string& id, const QuantLib::Date& validFrom)
232
233public:
234 void fromXML(XMLNode* node) override;
235 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
236
237 // Get all underlyings (names and weights)
238 const map<string, double> underlyings() const { return data_; }
239 // Set all underlying (or reset)
240 void setUnderlyings(const std::map<string, double>& data) { data_ = data; }
241 // add a new underlying
242 void addUnderlying(const string& name, double weight) { data_[name]+=weight; }
243
244private:
245 std::map<std::string, double> data_;
246};
247
248//! EquityIndex Reference data, contains the names and weights of an equity index
250public:
251 static constexpr const char* TYPE = "EquityIndex";
252
255 EquityIndexReferenceDatum(const string& name, const QuantLib::Date& validFrom)
257};
258
259
260//! EquityIndex Reference data, contains the names and weights of an equity index
262public:
263 static constexpr const char* TYPE = "Commodity";
264
267 CommodityIndexReferenceDatum(const string& name, const QuantLib::Date& validFrom)
269};
270
271/*
272<ReferenceDatum id="RIC:.SPXEURHedgedMonthly">
273 <Type>CurrencyHedgedEquityIndex</Type>
274 <CurrencyHedgedEquityIndexReferenceDatum>
275 <UnderlyingIndex>RIC:.SPX</UnderlyingIndex>
276 <HedgeCurrency>EUR</HedgeCurrency>
277 <RebalancingStrategy>EndOfMonth</RebalancingStrategy>
278 <ReferenceDateOffset>1</ReferenceDateOffset>
279 <HedgeAdjustment>None|Daily</HedgeAdjustment>
280 <HedgeCalendar>EUR,USD</HedgeCalendar>
281 <FxIndex>ECB-EUR-USD</FxIndex>
282 <IndexWeightsAtLastRebalancingDate>
283 <Underlying>
284 <Name>Apple</Name>
285 <Weight>0.1</Weight>
286 </Underlying>
287 ...
288 </IndexWeightsAtLastRebalancingDate>
289 </CurrencyHedgedEquityIndexReferenceDatum>
290</ReferenceDatum>
291*/
293public:
294 static constexpr const char* TYPE = "CurrencyHedgedEquityIndex";
295
298 };
299
301 enum Rule { None, Daily };
302 };
303
305 : underlyingIndexName_(""), rebalancingStrategy_(RebalancingDate::Strategy::EndOfMonth),
307 setType(TYPE);
308 }
309
313 hedgeAdjustmentRule_(HedgeAdjustment::Rule::None), hedgeCalendar_(WeekendsOnly()) {}
314
315 CurrencyHedgedEquityIndexReferenceDatum(const string& name, const QuantLib::Date& validFrom)
318 hedgeAdjustmentRule_(HedgeAdjustment::Rule::None), hedgeCalendar_(WeekendsOnly()) {}
319
320 const std::string& underlyingIndexName() const { return underlyingIndexName_; }
325 const std::map<std::string, std::string>& fxIndexes() const { return fxIndexes_; }
326 //! Returns the currency weights at the last rebalancing date
327 const std::map<string, double>& currencyWeights() const { return data_; }
328
329 Date referenceDate(const Date& asof);
330 Date rebalancingDate(const Date& asof);
331
332 void fromXML(XMLNode* node) override;
333 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
334
335private:
340
342 std::map<std::string, std::string> fxIndexes_;
343 map<string, double> data_;
344};
345
346/*
347<ReferenceDatum id="MSFDSJP">
348 <Type>PortfolioBasket</Type>
349 <PortfolioBasketReferenceData>
350 <Components>
351 <Trade>
352 <TradeType>EquityPosition</TradeType>
353 <Envelope>
354 <CounterParty>{{netting_set_id}}</CounterParty>
355 <NettingSetId>{{netting_set_id}}</NettingSetId>
356 <AdditionalFields>
357 <valuation_date>2023-11-07</valuation_date>
358 <im_model>SIMM</im_model>
359 <post_regulations>SEC</post_regulations>
360 <collect_regulations>SEC</collect_regulations>
361 </AdditionalFields>
362 </Envelope>
363 <EquityPositionData>
364 <Quantity>7006.0</Quantity>
365 <Underlying>
366 <Type>Equity</Type>
367 <Name>CR.N</Name>
368 <IdentifierType>RIC</IdentifierType>
369 </Underlying>
370 </EquityPositionData>
371 </Trade>
372 <Trade id="CashSWAP_USD.CASH">
373 <TradeType>Swap</TradeType>
374 <Envelope>
375 <CounterParty>{{netting_set_id}}</CounterParty>
376 <NettingSetId>{{netting_set_id}}</NettingSetId>
377 <AdditionalFields>
378 <valuation_date>2023-11-07</valuation_date>
379 <im_model>SIMM</im_model>
380 <post_regulations>SEC</post_regulations>
381 <collect_regulations>SEC</collect_regulations>
382 </AdditionalFields>
383 </Envelope>
384 <SwapData>
385 <LegData>
386 <Payer>true</Payer>
387 <LegType>Cashflow</LegType>
388 <Currency>USD</Currency>
389 <CashflowData>
390 <Cashflow>
391 <Amount date="2023-11-08">28641475.824680243</Amount>
392 </Cashflow>
393 </CashflowData>
394 </LegData>
395 </SwapData>
396 </Trade>
397 </Components>
398 </PortfolioBasketReferenceData>
399</ReferenceDatum>
400*/
402public:
403 static constexpr const char* TYPE = "PortfolioBasket";
404
405
407 setType(TYPE);
408 }
409
411
412 PortfolioBasketReferenceDatum(const string& id, const QuantLib::Date& validFrom)
414
415 void fromXML(XMLNode* node) override;
416 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
417
418 const vector<QuantLib::ext::shared_ptr<Trade>>& getTrades() const { return tradecomponents_; }
419
420private:
421 vector<QuantLib::ext::shared_ptr<Trade>> tradecomponents_;
422};
423
424
425//! CreditIndex Reference data, contains the names and weights of a credit index
427public:
428 static constexpr const char* TYPE = "Credit";
429
430 struct CreditData {
431 string name;
432 string group;
433 string successor;
438 };
440
442
443 CreditReferenceDatum(const string& id, const QuantLib::Date& validFrom) : ReferenceDatum(TYPE, id, validFrom) {}
444
447
448 CreditReferenceDatum(const string& id, const QuantLib::Date& validFrom, const CreditData& creditData)
450
451 void fromXML(XMLNode* node) override;
452 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
453
454 const CreditData& creditData() const { return creditData_; }
456
457private:
459};
460
461
462//! Equity Reference data
464public:
465 static constexpr const char* TYPE = "Equity";
466
467 struct EquityData {
468 std::string equityId;
469 std::string equityName;
470 std::string currency;
471 QuantLib::Size scalingFactor;
472 std::string exchangeCode;
474 QuantLib::Date equityStartDate;
475 std::string proxyIdentifier;
476 std::string simmBucket;
477 std::string crifQualifier;
478 std::string proxyVolatilityId;
479 };
480
482
483 EquityReferenceDatum(const std::string& id) : ore::data::ReferenceDatum(TYPE, id) {}
484
485 EquityReferenceDatum(const std::string& id, const QuantLib::Date& validFrom)
487
489
490 EquityReferenceDatum(const std::string& id, const QuantLib::Date& validFrom, const EquityData& equityData)
492
493
494 void fromXML(XMLNode* node) override;
495 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
496
497 const EquityData& equityData() const { return equityData_; }
499
500protected:
502};
503
504//! Bond Basket Reference Data
506public:
507 static constexpr const char* TYPE = "BondBasket";
508
510
511 BondBasketReferenceDatum(const std::string& id) : ore::data::ReferenceDatum(TYPE, id) {}
512
513 BondBasketReferenceDatum(const std::string& id, const QuantLib::Date& validFrom) : ore::data::ReferenceDatum(TYPE, id, validFrom) {}
514
515 BondBasketReferenceDatum(const std::string& id, const std::vector<BondUnderlying>& underlyingData)
517
518 BondBasketReferenceDatum(const std::string& id,
519 const QuantLib::Date& validFrom, const std::vector<BondUnderlying>& underlyingData)
521
522 void fromXML(XMLNode* node) override;
523 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
524
525 const std::vector<BondUnderlying>& underlyingData() const { return underlyingData_; }
526
527private:
528 std::vector<BondUnderlying> underlyingData_;
529};
530
531//! Interface for Reference Data lookups
532/*! The ReferenceDataManager is a repository of ReferenceDatum objects.
533 *
534 * This is an interface, there is a concrete impl below that is BasicReferenceDataManager which is filebased.
535 * It is also possible to have a transactional implementation that will fetch reference data from a DB or via
536 * a restful call, possibly with a cache.
537 *
538 * An instance of this class is made available to Trades as they are built, this code be done with a singleton
539 * but it is clearer to pass a pointer to an instance when the Trade is built itself, as there is no access method
540 * for Trade::build() we instead pass a pointer to the Trade constructors, this is then populated when TradeBuilders
541 * are created for ORE+ trades, this also allows us to have custom ORE+ versions of Trades that overload the build()
542 * method to use this data in place of extracting it from XML.
543 *
544 * The actual Trade objects will take a copy of any reference data they need, this way they own all the required data
545 * and a call to "Trade::toXML()" will write out the "full" trade. For example we might load a CDS Index trade using
546 * reference data from which the basket is created, but if we call "toXML()" on that CDS Index the trade the whole
547 * basket will be written out.
548 */
550public:
552 virtual bool hasData(const string& type, const string& id,
553 const QuantLib::Date& asof = QuantLib::Null<QuantLib::Date>()) = 0;
554 virtual QuantLib::ext::shared_ptr<ReferenceDatum>
555 getData(const string& type, const string& id, const QuantLib::Date& asof = QuantLib::Null<QuantLib::Date>()) = 0;
556 virtual void add(const QuantLib::ext::shared_ptr<ReferenceDatum>& referenceDatum) = 0;
557};
558
559//! Basic Concrete impl that loads an big XML and keeps data in memory
561public:
563 BasicReferenceDataManager(const string& filename) { fromFile(filename); }
564
565 // Load extra data and append to this manger
566 void appendData(const string& filename) { fromFile(filename); }
567
568 QuantLib::ext::shared_ptr<ReferenceDatum> buildReferenceDatum(const string& refDataType);
569
570 void fromXML(XMLNode* node) override;
571 XMLNode* toXML(ore::data::XMLDocument& doc) const override;
572
573 // clear this ReferenceData manager, note that we can load multiple files
574 void clear() { data_.clear(); }
575
576 bool hasData(const string& type, const string& id,
577 const QuantLib::Date& asof = QuantLib::Null<QuantLib::Date>()) override;
578 QuantLib::ext::shared_ptr<ReferenceDatum> getData(const string& type, const string& id,
579 const QuantLib::Date& asof = QuantLib::Null<QuantLib::Date>()) override;
580 void add(const QuantLib::ext::shared_ptr<ReferenceDatum>& referenceDatum) override;
581 // adds a datum from an xml node and returns it (or nullptr if nothing was added due to an error)
582 QuantLib::ext::shared_ptr<ReferenceDatum> addFromXMLNode(XMLNode* node, const std::string& id = std::string(),
583 const QuantLib::Date& validFrom = QuantLib::Null<QuantLib::Date>());
584
585protected:
586 std::tuple<QuantLib::Date, QuantLib::ext::shared_ptr<ReferenceDatum>> latestValidFrom(const string& type, const string& id,
587 const QuantLib::Date& asof) const;
588 void check(const string& type, const string& id, const QuantLib::Date& asof) const;
589 map<std::pair<string, string>, std::map<QuantLib::Date, QuantLib::ext::shared_ptr<ReferenceDatum>>> data_;
590 std::set<std::tuple<string, string, QuantLib::Date>> duplicates_;
591 map<std::pair<string, string>, std::map<QuantLib::Date, string>> buildErrors_;
592};
593
594} // namespace data
595} // namespace ore
Basic Concrete impl that loads an big XML and keeps data in memory.
bool hasData(const string &type, const string &id, const QuantLib::Date &asof=QuantLib::Null< QuantLib::Date >()) override
map< std::pair< string, string >, std::map< QuantLib::Date, QuantLib::ext::shared_ptr< ReferenceDatum > > > data_
map< std::pair< string, string >, std::map< QuantLib::Date, string > > buildErrors_
void fromXML(XMLNode *node) override
void appendData(const string &filename)
XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::tuple< QuantLib::Date, QuantLib::ext::shared_ptr< ReferenceDatum > > latestValidFrom(const string &type, const string &id, const QuantLib::Date &asof) const
QuantLib::ext::shared_ptr< ReferenceDatum > buildReferenceDatum(const string &refDataType)
void add(const QuantLib::ext::shared_ptr< ReferenceDatum > &referenceDatum) override
std::set< std::tuple< string, string, QuantLib::Date > > duplicates_
QuantLib::ext::shared_ptr< ReferenceDatum > getData(const string &type, const string &id, const QuantLib::Date &asof=QuantLib::Null< QuantLib::Date >()) override
BasicReferenceDataManager(const string &filename)
QuantLib::ext::shared_ptr< ReferenceDatum > addFromXMLNode(XMLNode *node, const std::string &id=std::string(), const QuantLib::Date &validFrom=QuantLib::Null< QuantLib::Date >())
Bond Basket Reference Data.
BondBasketReferenceDatum(const std::string &id, const QuantLib::Date &validFrom)
void fromXML(XMLNode *node) override
const std::vector< BondUnderlying > & underlyingData() const
XMLNode * toXML(ore::data::XMLDocument &doc) const override
static constexpr const char * TYPE
std::vector< BondUnderlying > underlyingData_
BondBasketReferenceDatum(const std::string &id, const std::vector< BondUnderlying > &underlyingData)
BondBasketReferenceDatum(const std::string &id, const QuantLib::Date &validFrom, const std::vector< BondUnderlying > &underlyingData)
BondBasketReferenceDatum(const std::string &id)
BondReferenceDatum(const string &id, const QuantLib::Date &validFrom, const BondData &bondData)
void setBondData(const BondData &bondData)
void fromXML(XMLNode *node) override
BondReferenceDatum(const string &id, const QuantLib::Date &validFrom)
XMLNode * toXML(ore::data::XMLDocument &doc) const override
static constexpr const char * TYPE
const BondData & bondData() const
BondReferenceDatum(const string &id)
BondReferenceDatum(const string &id, const BondData &bondData)
EquityIndex Reference data, contains the names and weights of an equity index.
CommodityIndexReferenceDatum(const string &name, const QuantLib::Date &validFrom)
CommodityIndexReferenceDatum(const string &name)
static constexpr const char * TYPE
const QuantLib::Date & defaultDate() const
const QuantLib::Date & eventDeterminationDate() const
QuantLib::Real recovery() const
void fromXML(XMLNode *node) override
const QuantLib::Date & auctionDate() const
XMLNode * toXML(ore::data::XMLDocument &doc) const override
QuantLib::Real priorWeight() const
CreditIndexConstituent(const std::string &name, QuantLib::Real weight, QuantLib::Real priorWeight=QuantLib::Null< QuantLib::Real >(), QuantLib::Real recovery=QuantLib::Null< QuantLib::Real >(), const QuantLib::Date &auctionDate=QuantLib::Date(), const QuantLib::Date &auctionSettlementDate=QuantLib::Date(), const QuantLib::Date &defaultDate=QuantLib::Date(), const QuantLib::Date &eventDeterminationDate=QuantLib::Date())
const QuantLib::Date & auctionSettlementDate() const
const std::string & name() const
Credit index reference data, contains a set of index constituents.
const std::set< CreditIndexConstituent > & constituents() const
Get all of the underlying constituents.
void setIndexFamily(const std::string &indexFamily)
const std::string & indexFamily() const
void fromXML(XMLNode *node) override
XMLNode * toXML(ore::data::XMLDocument &doc) const override
static constexpr const char * TYPE
std::set< CreditIndexConstituent > constituents_
void add(const CreditIndexConstituent &c)
Add a constituent. The constituent is not added if already present.
CreditIndex Reference data, contains the names and weights of a credit index.
const CreditData & creditData() const
CreditReferenceDatum(const string &id)
void fromXML(XMLNode *node) override
XMLNode * toXML(ore::data::XMLDocument &doc) const override
static constexpr const char * TYPE
CreditReferenceDatum(const string &id, const CreditData &creditData)
CreditReferenceDatum(const string &id, const QuantLib::Date &validFrom, const CreditData &creditData)
void setCreditData(const CreditData &creditData)
CreditReferenceDatum(const string &id, const QuantLib::Date &validFrom)
CurrencyHedgedEquityIndexReferenceDatum(const string &name, const QuantLib::Date &validFrom)
RebalancingDate::Strategy rebalancingStrategy() const
const std::map< string, double > & currencyWeights() const
Returns the currency weights at the last rebalancing date.
const std::map< std::string, std::string > & fxIndexes() const
XMLNode * toXML(ore::data::XMLDocument &doc) const override
std::map< std::string, std::string > fxIndexes_
EquityIndex Reference data, contains the names and weights of an equity index.
EquityIndexReferenceDatum(const string &name)
static constexpr const char * TYPE
EquityIndexReferenceDatum(const string &name, const QuantLib::Date &validFrom)
EquityReferenceDatum(const std::string &id, const QuantLib::Date &validFrom)
EquityReferenceDatum(const std::string &id)
void fromXML(XMLNode *node) override
void setEquityData(const EquityData &equityData)
XMLNode * toXML(ore::data::XMLDocument &doc) const override
static constexpr const char * TYPE
const EquityData & equityData() const
EquityReferenceDatum(const std::string &id, const QuantLib::Date &validFrom, const EquityData &equityData)
EquityReferenceDatum(const std::string &id, const EquityData &equityData)
Base class for indices - lets see if we can keep this, they might diverge too much....
const map< string, double > underlyings() const
std::map< std::string, double > data_
void fromXML(XMLNode *node) override
void addUnderlying(const string &name, double weight)
XMLNode * toXML(ore::data::XMLDocument &doc) const override
IndexReferenceDatum(const string &type, const string &id, const QuantLib::Date &validFrom)
void setUnderlyings(const std::map< string, double > &data)
IndexReferenceDatum(const string &type, const string &id)
Serializable object holding leg data.
Definition: legdata.hpp:844
void fromXML(XMLNode *node) override
XMLNode * toXML(ore::data::XMLDocument &doc) const override
static constexpr const char * TYPE
vector< QuantLib::ext::shared_ptr< Trade > > tradecomponents_
PortfolioBasketReferenceDatum(const string &id, const QuantLib::Date &validFrom)
const vector< QuantLib::ext::shared_ptr< Trade > > & getTrades() const
Interface for Reference Data lookups.
virtual QuantLib::ext::shared_ptr< ReferenceDatum > getData(const string &type, const string &id, const QuantLib::Date &asof=QuantLib::Null< QuantLib::Date >())=0
virtual bool hasData(const string &type, const string &id, const QuantLib::Date &asof=QuantLib::Null< QuantLib::Date >())=0
virtual void add(const QuantLib::ext::shared_ptr< ReferenceDatum > &referenceDatum)=0
Base class for reference data.
ReferenceDatum(const std::string &type, const std::string &id)
Base class constructor.
const std::string & id() const
const std::string & type() const
getters
void setId(const string &id)
void fromXML(XMLNode *node) override
void setValidFrom(const QuantLib::Date &validFrom)
ReferenceDatum()
Default Constructor.
XMLNode * toXML(ore::data::XMLDocument &doc) const override
const QuantLib::Date & validFrom() const
void setType(const string &type)
setters
ReferenceDatum(const std::string &type, const std::string &id, const QuantLib::Date &validFrom)
Base class constructor.
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
void fromFile(const std::string &filename)
Definition: xmlutils.cpp:150
leg data model and serialization
@ data
Definition: log.hpp:77
bool operator<(const Dividend &d1, const Dividend &d2)
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Reference data model and serialization.
void fromXML(XMLNode *node) override
XMLNode * toXML(ore::data::XMLDocument &doc) const override
string name
base trade data model and serialization
underlying data model
XML utility functions.