Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
convertiblebonddata.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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 convertiblebonddata.hpp
20 \brief convertible bond data model and serialization
21 \ingroup portfolio
22*/
23
24#pragma once
25
30
31namespace ore {
32namespace data {
33
35
37public:
38 // 1 Callability Data
39
41 public:
42 // 1.1 Make Whole Data
43
45 public:
46 // 1.1.1 Conversion Ratio Increase Data
47
49 public:
51 bool initialised() const { return initialised_; }
52
53 const std::string& cap() const { return cap_; }
54 const std::vector<double>& stockPrices() const { return stockPrices_; }
55 const std::vector<std::vector<double>>& crIncrease() const { return crIncrease_; }
56 const std::vector<std::string>& crIncreaseDates() const { return crIncreaseDates_; }
57
58 void fromXML(ore::data::XMLNode* node) override;
60
61 private:
63 std::string cap_;
64 std::vector<double> stockPrices_;
65 std::vector<std::vector<double>> crIncrease_;
66 std::vector<std::string> crIncreaseDates_;
67 };
68
70 bool initialised() const { return initialised_; }
71
74 }
75
76 void fromXML(ore::data::XMLNode* node) override;
78
79 private:
81
83 };
84
85 // Callability Data
86
87 explicit CallabilityData(const std::string& nodeName) : initialised_(false), nodeName_(nodeName) {}
88
89 bool initialised() const { return initialised_; }
90
91 const ScheduleData& dates() const { return dates_; }
92
93 const std::vector<std::string>& styles() const { return styles_; }
94 const std::vector<std::string>& styleDates() const { return styleDates_; }
95 const std::vector<double>& prices() const { return prices_; }
96 const std::vector<std::string>& priceDates() const { return priceDates_; }
97 const std::vector<std::string>& priceTypes() const { return priceTypes_; }
98 const std::vector<std::string>& priceTypeDates() const { return priceTypeDates_; }
99 const std::vector<bool>& includeAccrual() const { return includeAccrual_; }
100 const std::vector<std::string>& includeAccrualDates() const { return includeAccrualDates_; }
101 const std::vector<bool>& isSoft() const { return isSoft_; }
102 const std::vector<std::string>& isSoftDates() const { return isSoftDates_; }
103 const std::vector<double>& triggerRatios() const { return triggerRatios_; }
104 const std::vector<std::string>& triggerRatioDates() const { return triggerRatioDates_; }
105 const std::vector<std::string>& nOfMTriggers() const { return nOfMTriggers_; }
106 const std::vector<std::string>& nOfMTriggerDates() const { return nOfMTriggerDates_; }
107 const MakeWholeData& makeWholeData() const { return makeWholeData_; }
108
109 void fromXML(ore::data::XMLNode* node) override;
110 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
111
112 private:
114 std::string nodeName_;
115
117 std::vector<std::string> styles_;
118 std::vector<std::string> styleDates_;
119 std::vector<double> prices_;
120 std::vector<std::string> priceDates_;
121 std::vector<std::string> priceTypes_;
122 std::vector<std::string> priceTypeDates_;
123 std::vector<bool> includeAccrual_;
124 std::vector<std::string> includeAccrualDates_;
125 std::vector<bool> isSoft_;
126 std::vector<std::string> isSoftDates_;
127 std::vector<double> triggerRatios_;
128 std::vector<std::string> triggerRatioDates_;
129 std::vector<std::string> nOfMTriggers_;
130 std::vector<std::string> nOfMTriggerDates_;
132 };
133
134 // 2 Conversion Data
135
137 public:
138 // 2.1 Contingent Conversion Data
139
141 public:
143
144 bool initialised() const { return initialised_; }
145
146 const std::vector<std::string>& observations() const { return observations_; }
147 const std::vector<std::string>& observationDates() const { return observationDates_; }
148 const std::vector<double>& barriers() const { return barriers_; }
149 const std::vector<std::string>& barrierDates() const { return barrierDates_; }
150
151 void fromXML(ore::data::XMLNode* node) override;
152 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
153
154 private:
156
157 std::vector<std::string> observations_;
158 std::vector<std::string> observationDates_;
159 std::vector<double> barriers_;
160 std::vector<std::string> barrierDates_;
161 };
162
163 // 2.2 Mandatory Conversion Data
164
166 public:
168 public:
169 PepsData() : initialised_(false) {}
170
171 bool initialised() const { return initialised_; }
172
173 double upperBarrier() const { return upperBarrier_; }
174 double lowerBarrier() const { return lowerBarrier_; }
177
178 void fromXML(ore::data::XMLNode* node) override;
179 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
180
181 private:
183
188 };
189
191
192 bool initialised() const { return initialised_; }
193
194 const std::string& date() const { return date_; }
195 const std::string& type() const { return type_; }
196
197 const PepsData& pepsData() const { return pepsData_; }
198
199 void fromXML(ore::data::XMLNode* node) override;
200 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
201
202 private:
204
205 std::string date_;
206 std::string type_;
207
209 };
210
211 // 2.3 Conversion Reset Data
212
214 public:
216
217 bool initialised() const { return initialised_; }
218
219 const ScheduleData& dates() const { return dates_; }
220 const std::vector<std::string>& references() const { return references_; }
221 const std::vector<std::string>& referenceDates() const { return referenceDates_; }
222 const std::vector<double>& thresholds() const { return thresholds_; }
223 const std::vector<std::string>& thresholdDates() const { return thresholdDates_; }
224 const std::vector<double>& gearings() const { return gearings_; }
225 const std::vector<std::string>& gearingDates() const { return gearingDates_; }
226 const std::vector<double>& floors() const { return floors_; }
227 const std::vector<std::string>& floorDates() const { return floorDates_; }
228 const std::vector<double>& globalFloors() const { return globalFloors_; }
229 const std::vector<std::string>& globalFloorDates() const { return globalFloorDates_; }
230
231 void fromXML(ore::data::XMLNode* node) override;
232 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
233
234 private:
236
238 std::vector<std::string> references_;
239 std::vector<std::string> referenceDates_;
240 std::vector<double> thresholds_;
241 std::vector<std::string> thresholdDates_;
242 std::vector<double> gearings_;
243 std::vector<std::string> gearingDates_;
244 std::vector<double> floors_;
245 std::vector<std::string> floorDates_;
246 std::vector<double> globalFloors_;
247 std::vector<std::string> globalFloorDates_;
248 };
249
250 // 2.4 Exchangeable Data
251
253 public:
255
256 bool initialised() const { return initialised_; }
257
258 bool isExchangeable() const { return isExchangeable_; }
259 const std::string& equityCreditCurve() const { return equityCreditCurve_; }
261 bool secured() const { return secured_; }
262
263 void fromXML(ore::data::XMLNode* node) override;
264 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
265
266 private:
268
272 };
273
274 // 2.5 Fixed Amount Conversion Data
275
277 public:
279
280 bool initialised() const { return initialised_; }
281
282 const std::string& currency() const { return currency_; }
283
284 const std::vector<double>& amounts() const { return amounts_; }
285 const std::vector<std::string>& amountDates() const { return amountDates_; }
286
287 void fromXML(ore::data::XMLNode* node) override;
288 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
289
290 private:
292
293 std::string currency_;
294 std::vector<double> amounts_;
295 std::vector<std::string> amountDates_;
296 };
297
298 // Conversion Data
299
301
302 bool initialised() const { return initialised_; }
303
304 const ScheduleData& dates() const { return dates_; }
305 const std::vector<std::string>& styles() const { return styles_; }
306 const std::vector<std::string>& styleDates() const { return styleDates_; }
307 const std::vector<double>& conversionRatios() const { return conversionRatios_; }
308 const std::vector<std::string>& conversionRatioDates() const { return conversionRatioDates_; }
309
314 const std::string fxIndex() const { return fxIndex_; }
318
319 void fromXML(ore::data::XMLNode* node) override;
320 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
321
322 private:
324
326 std::vector<std::string> styles_;
327 std::vector<std::string> styleDates_;
328 std::vector<double> conversionRatios_;
329 std::vector<std::string> conversionRatioDates_;
330
335 std::string fxIndex_;
338 };
339
340 // 3 Dividend Protection Data
341
343 public:
345
346 bool initialised() const { return initialised_; }
347
348 const ScheduleData& dates() const { return dates_; }
349 const std::vector<std::string>& adjustmentStyles() const { return adjustmentStyles_; }
350 const std::vector<std::string>& adjustmentStyleDates() const { return adjustmentStyleDates_; }
351 const std::vector<std::string>& dividendTypes() const { return dividendTypes_; }
352 const std::vector<std::string>& dividendTypeDates() const { return dividendTypeDates_; }
353 const std::vector<double>& thresholds() const { return thresholds_; }
354 const std::vector<std::string>& thresholdDates() const { return thresholdDates_; }
355
356 void fromXML(ore::data::XMLNode* node) override;
357 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
358
359 private:
361
363 std::vector<std::string> adjustmentStyles_;
364 std::vector<std::string> adjustmentStyleDates_;
365 std::vector<std::string> dividendTypes_;
366 std::vector<std::string> dividendTypeDates_;
367 std::vector<double> thresholds_;
368 std::vector<std::string> thresholdDates_;
369 };
370
371 // Convertible Bond Data
372
375
376 const ore::data::BondData& bondData() const { return bondData_; }
377
378 const CallabilityData& callData() const { return callData_; }
379 const CallabilityData& putData() const { return putData_; }
383 std::string detachable() const { return detachable_; }
384
385 void fromXML(ore::data::XMLNode* node) override;
386 ore::data::XMLNode* toXML(ore::data::XMLDocument& doc) const override;
387
388 void populateFromBondReferenceData(const QuantLib::ext::shared_ptr<ore::data::ReferenceDataManager>& referenceData);
389
390private:
396 std::string detachable_;
397};
398
399} // namespace data
400} // namespace ore
Bond trade data model and serialization.
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const ConversionRatioIncreaseData & conversionRatioIncreaseData() const
const std::vector< std::string > & priceTypeDates() const
const std::vector< double > & prices() const
void fromXML(ore::data::XMLNode *node) override
const std::vector< std::string > & nOfMTriggers() const
const std::vector< std::string > & isSoftDates() const
const std::vector< std::string > & nOfMTriggerDates() const
const std::vector< std::string > & styleDates() const
const std::vector< std::string > & includeAccrualDates() const
const std::vector< bool > & includeAccrual() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::vector< std::string > & styles() const
const std::vector< std::string > & priceDates() const
const std::vector< double > & triggerRatios() const
const std::vector< std::string > & triggerRatioDates() const
const std::vector< std::string > & priceTypes() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const ContingentConversionData & contingentConversionData() const
const MandatoryConversionData & mandatoryConversionData() const
void fromXML(ore::data::XMLNode *node) override
const ConversionResetData & conversionResetData() const
const std::vector< std::string > & styleDates() const
const std::vector< double > & conversionRatios() const
const ore::data::EquityUnderlying equityUnderlying() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::vector< std::string > & conversionRatioDates() const
const std::vector< std::string > & styles() const
const ExchangeableData & exchangeableData() const
const FixedAmountConversionData & fixedAmountConversionData() const
const std::vector< std::string > & adjustmentStyles() const
const std::vector< std::string > & thresholdDates() const
const std::vector< std::string > & dividendTypes() const
const std::vector< std::string > & adjustmentStyleDates() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
const std::vector< std::string > & dividendTypeDates() const
const ore::data::BondData & bondData() const
const CallabilityData & putData() const
void fromXML(ore::data::XMLNode *node) override
ConvertibleBondData(const ore::data::BondData &bondData)
const CallabilityData & callData() const
const DividendProtectionData & dividendProtectionData() const
ore::data::XMLNode * toXML(ore::data::XMLDocument &doc) const override
DividendProtectionData dividendProtectionData_
const ConversionData & conversionData() const
void populateFromBondReferenceData(const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > &referenceData)
Serializable schedule data.
Definition: schedule.hpp:202
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
Base class for all serializable classes.
Definition: xmlutils.hpp:101
@ data
Definition: log.hpp:77
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Reference data model and serialization.
trade schedule data model and serialization
underlying data model