7#include <boost/test/unit_test.hpp>
8#include <boost/test/data/test_case.hpp>
13#include <oret/toplevelfixture.hpp>
15#include <oret/datapaths.hpp>
27BOOST_FIXTURE_TEST_SUITE(OREPlusCreditTestSuite, ore::test::TopLevelFixture)
29BOOST_AUTO_TEST_SUITE(CBOTest)
32 BOOST_TEST_MESSAGE(
"Testing simple CBO...");
34 Settings::instance().evaluationDate() = Date(31, Dec, 2018);
35 Date asof = Settings::instance().evaluationDate();
38 auto conventions = QuantLib::ext::make_shared<Conventions>();
39 conventions->fromFile(TEST_INPUT_FILE(
"conventions.xml"));
40 InstrumentConventions::instance().setConventions(conventions);
42 auto todaysMarketParams = QuantLib::ext::make_shared<TodaysMarketParameters>();
43 todaysMarketParams->fromFile(TEST_INPUT_FILE(
"todaysmarket.xml"));
44 auto curveConfigs = QuantLib::ext::make_shared<CurveConfigurations>();
45 curveConfigs->fromFile(TEST_INPUT_FILE(
"curveconfig.xml"));
46 auto loader = QuantLib::ext::make_shared<CSVLoader>(TEST_INPUT_FILE(
"market.txt"), TEST_INPUT_FILE(
"fixings.txt"),
false);
47 auto market = QuantLib::ext::make_shared<TodaysMarket>(asof, todaysMarketParams, loader,
curveConfigs,
false);
50 QuantLib::ext::shared_ptr<EngineData> engineData = QuantLib::ext::make_shared<EngineData>();
51 engineData->fromFile(TEST_INPUT_FILE(
"pricingengine.xml"));
52 QuantLib::ext::shared_ptr<EngineFactory> factory = QuantLib::ext::make_shared<EngineFactory>(engineData, market);
55 BOOST_CHECK_NO_THROW(p.
fromFile(TEST_INPUT_FILE(
"cbo.xml")));
56 BOOST_CHECK_NO_THROW(p.
build(factory));
59 double expectedNpv = 3013120.939;
60 const Real tol = 0.01;
62 BOOST_CHECK_NO_THROW(p.
get(
"CBO-Constellation")->instrument()->NPV());
63 BOOST_TEST_MESSAGE(p.
get(
"CBO-Constellation")->instrument()->NPV());
64 BOOST_CHECK_CLOSE(p.
get(
"CBO-Constellation")->instrument()->NPV(), expectedNpv, tol);
67BOOST_AUTO_TEST_SUITE_END()
69BOOST_AUTO_TEST_SUITE_END()
collateralized bond obligation data model
void build(const QuantLib::ext::shared_ptr< EngineFactory > &, const std::string &context="unspecified", const bool emitStructuredError=true)
Call build on all trades in the portfolio, the context is included in error messages.
QuantLib::ext::shared_ptr< Trade > get(const std::string &id) const
void fromFile(const std::string &filename)
Market Datum Loader Implementation.
Curve configuration repository.
BOOST_AUTO_TEST_CASE(testSimpleCBO)
vector< string > curveConfigs
An concrete implementation of the Market class that loads todays market and builds the required curve...