53 {
54
55 BOOST_TEST_MESSAGE("Testing parsing of commodity curve configuration from XML");
56
57
58 string configXml;
59 configXml.append("<CommodityCurve>");
60 configXml.append(" <CurveId>GOLD_USD</CurveId>");
61 configXml.append(" <CurveDescription>Gold USD price curve</CurveDescription>");
62 configXml.append(" <Currency>USD</Currency>");
63 configXml.append(" <SpotQuote>COMMODITY/PRICE/GOLD/USD</SpotQuote>");
64 configXml.append(" <Quotes>");
65 configXml.append(" <Quote>COMMODITY_FWD/PRICE/GOLD/USD/2016-02-29</Quote>");
66 configXml.append(" <Quote>COMMODITY_FWD/PRICE/GOLD/USD/2017-02-28</Quote>");
67 configXml.append(" </Quotes>");
68 configXml.append(" <DayCounter>A365</DayCounter>");
69 configXml.append(" <InterpolationMethod>Linear</InterpolationMethod>");
70 configXml.append(" <Extrapolation>true</Extrapolation>");
71 configXml.append("</CommodityCurve>");
72
73
77
78
81
82
83 vector<string> quotes = {"COMMODITY/PRICE/GOLD/USD", "COMMODITY_FWD/PRICE/GOLD/USD/2016-02-29",
84 "COMMODITY_FWD/PRICE/GOLD/USD/2017-02-28"};
85
86
87 BOOST_CHECK_EQUAL(config.
curveID(),
"GOLD_USD");
89 BOOST_CHECK_EQUAL(config.
currency(),
"USD");
91 BOOST_CHECK_EQUAL_COLLECTIONS(quotes.begin(), quotes.end(), config.
quotes().begin(), config.
quotes().end());
92 BOOST_CHECK_EQUAL(config.
dayCountId(),
"A365");
95}
const std::string & currency() const
void fromXML(XMLNode *node) override
bool extrapolation() const
const std::string & interpolationMethod() const
const std::string & dayCountId() const
const std::string & commoditySpotQuoteId() const
const string & curveDescription() const
const string & curveID() const
virtual const vector< string > & quotes()
Return all the market quotes required for this config.
Small XML Document wrapper class.
void fromXMLString(const string &xmlString)
load a document from a hard-coded string
XMLNode * getFirstNode(const string &name) const