19#include <boost/test/unit_test.hpp>
22#include <oret/toplevelfixture.hpp>
25using namespace boost::unit_test_framework;
29BOOST_FIXTURE_TEST_SUITE(OREDataTestSuite, ore::test::TopLevelFixture)
31BOOST_AUTO_TEST_SUITE(CorrelationCurveConfigTests)
35 BOOST_TEST_MESSAGE(
"Testing parsing of correlation curve configuration from XML");
39 configXml.append(
"<Correlation>");
40 configXml.append(
" <CurveId>EUR-CMS-10Y/EUR-CMS-1Y</CurveId>");
41 configXml.append(
" <CurveDescription>EUR CMS correlations</CurveDescription>");
42 configXml.append(
" <CorrelationType>CMSSpread</CorrelationType>");
43 configXml.append(
" <Currency>EUR</Currency>");
44 configXml.append(
" <Dimension>ATM</Dimension>");
45 configXml.append(
" <QuoteType>PRICE</QuoteType>");
46 configXml.append(
" <Extrapolation>true</Extrapolation>");
47 configXml.append(
" <Conventions>EUR-CMS-10Y-1Y-CONVENTION</Conventions>");
48 configXml.append(
" <SwaptionVolatility>EUR</SwaptionVolatility>");
49 configXml.append(
" <DiscountCurve>EUR-EONIA</DiscountCurve>");
50 configXml.append(
" <Calendar>TARGET</Calendar>");
51 configXml.append(
" <DayCounter>A365</DayCounter>");
52 configXml.append(
" <BusinessDayConvention>Following</BusinessDayConvention>");
53 configXml.append(
" <OptionTenors>1Y,2Y</OptionTenors>");
54 configXml.append(
" <Index1>EUR-CMS-10Y</Index1>");
55 configXml.append(
" <Index2>EUR-CMS-1Y</Index2>");
56 configXml.append(
"</CorrelationCurve>");
68 vector<string> quotes = {
"CORRELATION/PRICE/EUR-CMS-10Y/EUR-CMS-1Y/1Y/ATM",
69 "CORRELATION/PRICE/EUR-CMS-10Y/EUR-CMS-1Y/2Y/ATM"};
72 BOOST_CHECK_EQUAL(config.
curveID(),
"EUR-CMS-10Y/EUR-CMS-1Y");
74 BOOST_CHECK_EQUAL(config.
index1(),
"EUR-CMS-10Y");
75 BOOST_CHECK_EQUAL(config.
index2(),
"EUR-CMS-1Y");
76 BOOST_CHECK_EQUAL_COLLECTIONS(quotes.begin(), quotes.end(), config.
quotes().begin(), config.
quotes().end());
78 BOOST_CHECK_EQUAL(config.
conventions(),
"EUR-CMS-10Y-1Y-CONVENTION");
81 BOOST_CHECK_EQUAL(config.
dayCounter().name(),
"Actual/365 (Fixed)");
82 BOOST_CHECK_EQUAL(config.
calendar().name(),
"TARGET");
94 BOOST_TEST_MESSAGE(
"Testing parsing of correlation curve configuration from XML");
98 configXml.append(
"<Correlation>");
99 configXml.append(
" <CurveId>EUR-CMS-10Y/EUR-CMS-1Y</CurveId>");
100 configXml.append(
" <CurveDescription>EUR CMS correlations</CurveDescription>");
101 configXml.append(
" <CorrelationType>Generic</CorrelationType>");
102 configXml.append(
" <Dimension>ATM</Dimension>");
103 configXml.append(
" <QuoteType>RATE</QuoteType>");
104 configXml.append(
" <Extrapolation>true</Extrapolation>");
105 configXml.append(
" <Calendar>TARGET</Calendar>");
106 configXml.append(
" <DayCounter>A365</DayCounter>");
107 configXml.append(
" <BusinessDayConvention>Following</BusinessDayConvention>");
108 configXml.append(
" <OptionTenors>1Y,2Y</OptionTenors>");
109 configXml.append(
" <Index1/>");
110 configXml.append(
" <Index2/>");
111 configXml.append(
" <Currency/>");
112 configXml.append(
"</CorrelationCurve>");
124 BOOST_CHECK_EQUAL(config.
curveID(),
"EUR-CMS-10Y/EUR-CMS-1Y");
128 BOOST_CHECK_EQUAL(config.
dayCounter().name(),
"Actual/365 (Fixed)");
129 BOOST_CHECK_EQUAL(config.
calendar().name(),
"TARGET");
141 BOOST_TEST_MESSAGE(
"Testing parsing of correlation curve configuration from XML");
145 configXml.append(
"<Correlation>");
146 configXml.append(
" <CurveId>EUR-CMS-10Y/EUR-CMS-1Y</CurveId>");
147 configXml.append(
" <CurveDescription>EUR CMS correlations</CurveDescription>");
148 configXml.append(
" <CorrelationType>Generic</CorrelationType>");
149 configXml.append(
" <QuoteType>NULL</QuoteType>");
150 configXml.append(
" <Dimension/>");
151 configXml.append(
" <Extrapolation/>");
152 configXml.append(
" <Calendar>TARGET</Calendar>");
153 configXml.append(
" <DayCounter>A365</DayCounter>");
154 configXml.append(
" <BusinessDayConvention/>");
155 configXml.append(
" <OptionTenors/>");
156 configXml.append(
" <Index1/>");
157 configXml.append(
" <Index2/>");
158 configXml.append(
" <Currency/>");
159 configXml.append(
"</CorrelationCurve>");
171 BOOST_CHECK_EQUAL(config.
curveID(),
"EUR-CMS-10Y/EUR-CMS-1Y");
174 BOOST_CHECK_EQUAL(config.
dayCounter().name(),
"Actual/365 (Fixed)");
175 BOOST_CHECK_EQUAL(config.
calendar().name(),
"TARGET");
177BOOST_AUTO_TEST_SUITE_END()
179BOOST_AUTO_TEST_SUITE_END()
Correlation curve configuration.
const string & swaptionVolatility() const
const vector< string > & optionTenors() const
const string & index1() const
const bool & extrapolate() const
const DayCounter & dayCounter() const
const Calendar & calendar() const
void fromXML(XMLNode *node) override
const vector< string > & quotes() override
Return all the market quotes required for this config.
const string & conventions() const
const string & discountCurve() const
const string & index2() const
const BusinessDayConvention & businessDayConvention() const
const string & curveDescription() const
const string & curveID() const
Small XML Document wrapper class.
void fromXMLString(const string &xmlString)
load a document from a hard-coded string
XMLNode * getFirstNode(const string &name) const
Map text representations to QuantLib/QuantExt types.
BOOST_AUTO_TEST_CASE(testParseCMSSpreadPriceQuoteCorrelationFromXml)