Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OREAnalytics/orea/app/inputparameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ class InputParameters : public QuantLib::ext::enable_shared_from_this<InputParam
void setKvaTheirCvaRiskWeight(Real r) { parameters_.set("xva", "kvaTheirCvaRiskWeight", r); }
void setfirstMporCollateralAdjustment(const bool constantInitialVm) { parameters_.set("xva", "firstMporCollateralAdjustment", constantInitialVm); }
// credit simulation
void setCreditMigrationAnalytic(bool b) { parameters_.set("xva", "kvaTheirCvaRiskWeight", b); }
void setCreditMigrationAnalytic(bool b) { parameters_.set("xva", "creditMigration", b); }
void setCreditMigrationDistributionGrid(const std::vector<Real>& grid) { parameters_.set("xva", "creditMigrationDistributionGrid", grid); }
void setCreditSimulationParameters(const QuantLib::ext::shared_ptr<CreditSimulationParameters>& c) { parameters_.set("xva", "creditMigrationConfig", c); }
void setCreditSimulationParametersFromBuffer(const std::string& xml ) { parameters_.set("xva", "creditMigrationConfig", xml); }
Expand Down
1 change: 1 addition & 0 deletions OREAnalytics/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(OREAnalytics-Test_SRC aggregationscenariodata.cpp
amcbermudanswaption.cpp
cube.cpp
historicalscenariogenerator.cpp
inputparameters.cpp
nettedexpsoure.cpp
observationmode.cpp
parsensitivityanalysis.cpp
Expand Down
51 changes: 51 additions & 0 deletions OREAnalytics/test/inputparameters.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
Copyright (C) 2026 Quaternion Risk Management Ltd
All rights reserved.

This file is part of ORE, a free-software/open-source library
for transparent pricing and risk analysis - http://opensourcerisk.org

ORE is free software: you can redistribute it and/or modify it
under the terms of the Modified BSD License. You should have received a
copy of the license along with this program.
The license is also available online at <http://opensourcerisk.org>

This program is distributed on the basis that it will form a useful
contribution to risk analytics and model standardisation, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
*/

#include <boost/test/unit_test.hpp>
#include <test/oreatoplevelfixture.hpp>

#include <orea/app/inputparameters.hpp>
#include <ored/utilities/parsers.hpp>

using namespace ore::analytics;
using namespace ore::data;
using namespace boost::unit_test_framework;

BOOST_FIXTURE_TEST_SUITE(OREAnalyticsTestSuite, ore::test::OreaTopLevelFixture)

BOOST_AUTO_TEST_SUITE(InputParametersTest)

BOOST_AUTO_TEST_CASE(testCreditMigrationAnalyticSetter) {
BOOST_TEST_MESSAGE("Testing that setCreditMigrationAnalytic sets the creditMigration flag and nothing else");

auto inputs = QuantLib::ext::make_shared<InputParameters>();
inputs->setCreditMigrationAnalytic(true);

bool creditMigration = false;
BOOST_CHECK(inputs->loadParameter<bool>(creditMigration, "xva", "creditMigration", false, parseBool));
BOOST_CHECK(creditMigration);

QuantLib::Real riskWeight = 0.05;
BOOST_CHECK_NO_THROW(
inputs->loadParameter<QuantLib::Real>(riskWeight, "xva", "kvaTheirCvaRiskWeight", false, parseReal));
BOOST_CHECK_EQUAL(riskWeight, 0.05);
}

BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE_END()