Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
bond.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 Quaternion Risk Management Ltd
3 Copyright (C) 2017 Aareal Bank AG
4
5 All rights reserved.
6
7 This file is part of ORE, a free-software/open-source library
8 for transparent pricing and risk analysis - http://opensourcerisk.org
9
10 ORE is free software: you can redistribute it and/or modify it
11 under the terms of the Modified BSD License. You should have received a
12 copy of the license along with this program.
13 The license is also available online at <http://opensourcerisk.org>
14
15 This program is distributed on the basis that it will form a useful
16 contribution to risk analytics and model standardisation, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21#include <boost/algorithm/string/join.hpp>
22#include <boost/lexical_cast.hpp>
33#include <ql/cashflows/cpicoupon.hpp>
34#include <ql/cashflows/simplecashflow.hpp>
35#include <ql/instruments/bond.hpp>
36#include <ql/instruments/bonds/zerocouponbond.hpp>
38
39using namespace QuantLib;
40using namespace QuantExt;
41
42namespace ore {
43namespace data {
44
46 return priceQuoteMethod_.empty() ? QuantExt::BondIndex::PriceQuoteMethod::PercentageOfPar
48}
49
51 if (priceQuoteBaseValue_.empty())
52 return 1.0;
53 Real result;
55 return result;
56 QL_FAIL("invalid PriceQuoteBaseValue '" << priceQuoteBaseValue_ << "'");
57}
58
60 XMLUtils::checkNode(node, "BondData");
61 QL_REQUIRE(node, "No BondData Node");
62 subType_ = XMLUtils::getChildValue(node, "SubType", false);
63 issuerId_ = XMLUtils::getChildValue(node, "IssuerId", false);
64 creditCurveId_ = XMLUtils::getChildValue(node, "CreditCurveId", false);
65 creditGroup_ = XMLUtils::getChildValue(node, "CreditGroup", false);
66 securityId_ = XMLUtils::getChildValue(node, "SecurityId", true);
67 referenceCurveId_ = XMLUtils::getChildValue(node, "ReferenceCurveId", false);
68 incomeCurveId_ = XMLUtils::getChildValue(node, "IncomeCurveId", false);
69 volatilityCurveId_ = XMLUtils::getChildValue(node, "VolatilityCurveId", false);
70 settlementDays_ = XMLUtils::getChildValue(node, "SettlementDays", false);
71 calendar_ = XMLUtils::getChildValue(node, "Calendar", false);
72 issueDate_ = XMLUtils::getChildValue(node, "IssueDate", false);
73 priceQuoteMethod_ = XMLUtils::getChildValue(node, "PriceQuoteMethod", false);
74 priceQuoteBaseValue_ = XMLUtils::getChildValue(node, "PriceQuoteBaseValue", false);
75 if (auto n = XMLUtils::getChildNode(node, "BondNotional")) {
77 } else {
78 bondNotional_ = 1.0;
79 }
80 XMLNode* legNode = XMLUtils::getChildNode(node, "LegData");
81 isInflationLinked_ = false;
82 while (legNode != nullptr) {
83 LegData ld;
84 ld.fromXML(legNode);
85 coupons_.push_back(ld);
86 if (ld.concreteLegData()->legType() == "CPI") {
87 isInflationLinked_ = true;
88 }
89 legNode = XMLUtils::getNextSibling(legNode, "LegData");
90 }
91 hasCreditRisk_ = XMLUtils::getChildValueAsBool(node, "CreditRisk", false, true);
92 initialise();
93}
94
96 XMLNode* bondNode = doc.allocNode("BondData");
97 if (!subType_.empty())
98 XMLUtils::addChild(doc, bondNode, "SubType", subType_);
99 if (!issuerId_.empty())
100 XMLUtils::addChild(doc, bondNode, "IssuerId", issuerId_);
101 if (!creditCurveId_.empty())
102 XMLUtils::addChild(doc, bondNode, "CreditCurveId", creditCurveId_);
103 if (!creditGroup_.empty())
104 XMLUtils::addChild(doc, bondNode, "CreditGroup", creditGroup_);
105 XMLUtils::addChild(doc, bondNode, "SecurityId", securityId_);
106 if (!referenceCurveId_.empty())
107 XMLUtils::addChild(doc, bondNode, "ReferenceCurveId", referenceCurveId_);
108 if (!incomeCurveId_.empty())
109 XMLUtils::addChild(doc, bondNode, "IncomeCurveId", incomeCurveId_);
110 if (!volatilityCurveId_.empty())
111 XMLUtils::addChild(doc, bondNode, "VolatilityCurveId", volatilityCurveId_);
112 if (!settlementDays_.empty())
113 XMLUtils::addChild(doc, bondNode, "SettlementDays", settlementDays_);
114 if (!calendar_.empty())
115 XMLUtils::addChild(doc, bondNode, "Calendar", calendar_);
116 if (!issueDate_.empty())
117 XMLUtils::addChild(doc, bondNode, "IssueDate", issueDate_);
118 if(!priceQuoteMethod_.empty())
119 XMLUtils::addChild(doc, bondNode, "PriceQuoteMethod", priceQuoteMethod_);
120 if(!priceQuoteBaseValue_.empty())
121 XMLUtils::addChild(doc, bondNode, "PriceQuoteBaseValue", priceQuoteBaseValue_);
122 XMLUtils::addChild(doc, bondNode, "BondNotional", bondNotional_);
123 for (auto& c : coupons_)
124 XMLUtils::appendNode(bondNode, c.toXML(doc));
125 if (!hasCreditRisk_)
126 XMLUtils::addChild(doc, bondNode, "CreditRisk", hasCreditRisk_);
127 return bondNode;
128}
129
131
132 isPayer_ = false;
133 isInflationLinked_ = false;
134
135 if (!zeroBond()) {
136
137 // fill currency, if not directly given (which is only the case for zero bonds)
138
139 for (Size i = 0; i < coupons().size(); ++i) {
140 if (i == 0)
141 currency_ = coupons()[i].currency();
142 else {
143 QL_REQUIRE(currency_ == coupons()[i].currency(),
144 "bond leg #" << i << " currency (" << coupons()[i].currency()
145 << ") not equal to leg #0 currency (" << coupons()[0].currency());
146 }
147 }
148
149 // fill isPayer, FIXME zero bonds are always long
150
151 for (Size i = 0; i < coupons().size(); ++i) {
152 if (i == 0)
153 isPayer_ = coupons()[i].isPayer();
154 else {
155 QL_REQUIRE(isPayer_ == coupons()[i].isPayer(),
156 "bond leg #" << i << " isPayer (" << std::boolalpha << coupons()[i].isPayer()
157 << ") not equal to leg #0 isPayer (" << coupons()[0].isPayer());
158 }
159 }
160
161 // fill isInflationLinked
162 for (Size i = 0; i < coupons().size(); ++i) {
163 if (i == 0)
164 isInflationLinked_ = coupons()[i].concreteLegData()->legType() == "CPI";
165 else {
166 bool isIthCouponInflationLinked = coupons()[i].concreteLegData()->legType() == "CPI";
167 QL_REQUIRE(isInflationLinked_ == isIthCouponInflationLinked,
168 "bond leg #" << i << " isInflationLinked (" << std::boolalpha << isIthCouponInflationLinked
169 << ") not equal to leg #0 isInflationLinked (" << isInflationLinked_);
170 }
171 }
172 }
173}
174
175void BondData::populateFromBondReferenceData(const QuantLib::ext::shared_ptr<BondReferenceDatum>& referenceDatum,
176 const std::string& startDate, const std::string& endDate) {
177 DLOG("Got BondReferenceDatum for name " << securityId_ << " overwrite empty elements in trade");
181 startDate, endDate);
182 initialise();
183 checkData();
184}
185
186void BondData::populateFromBondReferenceData(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceData,
187 const std::string& startDate, const std::string& endDate) {
188 QL_REQUIRE(!securityId_.empty(), "BondData::populateFromBondReferenceData(): no security id given");
189 if (!referenceData || !referenceData->hasData(BondReferenceDatum::TYPE, securityId_)) {
190 DLOG("could not get BondReferenceDatum for name " << securityId_ << " leave data in trade unchanged");
191 initialise();
192 checkData();
193 } else {
194 auto bondRefData = QuantLib::ext::dynamic_pointer_cast<BondReferenceDatum>(
195 referenceData->getData(BondReferenceDatum::TYPE, securityId_));
196 QL_REQUIRE(bondRefData, "could not cast to BondReferenceDatum, this is unexpected");
197 populateFromBondReferenceData(bondRefData, startDate, endDate);
198 }
199}
200
202 QL_REQUIRE(!securityId_.empty(), "BondData invalid: no security id given");
203 std::vector<std::string> missingElements;
204 if (settlementDays_.empty())
205 missingElements.push_back("SettlementDays");
206 if (currency_.empty())
207 missingElements.push_back("Currency");
208 QL_REQUIRE(missingElements.empty(), "BondData invalid: missing " + boost::algorithm::join(missingElements, ", ") +
209 " - check if reference data is set up for '"
210 << securityId_ << "'");
211}
212
213std::string BondData::isdaBaseProduct() const {
214 static const std::set<std::string> singleName = {"ABS", "Corporate", "Loans", "Muni", "Sovereign"};
215 static const std::set<std::string> index = {"ABX", "CMBX", "MBX", "PrimeX", "TRX", "iBoxx"};
216 if (singleName.find(subType()) != singleName.end()) {
217 return "Single Name";
218 } else if (index.find(subType()) != index.end()) {
219 return "Index";
220 } else {
221 QL_FAIL("BondData::isdaBaseProduct() not defined for subType '"
222 << subType() << "', expected: "
223 << boost::algorithm::join(singleName, ", ") + " (map to 'Single Name') " +
224 boost::algorithm::join(index, ", ") + " (map to 'Index')");
225 }
226}
227
228void Bond::build(const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory) {
229 DLOG("Bond::build() called for trade " << id());
230
231 // ISDA taxonomy: not a derivative, but define the asset class at least
232 // so that we can determine a TRS asset class that has Bond underlyings
233 additionalData_["isdaAssetClass"] = string("Credit");
234 additionalData_["isdaBaseProduct"] = string("");
235 additionalData_["isdaSubProduct"] = string("");
236 additionalData_["isdaTransaction"] = string("");
237
238 const QuantLib::ext::shared_ptr<Market> market = engineFactory->market();
239 QuantLib::ext::shared_ptr<EngineBuilder> builder = engineFactory->builder("Bond");
240 QL_REQUIRE(builder, "Bond::build(): internal error, builder is null");
241
243 bondData_.populateFromBondReferenceData(engineFactory->referenceData());
244
245 Date issueDate = parseDate(bondData_.issueDate());
247 QL_REQUIRE(!bondData_.settlementDays().empty(),
248 "no bond settlement days given, if reference data is used, check if securityId '"
249 << bondData_.securityId() << "' is present and of type Bond.");
250 Natural settlementDays = parseInteger(bondData_.settlementDays());
251 QuantLib::ext::shared_ptr<QuantLib::Bond> bond;
252
253 std::string openEndDateStr = builder->modelParameter("OpenEndDateReplacement", {}, false, "");
254 Date openEndDateReplacement = getOpenEndDateReplacement(openEndDateStr, calendar);
255 Real mult = bondData_.bondNotional() * (bondData_.isPayer() ? -1.0 : 1.0);
256 std::vector<Leg> separateLegs;
257 if (bondData_.zeroBond()) { // Zero coupon bond
258 bond.reset(new QuantLib::ZeroCouponBond(settlementDays, calendar, bondData_.faceAmount(),
260 } else { // Coupon bond
261 for (Size i = 0; i < bondData_.coupons().size(); ++i) {
262 Leg leg;
263 auto configuration = builder->configuration(MarketContext::pricing);
264 auto legBuilder = engineFactory->legBuilder(bondData_.coupons()[i].legType());
265 leg = legBuilder->buildLeg(bondData_.coupons()[i], engineFactory, requiredFixings_, configuration,
266 openEndDateReplacement);
267 separateLegs.push_back(leg);
268 } // for coupons_
269 Leg leg = joinLegs(separateLegs);
270 bond.reset(new QuantLib::Bond(settlementDays, calendar, issueDate, leg));
271 }
272
273 Currency currency = parseCurrency(bondData_.currency());
274 QuantLib::ext::shared_ptr<BondEngineBuilder> bondBuilder = QuantLib::ext::dynamic_pointer_cast<BondEngineBuilder>(builder);
275 QL_REQUIRE(bondBuilder, "No Builder found for Bond: " << id());
276 bond->setPricingEngine(bondBuilder->engine(currency, bondData_.creditCurveId(), bondData_.hasCreditRisk(),
278 setSensitivityTemplate(*bondBuilder);
279 instrument_.reset(new VanillaInstrument(bond, mult));
280
282 maturity_ = bond->cashflows().back()->date();
283 notional_ = currentNotional(bond->cashflows());
285
287
288 // Add legs (only 1)
289 legs_ = {bond->cashflows()};
292
293 DLOG("Bond::build() finished for trade " << id());
294}
295
297 Trade::fromXML(node);
298 originalBondData_.fromXML(XMLUtils::getChildNode(node, "BondData"));
300}
301
303 XMLNode* node = Trade::toXML(doc);
304 XMLUtils::appendNode(node, originalBondData_.toXML(doc));
305 return node;
306}
307
308std::map<AssetClass, std::set<std::string>>
309Bond::underlyingIndices(const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceDataManager) const {
310 std::map<AssetClass, std::set<std::string>> result;
311 result[AssetClass::BOND] = {bondData_.securityId()};
312 return result;
313}
314
316 if (!isInflationLinked) {
317 return 1.0;
318 } else {
319 QL_REQUIRE(bond, "need to set the bond before calling inflationFactor()");
320 double factor = 1.0;
321 try {
323 } catch (const std::exception& e) {
324 ALOG("Failed to compute the inflation price factor for the bond "
325 << securityId << ", fallback to use factor 1, got " << e.what());
326 }
327 return factor;
328 }
329}
330
331BondBuilder::Result BondFactory::build(const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
332 const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceData,
333 const std::string& securityId) const {
334 boost::shared_lock<boost::shared_mutex> lock(mutex_);
335 for (auto const& b : builders_) {
336 if (referenceData->hasData(b.first, securityId)) {
337 auto tmp = b.second->build(engineFactory, referenceData, securityId);
338 tmp.builderLabel = b.first;
339 return tmp;
340 }
341 }
342
343 QL_FAIL("BondFactory: could not build bond '"
344 << securityId
345 << "': no reference data given or no suitable builder registered. Check if bond is set up in the reference "
346 "data and that there is a builder for the reference data type.");
347}
348
349void BondFactory::addBuilder(const std::string& referenceDataType, const QuantLib::ext::shared_ptr<BondBuilder>& builder,
350 const bool allowOverwrite) {
351 boost::unique_lock<boost::shared_mutex> lock(mutex_);
352 QL_REQUIRE(builders_.insert(std::make_pair(referenceDataType, builder)).second || allowOverwrite,
353 "BondFactory::addBuilder(" << referenceDataType << "): builder for key already exists.");
354}
355
356BondBuilder::Result VanillaBondBuilder::build(const QuantLib::ext::shared_ptr<EngineFactory>& engineFactory,
357 const QuantLib::ext::shared_ptr<ReferenceDataManager>& referenceData,
358 const std::string& securityId) const {
359 BondData data(securityId, 1.0);
360 data.populateFromBondReferenceData(referenceData);
362 bond.id() = "VanillaBondBuilder_" + securityId;
363 bond.build(engineFactory);
364
365 QL_REQUIRE(bond.instrument(), "VanillaBondBuilder: constructed bond is null, this is unexpected");
366 auto qlBond = QuantLib::ext::dynamic_pointer_cast<QuantLib::Bond>(bond.instrument()->qlInstrument());
367
368 QL_REQUIRE(bond.instrument() && bond.instrument()->qlInstrument(),
369 "VanillaBondBuilder: constructed bond trade does not provide a valid ql instrument, this is unexpected "
370 "(either the instrument wrapper or the ql instrument is null)");
371
372 Result res;
373 res.bond = qlBond;
374
375 if (data.isInflationLinked()) {
376 res.isInflationLinked = true;
377 }
378 res.hasCreditRisk = data.hasCreditRisk() && !data.creditCurveId().empty();
379 res.currency = data.currency();
380 res.creditCurveId = data.creditCurveId();
381 res.securityId = data.securityId();
382 res.creditGroup = data.creditGroup();
383 res.priceQuoteMethod = data.priceQuoteMethod();
384 res.priceQuoteBaseValue = data.priceQuoteBaseValue();
385 return res;
386}
387
388} // namespace data
389} // namespace ore
Bond trade data model and serialization.
bond utilities
builder that returns an engine to price a bond instrument
const string & securityId() const
Definition: bond.hpp:84
std::vector< LegData > coupons_
Definition: bond.hpp:137
std::string isdaBaseProduct() const
return isda sub type "Single Name", "Index" or throw if sub type can not be mapped
Definition: bond.cpp:213
bool hasCreditRisk() const
Definition: bond.hpp:96
bool zeroBond() const
Definition: bond.hpp:98
const string & currency() const
Definition: bond.hpp:94
Real faceAmount() const
Definition: bond.hpp:101
const string & subType() const
Definition: bond.hpp:103
string volatilityCurveId_
Definition: bond.hpp:131
void initialise()
Definition: bond.cpp:130
string priceQuoteBaseValue_
Definition: bond.hpp:136
Real priceQuoteBaseValue() const
Definition: bond.cpp:50
const std::vector< LegData > & coupons() const
Definition: bond.hpp:93
void populateFromBondReferenceData(const QuantLib::ext::shared_ptr< BondReferenceDatum > &referenceDatum, const std::string &startDate="", const std::string &endDate="")
populate data from reference datum and check data for completeness
Definition: bond.cpp:175
const string & issuerId() const
Inspectors.
Definition: bond.hpp:81
bool isPayer() const
Definition: bond.hpp:97
string creditCurveId_
Definition: bond.hpp:126
const string & referenceCurveId() const
Definition: bond.hpp:85
const string & issueDate() const
Definition: bond.hpp:90
string issuerId_
Definition: bond.hpp:125
virtual void fromXML(XMLNode *node) override
XMLSerializable interface.
Definition: bond.cpp:59
string issueDate_
Definition: bond.hpp:134
string settlementDays_
Definition: bond.hpp:132
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: bond.cpp:95
const string & settlementDays() const
Definition: bond.hpp:88
string calendar_
Definition: bond.hpp:133
string referenceCurveId_
Definition: bond.hpp:129
const string & calendar() const
Definition: bond.hpp:89
string creditGroup_
Definition: bond.hpp:127
string priceQuoteMethod_
Definition: bond.hpp:135
void checkData() const
check data for completeness
Definition: bond.cpp:201
const string & maturityDate() const
Definition: bond.hpp:102
string currency_
Definition: bond.hpp:141
string securityId_
Definition: bond.hpp:128
QuantExt::BondIndex::PriceQuoteMethod priceQuoteMethod() const
Definition: bond.cpp:45
string incomeCurveId_
Definition: bond.hpp:130
const string & creditCurveId() const
Definition: bond.hpp:82
bool isInflationLinked_
Definition: bond.hpp:145
Real bondNotional() const
Definition: bond.hpp:95
void addBuilder(const std::string &referenceDataType, const QuantLib::ext::shared_ptr< BondBuilder > &builder, const bool allowOverwrite=false)
Definition: bond.cpp:349
BondBuilder::Result build(const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceData, const std::string &securityId) const
Definition: bond.cpp:331
Serializable Bond.
Definition: bond.hpp:153
BondData bondData_
Definition: bond.hpp:177
std::map< AssetClass, std::set< std::string > > underlyingIndices(const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager=nullptr) const override
Add underlying Bond names.
Definition: bond.cpp:309
BondData originalBondData_
Definition: bond.hpp:177
virtual void fromXML(XMLNode *node) override
XMLSerializable interface.
Definition: bond.cpp:296
virtual XMLNode * toXML(XMLDocument &doc) const override
Definition: bond.cpp:302
virtual void build(const QuantLib::ext::shared_ptr< EngineFactory > &) override
Trade interface.
Definition: bond.cpp:228
static constexpr const char * TYPE
Serializable object holding generic trade data, reporting dimensions.
Definition: envelope.hpp:51
Serializable object holding leg data.
Definition: legdata.hpp:844
virtual void fromXML(XMLNode *node) override
Definition: legdata.cpp:759
QuantLib::ext::shared_ptr< LegAdditionalData > concreteLegData() const
Definition: legdata.hpp:891
string npvCurrency_
Definition: trade.hpp:201
std::vector< bool > legPayers_
Definition: trade.hpp:200
std::vector< string > legCurrencies_
Definition: trade.hpp:199
string issuer_
Definition: trade.hpp:205
std::vector< QuantLib::Leg > legs_
Definition: trade.hpp:198
QuantLib::Real notional_
Definition: trade.hpp:202
void setSensitivityTemplate(const EngineBuilder &builder)
Definition: trade.cpp:295
string & id()
Set the trade id.
Definition: trade.hpp:118
RequiredFixings requiredFixings_
Definition: trade.hpp:223
const QuantLib::ext::shared_ptr< InstrumentWrapper > & instrument() const
Definition: trade.hpp:141
QuantLib::ext::shared_ptr< InstrumentWrapper > instrument_
Definition: trade.hpp:197
string notionalCurrency_
Definition: trade.hpp:203
std::map< std::string, boost::any > additionalData_
Definition: trade.hpp:224
Vanilla Instrument Wrapper.
Small XML Document wrapper class.
Definition: xmlutils.hpp:65
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
Definition: xmlutils.cpp:132
static void checkNode(XMLNode *n, const string &expectedName)
Definition: xmlutils.cpp:175
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
Definition: xmlutils.cpp:277
static bool getChildValueAsBool(XMLNode *node, const string &name, bool mandatory=false, bool defaultValue=true)
Definition: xmlutils.cpp:296
static XMLNode * getChildNode(XMLNode *n, const string &name="")
Definition: xmlutils.cpp:387
static string getNodeValue(XMLNode *node)
Get a node's value.
Definition: xmlutils.cpp:489
static XMLNode * getNextSibling(XMLNode *node, const string &name="")
Get a node's next sibling node.
Definition: xmlutils.cpp:484
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
Logic for calculating required fixing dates on legs.
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
bool tryParseReal(const string &s, QuantLib::Real &result)
Attempt to convert text to Real.
Definition: parsers.cpp:126
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Definition: parsers.cpp:51
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Definition: parsers.cpp:290
QuantExt::BondIndex::PriceQuoteMethod parsePriceQuoteMethod(const std::string &s)
Definition: parsers.cpp:1261
Real parseReal(const string &s)
Convert text to Real.
Definition: parsers.cpp:112
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
Map text representations to QuantLib/QuantExt types.
leg data model and serialization
Classes and functions for log message handling.
@ data
Definition: log.hpp:77
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
#define ALOG(text)
Logging Macro (Level = Alert)
Definition: log.hpp:544
Calendar calendar
Definition: utilities.cpp:441
Real inflationLinkedBondQuoteFactor(const boost::shared_ptr< QuantLib::Bond > &bond)
Real currentNotional(const Leg &leg)
Definition: legdata.cpp:2435
Date getOpenEndDateReplacement(const std::string &replacementPeriodStr, const Calendar &calendar)
Definition: bondutils.cpp:118
void populateFromBondReferenceData(std::string &subType, std::string &issuerId, std::string &settlementDays, std::string &calendar, std::string &issueDate, std::string &priceQuoteMethod, string &priceQuoteBaseValue, std::string &creditCurveId, std::string &creditGroup, std::string &referenceCurveId, std::string &incomeCurveId, std::string &volatilityCurveId, std::vector< LegData > &coupons, const std::string &name, const QuantLib::ext::shared_ptr< BondReferenceDatum > &bondRefData, const std::string &startDate, const std::string &endDate)
Populate bond data from name and ReferenceDataManager.
Definition: bondutils.cpp:26
Leg joinLegs(const std::vector< Leg > &legs)
Definition: legdata.cpp:2703
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Map text representations to QuantLib/QuantExt types.
QuantLib::ext::shared_ptr< QuantLib::Bond > bond
Definition: bond.hpp:185
QuantExt::BondIndex::PriceQuoteMethod priceQuoteMethod
Definition: bond.hpp:193
double inflationFactor() const
Definition: bond.cpp:315
virtual Result build(const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceData, const std::string &securityId) const override
Definition: bond.cpp:356
Swap trade data model and serialization.
string conversion utilities