Constructor.
31 {
32
33 try {
34 const QuantLib::ext::shared_ptr<SecurityConfig>& config =
curveConfigs.securityConfig(spec.securityID());
35
36 string spreadQuote = config->spreadQuote();
37 if (spreadQuote != "" && loader.has(spreadQuote, asof)) {
38 QuantLib::ext::shared_ptr<SecuritySpreadQuote> q =
39 QuantLib::ext::dynamic_pointer_cast<SecuritySpreadQuote>(loader.get(spreadQuote, asof));
40 QL_REQUIRE(q, "Failed to cast " << spreadQuote << " to SecuritySpreadQuote");
42 }
43
44
45 string recoveryQuote = config->recoveryRatesQuote();
46 if (recoveryQuote != "" && loader.has(recoveryQuote, asof)) {
47 QuantLib::ext::shared_ptr<RecoveryRateQuote> q =
48 QuantLib::ext::dynamic_pointer_cast<RecoveryRateQuote>(loader.get(recoveryQuote, asof));
49 QL_REQUIRE(q, "Failed to cast " << recoveryQuote << " to RecoveryRateQuote");
51 }
52
53
54 string cprQuote = config->cprQuote();
55 if (cprQuote != "" && loader.has(cprQuote,asof)) {
56 QuantLib::ext::shared_ptr<CPRQuote> q = QuantLib::ext::dynamic_pointer_cast<CPRQuote>(loader.get(cprQuote, asof));
57 QL_REQUIRE(q, "Failed to cast " << cprQuote << " to CPRQuote");
59 }
60
61
62 string priceQuote = config->priceQuote();
63 if (priceQuote != "" && loader.has(priceQuote,asof)) {
64 QuantLib::ext::shared_ptr<BondPriceQuote> q =
65 QuantLib::ext::dynamic_pointer_cast<BondPriceQuote>(loader.get(priceQuote, asof));
66 QL_REQUIRE(q, "Failed to cast " << priceQuote << " to BondPriceQuote");
68 }
69
70 } catch (std::exception& e) {
71 QL_FAIL("Security building failed for curve " << spec.curveConfigID() << " on date " << io::iso_date(asof)
72 << ": " << e.what());
73 } catch (...) {
74 QL_FAIL("Security building failed: unknown error");
75 }
76
77 return;
78}
Handle< Quote > recoveryRate_
vector< string > curveConfigs