Skip to content

Commit

Permalink
Deprecate some experimental code
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Aug 26, 2024
1 parent d8e0f1c commit 9f0c9b9
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 6 deletions.
4 changes: 4 additions & 0 deletions ql/experimental/risk/creditriskplus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ using std::sqrt;

namespace QuantLib {

QL_DEPRECATED_DISABLE_WARNING

CreditRiskPlus::CreditRiskPlus(std::vector<Real> exposure,
std::vector<Real> defaultProbability,
std::vector<Size> sector,
Expand Down Expand Up @@ -233,4 +235,6 @@ namespace QuantLib {
loss_.push_back(res * pC_ / (pdSum_ * ((Real)(n + 1))));
}
}

QL_DEPRECATED_ENABLE_WARNING
}
5 changes: 3 additions & 2 deletions ql/experimental/risk/creditriskplus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ namespace QuantLib {
\warning the input correlation matrix is not checked for positive
definiteness
\deprecated Out of scope; copy this class in your codebase if needed.
Deprecated in version 1.36.
*/

class CreditRiskPlus {
class [[deprecated("Out of scope; copy this class in your codebase if needed")]] CreditRiskPlus {

public:
CreditRiskPlus(std::vector<Real> exposure,
Expand Down
3 changes: 3 additions & 0 deletions ql/experimental/risk/sensitivityanalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ using std::pair;

namespace QuantLib {

QL_DEPRECATED_DISABLE_WARNING

std::ostream& operator<<(std::ostream& out,
SensitivityAnalysis s) {
switch (s) {
Expand Down Expand Up @@ -344,4 +346,5 @@ namespace QuantLib {
return result;
}

QL_DEPRECATED_ENABLE_WARNING
}
50 changes: 46 additions & 4 deletions ql/experimental/risk/sensitivityanalysis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,29 @@ namespace QuantLib {
class Instrument;

//! Finite differences calculation
enum SensitivityAnalysis {
OneSide, /*!< */
Centered /*!< */
/*! \deprecated Out of scope; copy this enumeration in your codebase if needed.
Deprecated in version 1.36.
*/
enum [[deprecated("Out of scope; copy this enumeration in your codebase if needed")]] SensitivityAnalysis {
OneSide,
Centered
};

/*! \relates SensitivityAnalysis */
QL_DEPRECATED_DISABLE_WARNING

/*! \relates SensitivityAnalysis
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
std::ostream& operator<<(std::ostream&,
SensitivityAnalysis);

//! utility fuction for weighted sum of NPVs
/*! \deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
Real aggregateNPV(const std::vector<ext::shared_ptr<Instrument> >&,
const std::vector<Real>& quantities);

Expand All @@ -60,7 +73,11 @@ namespace QuantLib {
the vector is just one single element equal to one.
All SimpleQuotes are tweaked together in a parallel fashion.
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
std::pair<Real, Real>
parallelAnalysis(const std::vector<Handle<SimpleQuote> >&,
const std::vector<ext::shared_ptr<Instrument> >&,
Expand All @@ -78,7 +95,11 @@ namespace QuantLib {
the vector is of size one.
All SimpleQuotes are tweaked together in a parallel fashion.
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
std::pair<Real, Real>
parallelAnalysis(const std::vector<std::vector<Handle<SimpleQuote> > >&,
const std::vector<ext::shared_ptr<Instrument> >&,
Expand All @@ -94,7 +115,11 @@ namespace QuantLib {
Empty quantities vector is considered as unit vector. The same if
the vector is of size one.
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
std::pair<Real, Real> bucketAnalysis(const Handle<SimpleQuote>& quote,
const std::vector<ext::shared_ptr<Instrument> >&,
const std::vector<Real>& quantities,
Expand All @@ -110,7 +135,11 @@ namespace QuantLib {
Empty quantities vector is considered as unit vector. The same if
the vector is of size one.
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
void bucketAnalysis(std::vector<Real>& deltaVector, // result
std::vector<Real>& gammaVector, // result
std::vector<Real>& referenceValues,
Expand All @@ -128,7 +157,11 @@ namespace QuantLib {
the vector is of size one.
The (bucket) SimpleQuotes are tweaked one by one separately.
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
std::pair<std::vector<Real>, std::vector<Real> >
bucketAnalysis(const std::vector<Handle<SimpleQuote> >& quotes,
const std::vector<ext::shared_ptr<Instrument> >&,
Expand All @@ -146,7 +179,11 @@ namespace QuantLib {
the vector is of size one.
The (bucket) SimpleQuotes are tweaked one by one separately.
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
void
bucketAnalysis(std::vector<std::vector<Real> >& deltaMatrix, // result
std::vector<std::vector<Real> >& gammaMatrix, // result
Expand All @@ -165,14 +202,19 @@ namespace QuantLib {
the vector is of size one.
The (bucket) SimpleQuotes are tweaked one by one separately.
\deprecated Out of scope; copy this function in your codebase if needed.
Deprecated in version 1.36.
*/
[[deprecated("Out of scope; copy this function in your codebase if needed")]]
std::pair<std::vector<std::vector<Real> >, std::vector<std::vector<Real> > >
bucketAnalysis(const std::vector<std::vector<Handle<SimpleQuote> > >&,
const std::vector<ext::shared_ptr<Instrument> >&,
const std::vector<Real>& quantities,
Real shift = 0.0001,
SensitivityAnalysis type = Centered);

QL_DEPRECATED_ENABLE_WARNING
}

#endif
4 changes: 4 additions & 0 deletions test-suite/creditriskplus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
using namespace QuantLib;
using namespace boost::unit_test_framework;

QL_DEPRECATED_DISABLE_WARNING

BOOST_FIXTURE_TEST_SUITE(QuantLibTests, TopLevelFixture)

BOOST_AUTO_TEST_SUITE(CreditRiskPlusTests)
Expand Down Expand Up @@ -126,3 +128,5 @@ BOOST_AUTO_TEST_CASE(testReferenceValues) {
BOOST_AUTO_TEST_SUITE_END()

BOOST_AUTO_TEST_SUITE_END()

QL_DEPRECATED_ENABLE_WARNING

0 comments on commit 9f0c9b9

Please sign in to comment.