228 {
229 DLOG(
"Bond::build() called for trade " <<
id());
230
231
232
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
244
248 "no bond settlement days given, if reference data is used, check if securityId '"
251 QuantLib::ext::shared_ptr<QuantLib::Bond> bond;
252
253 std::string openEndDateStr = builder->modelParameter("OpenEndDateReplacement", {}, false, "");
256 std::vector<Leg> separateLegs;
260 } else {
262 Leg leg;
263 auto configuration = builder->configuration(MarketContext::pricing);
264 auto legBuilder = engineFactory->legBuilder(
bondData_.
coupons()[i].legType());
266 openEndDateReplacement);
267 separateLegs.push_back(leg);
268 }
271 }
272
274 QuantLib::ext::shared_ptr<BondEngineBuilder> bondBuilder = QuantLib::ext::dynamic_pointer_cast<BondEngineBuilder>(builder);
275 QL_REQUIRE(bondBuilder, "No Builder found for Bond: " << id());
279 instrument_.reset(
new VanillaInstrument(bond, mult));
280
282 maturity_ = bond->cashflows().back()->date();
285
287
288
289 legs_ = {bond->cashflows()};
292
293 DLOG(
"Bond::build() finished for trade " <<
id());
294}
const string & securityId() const
bool hasCreditRisk() const
const string & currency() const
const std::vector< LegData > & coupons() const
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
const string & issuerId() const
Inspectors.
const string & referenceCurveId() const
const string & issueDate() const
const string & settlementDays() const
const string & calendar() const
const string & maturityDate() const
const string & creditCurveId() const
Real bondNotional() const
std::vector< bool > legPayers_
std::vector< string > legCurrencies_
std::vector< QuantLib::Leg > legs_
void setSensitivityTemplate(const EngineBuilder &builder)
RequiredFixings requiredFixings_
QuantLib::ext::shared_ptr< InstrumentWrapper > instrument_
std::map< std::string, boost::any > additionalData_
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
#define DLOG(text)
Logging Macro (Level = Debug)
Real currentNotional(const Leg &leg)
Date getOpenEndDateReplacement(const std::string &replacementPeriodStr, const Calendar &calendar)
Leg joinLegs(const std::vector< Leg > &legs)