19#include <boost/test/unit_test.hpp>
20#include <oret/toplevelfixture.hpp>
24#include <ql/currencies/europe.hpp>
27using namespace boost::unit_test_framework;
36 ScheduleRules(
"2019-10-02",
"2024-12-20",
"3M",
"WeekendsOnly",
"Following",
"Unadjusted",
"CDS2015"));
38 auto fixedLegData = QuantLib::ext::make_shared<FixedLegData>(vector<Real>(1, 0.01));
40 return LegData(fixedLegData,
true,
"EUR", scheduleData,
"A360", vector<Real>(1, 1000000), vector<string>(),
46BOOST_FIXTURE_TEST_SUITE(OREDataTestSuite, ore::test::TopLevelFixture)
48BOOST_AUTO_TEST_SUITE(CdsReferenceInformationTests)
52 BOOST_TEST_MESSAGE(
"Testing toXML and fromXml for CdsReferenceInformation");
55 string referenceEntityId =
"RED:2H6677";
57 Currency currency = EURCurrency();
62 string expId = referenceEntityId +
"|" +
to_string(tier) +
"|" + currency.code() +
"|" +
to_string(docClause);
63 BOOST_CHECK_EQUAL(inRef.
id(), expId);
74 BOOST_CHECK_EQUAL(inRef.
tier(), outRef.
tier());
77 BOOST_CHECK_EQUAL(inRef.
id(), outRef.
id());
80BOOST_AUTO_TEST_SUITE_END()
82BOOST_AUTO_TEST_SUITE(CreditDefaultSwapDataTests)
87 string cdsCurveId =
"RED:2H6677|SNRFOR|EUR|MM14";
91 BOOST_CHECK_EQUAL(cdsData.
issuerId(),
"DB");
93 BOOST_CHECK_EQUAL(cdsData.
protectionPaymentTime(), QuantExt::CreditDefaultSwap::ProtectionPaymentTime::atDefault);
96 BOOST_CHECK_EQUAL(cdsData.
upfrontFee(), Null<Real>());
129 string referenceEntityId =
"RED:2H6677";
130 CdsTier tier = CdsTier::SNRFOR;
131 Currency currency = EURCurrency();
139 BOOST_CHECK_EQUAL(cdsData.
issuerId(),
"DB");
141 BOOST_CHECK_EQUAL(cdsData.
protectionPaymentTime(), QuantExt::CreditDefaultSwap::ProtectionPaymentTime::atDefault);
144 BOOST_CHECK_EQUAL(cdsData.
upfrontFee(), Null<Real>());
145 BOOST_CHECK_EQUAL(cdsData.
recoveryRate(), Null<Real>());
182BOOST_AUTO_TEST_SUITE_END()
184BOOST_AUTO_TEST_SUITE_END()
const Date & upfrontDate() const
const string & issuerId() const
QuantLib::Real recoveryRate() const
const boost::optional< CdsReferenceInformation > & referenceInformation() const
const std::string & referenceObligation() const
CDS Reference Obligation.
bool settlesAccrual() const
PPT protectionPaymentTime() const
const string & creditCurveId() const
const Date & protectionStart() const
Serializable object holding leg data.
Serializable schedule data.
Serializable object holding schedule Rules data.
std::string toXMLString() const
Parse from XML string.
void fromXMLString(const std::string &xml)
Parse from XML string.
A class to hold credit default swap data.
CdsDocClause
CDS documentation clause enumeration.
CdsTier
CDS debt tier enumeration.
std::string to_string(const LocationInfo &l)
BOOST_AUTO_TEST_CASE(testToFromXml)
string conversion utilities