From 03a5ea07f90a22d695b77d5a08a1561a3ae0a68c Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Fri, 4 Oct 2024 10:34:48 +0200 Subject: [PATCH 01/20] QPR-12849 avoid copying the time series of fixings --- ql/index.hpp | 3 +-- ql/indexes/indexmanager.cpp | 4 ++++ ql/indexes/indexmanager.hpp | 2 ++ ql/utilities/observablevalue.hpp | 6 ++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ql/index.hpp b/ql/index.hpp index 6419700ff64..57da0ff14e4 100644 --- a/ql/index.hpp +++ b/ql/index.hpp @@ -101,7 +101,7 @@ namespace QuantLib { bool forceOverwrite = false) { checkNativeFixingsAllowed(); std::string tag = name(); - TimeSeries h = IndexManager::instance().getHistory(tag); + TimeSeries& h = IndexManager::instance().getHistoryRef(tag); bool noInvalidFixing = true, noDuplicatedFixing = true; Date invalidDate, duplicatedDate; Real nullValue = Null(); @@ -128,7 +128,6 @@ namespace QuantLib { invalidValue = *(vBegin++); } } - IndexManager::instance().setHistory(tag, h); QL_REQUIRE(noInvalidFixing, "At least one invalid fixing provided: " << invalidDate.weekday() << " " << invalidDate << ", " << invalidValue); diff --git a/ql/indexes/indexmanager.cpp b/ql/indexes/indexmanager.cpp index 19f4c4f77de..39bb14d0b26 100644 --- a/ql/indexes/indexmanager.cpp +++ b/ql/indexes/indexmanager.cpp @@ -29,6 +29,10 @@ namespace QuantLib { return data_[name].value(); } + TimeSeries& IndexManager::getHistoryRef(const std::string& name) { + return data_[name].ref(); + } + void IndexManager::setHistory(const std::string& name, TimeSeries history) { data_[name] = std::move(history); } diff --git a/ql/indexes/indexmanager.hpp b/ql/indexes/indexmanager.hpp index 0115aabfe93..2e18fbc3ed6 100644 --- a/ql/indexes/indexmanager.hpp +++ b/ql/indexes/indexmanager.hpp @@ -45,6 +45,8 @@ namespace QuantLib { bool hasHistory(const std::string& name) const; //! returns the (possibly empty) history of the index fixings const TimeSeries& getHistory(const std::string& name) const; + //! returns a ref to the (possibly empty) history of the index fixings + TimeSeries& getHistoryRef(const std::string& name); //! stores the historical fixings of the index void setHistory(const std::string& name, TimeSeries history); //! observer notifying of changes in the index fixings diff --git a/ql/utilities/observablevalue.hpp b/ql/utilities/observablevalue.hpp index aa54ce7846f..a35fa972bb7 100644 --- a/ql/utilities/observablevalue.hpp +++ b/ql/utilities/observablevalue.hpp @@ -57,6 +57,8 @@ namespace QuantLib { operator ext::shared_ptr() const; //! explicit inspector const T& value() const; + //! explicit reference + T& ref(); private: T value_; ext::shared_ptr observable_; @@ -118,6 +120,10 @@ namespace QuantLib { return value_; } + template + T& ObservableValue::ref() { + return value_; + } } #endif From 256d272ff73081b35165fa3d650cd971a194e63e Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Fri, 4 Oct 2024 12:51:37 +0200 Subject: [PATCH 02/20] QPR-12849 fix observability --- ql/index.hpp | 5 +++-- ql/indexes/indexmanager.cpp | 5 +++-- ql/indexes/indexmanager.hpp | 4 ++-- ql/utilities/observablevalue.hpp | 7 +++++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ql/index.hpp b/ql/index.hpp index 57da0ff14e4..d7b12adae49 100644 --- a/ql/index.hpp +++ b/ql/index.hpp @@ -100,8 +100,8 @@ namespace QuantLib { ValueIterator vBegin, bool forceOverwrite = false) { checkNativeFixingsAllowed(); - std::string tag = name(); - TimeSeries& h = IndexManager::instance().getHistoryRef(tag); + auto& obsValue = IndexManager::instance().getHistoryObservableValueRef(name()); + auto& h = obsValue.ref(); bool noInvalidFixing = true, noDuplicatedFixing = true; Date invalidDate, duplicatedDate; Real nullValue = Null(); @@ -128,6 +128,7 @@ namespace QuantLib { invalidValue = *(vBegin++); } } + obsValue.notifyObservers(); QL_REQUIRE(noInvalidFixing, "At least one invalid fixing provided: " << invalidDate.weekday() << " " << invalidDate << ", " << invalidValue); diff --git a/ql/indexes/indexmanager.cpp b/ql/indexes/indexmanager.cpp index 39bb14d0b26..2397c4fafb1 100644 --- a/ql/indexes/indexmanager.cpp +++ b/ql/indexes/indexmanager.cpp @@ -29,8 +29,9 @@ namespace QuantLib { return data_[name].value(); } - TimeSeries& IndexManager::getHistoryRef(const std::string& name) { - return data_[name].ref(); + ObservableValue>& + IndexManager::getHistoryObservableValueRef(const std::string& name) { + return data_[name]; } void IndexManager::setHistory(const std::string& name, TimeSeries history) { diff --git a/ql/indexes/indexmanager.hpp b/ql/indexes/indexmanager.hpp index 2e18fbc3ed6..2310e484aab 100644 --- a/ql/indexes/indexmanager.hpp +++ b/ql/indexes/indexmanager.hpp @@ -45,8 +45,8 @@ namespace QuantLib { bool hasHistory(const std::string& name) const; //! returns the (possibly empty) history of the index fixings const TimeSeries& getHistory(const std::string& name) const; - //! returns a ref to the (possibly empty) history of the index fixings - TimeSeries& getHistoryRef(const std::string& name); + //! returns the observable value for a history + ObservableValue>& getHistoryObservableValueRef(const std::string& name); //! stores the historical fixings of the index void setHistory(const std::string& name, TimeSeries history); //! observer notifying of changes in the index fixings diff --git a/ql/utilities/observablevalue.hpp b/ql/utilities/observablevalue.hpp index a35fa972bb7..cdd7b8d23b0 100644 --- a/ql/utilities/observablevalue.hpp +++ b/ql/utilities/observablevalue.hpp @@ -59,6 +59,8 @@ namespace QuantLib { const T& value() const; //! explicit reference T& ref(); + //! explicit notification of observers + void notifyObservers() const; private: T value_; ext::shared_ptr observable_; @@ -124,6 +126,11 @@ namespace QuantLib { T& ObservableValue::ref() { return value_; } + + template + void ObservableValue::notifyObservers() const { + observable_->notifyObservers(); + } } #endif From 347c2c580f105525eb9340f675eb317344468713 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Fri, 4 Oct 2024 17:17:25 +0200 Subject: [PATCH 03/20] QPR-12849 clean up --- ql/index.cpp | 5 ++-- ql/index.hpp | 42 +++++++-------------------------- ql/indexes/indexmanager.cpp | 21 +++++++++++------ ql/indexes/indexmanager.hpp | 46 +++++++++++++++++++++++++++++++++---- 4 files changed, 66 insertions(+), 48 deletions(-) diff --git a/ql/index.cpp b/ql/index.cpp index c5bb900a15e..31ae9d280be 100644 --- a/ql/index.cpp +++ b/ql/index.cpp @@ -25,9 +25,8 @@ namespace QuantLib { Real fixing, bool forceOverwrite) { checkNativeFixingsAllowed(); - addFixings(&fixingDate, (&fixingDate)+1, - &fixing, - forceOverwrite); + std::cout << "adding fixing " << fixingDate << " " << name() << " " << std::endl; + addFixings(&fixingDate, (&fixingDate) + 1, &fixing, forceOverwrite); } void Index::addFixings(const TimeSeries& t, diff --git a/ql/index.hpp b/ql/index.hpp index d7b12adae49..3604152f80e 100644 --- a/ql/index.hpp +++ b/ql/index.hpp @@ -100,42 +100,16 @@ namespace QuantLib { ValueIterator vBegin, bool forceOverwrite = false) { checkNativeFixingsAllowed(); - auto& obsValue = IndexManager::instance().getHistoryObservableValueRef(name()); - auto& h = obsValue.ref(); - bool noInvalidFixing = true, noDuplicatedFixing = true; - Date invalidDate, duplicatedDate; - Real nullValue = Null(); - Real invalidValue = Null(); - Real duplicatedValue = Null(); + DateIterator dBegin2 = dBegin, dEnd2 = dEnd; + ValueIterator vBegin2 = vBegin; while (dBegin != dEnd) { - bool validFixing = isValidFixingDate(*dBegin); - Real currentValue = h[*dBegin]; - bool missingFixing = forceOverwrite || currentValue == nullValue; - if (validFixing) { - if (missingFixing) - h[*(dBegin++)] = *(vBegin++); - else if (close(currentValue, *(vBegin))) { - ++dBegin; - ++vBegin; - } else { - noDuplicatedFixing = false; - duplicatedDate = *(dBegin++); - duplicatedValue = *(vBegin++); - } - } else { - noInvalidFixing = false; - invalidDate = *(dBegin++); - invalidValue = *(vBegin++); - } + QL_REQUIRE(isValidFixingDate(*dBegin), + "At least on invalid fixing provided: " << dBegin->weekday() << *dBegin + << ", " << *vBegin); + ++dBegin; + ++vBegin; } - obsValue.notifyObservers(); - QL_REQUIRE(noInvalidFixing, "At least one invalid fixing provided: " - << invalidDate.weekday() << " " << invalidDate << ", " - << invalidValue); - QL_REQUIRE(noDuplicatedFixing, "At least one duplicated fixing provided: " - << duplicatedDate << ", " << duplicatedValue - << " while " << h[duplicatedDate] - << " value is already present"); + IndexManager::instance().addFixings(name(), dBegin2, dEnd2, vBegin2, forceOverwrite); } //! clears all stored historical fixings void clearFixings(); diff --git a/ql/indexes/indexmanager.cpp b/ql/indexes/indexmanager.cpp index 2397c4fafb1..28a11127c43 100644 --- a/ql/indexes/indexmanager.cpp +++ b/ql/indexes/indexmanager.cpp @@ -26,11 +26,6 @@ namespace QuantLib { } const TimeSeries& IndexManager::getHistory(const std::string& name) const { - return data_[name].value(); - } - - ObservableValue>& - IndexManager::getHistoryObservableValueRef(const std::string& name) { return data_[name]; } @@ -38,8 +33,20 @@ namespace QuantLib { data_[name] = std::move(history); } + void IndexManager::addFixing(const std::string& name, + const Date& fixingDate, + Real fixing, + bool forceOverwrite) { + addFixings(name, &fixingDate, (&fixingDate) + 1, &fixing, forceOverwrite); + } + ext::shared_ptr IndexManager::notifier(const std::string& name) const { - return data_[name]; + auto n = notifiers_.find(name); + if(n != notifiers_.end()) + return n->second; + auto o = ext::make_shared(); + notifiers_[name] = o; + return o; } std::vector IndexManager::histories() const { @@ -57,7 +64,7 @@ namespace QuantLib { bool IndexManager::hasHistoricalFixing(const std::string& name, const Date& fixingDate) const { auto const& indexIter = data_.find(name); return (indexIter != data_.end()) && - ((*indexIter).second.value()[fixingDate] != Null()); + ((*indexIter).second[fixingDate] != Null()); } } diff --git a/ql/indexes/indexmanager.hpp b/ql/indexes/indexmanager.hpp index 2310e484aab..6705650f0db 100644 --- a/ql/indexes/indexmanager.hpp +++ b/ql/indexes/indexmanager.hpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -45,11 +46,47 @@ namespace QuantLib { bool hasHistory(const std::string& name) const; //! returns the (possibly empty) history of the index fixings const TimeSeries& getHistory(const std::string& name) const; - //! returns the observable value for a history - ObservableValue>& getHistoryObservableValueRef(const std::string& name); //! stores the historical fixings of the index void setHistory(const std::string& name, TimeSeries history); - //! observer notifying of changes in the index fixings + //! add a fixing + void addFixing(const std::string& name, + const Date& fixingDate, + Real fixing, + bool forceOverwrite = false); + //! add fixings + template + void addFixings(const std::string& name, + DateIterator dBegin, + DateIterator dEnd, + ValueIterator vBegin, + bool forceOverwrite = false) { + auto& h = data_[name]; + bool noDuplicatedFixing = true; + Date duplicatedDate; + Real nullValue = Null(); + Real invalidValue = Null(); + Real duplicatedValue = Null(); + while (dBegin != dEnd) { + Real currentValue = h[*dBegin]; + bool missingFixing = forceOverwrite || currentValue == nullValue; + if (missingFixing) + h[*(dBegin++)] = *(vBegin++); + else if (close(currentValue, *(vBegin))) { + ++dBegin; + ++vBegin; + } else { + noDuplicatedFixing = false; + duplicatedDate = *(dBegin++); + duplicatedValue = *(vBegin++); + } + } + notifier(name)->notifyObservers(); + QL_REQUIRE(noDuplicatedFixing, "At least one duplicated fixing provided: " + << duplicatedDate << ", " << duplicatedValue + << " while " << h[duplicatedDate] + << " value is already present"); + } + //! observer notifying of changes in the index fixings_ ext::shared_ptr notifier(const std::string& name) const; //! returns all names of the indexes for which fixings were stored std::vector histories() const; @@ -69,7 +106,8 @@ namespace QuantLib { } }; - mutable std::map>, CaseInsensitiveCompare> data_; + mutable std::map, CaseInsensitiveCompare> data_; + mutable std::map> notifiers_; }; } From 98f9f6f75560c13af5c4682e61d9b6e3a5d07bc9 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Fri, 4 Oct 2024 17:20:40 +0200 Subject: [PATCH 04/20] QPR-12849 clean up --- ql/index.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ql/index.cpp b/ql/index.cpp index 31ae9d280be..967a806b2c2 100644 --- a/ql/index.cpp +++ b/ql/index.cpp @@ -25,7 +25,6 @@ namespace QuantLib { Real fixing, bool forceOverwrite) { checkNativeFixingsAllowed(); - std::cout << "adding fixing " << fixingDate << " " << name() << " " << std::endl; addFixings(&fixingDate, (&fixingDate) + 1, &fixing, forceOverwrite); } From a9e7a868ce4d87b51189a1e6437bef1f42b7aee3 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Fri, 4 Oct 2024 17:22:20 +0200 Subject: [PATCH 05/20] QPR-12849 clean up --- ql/utilities/observablevalue.hpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/ql/utilities/observablevalue.hpp b/ql/utilities/observablevalue.hpp index cdd7b8d23b0..461bb8c0b36 100644 --- a/ql/utilities/observablevalue.hpp +++ b/ql/utilities/observablevalue.hpp @@ -57,10 +57,6 @@ namespace QuantLib { operator ext::shared_ptr() const; //! explicit inspector const T& value() const; - //! explicit reference - T& ref(); - //! explicit notification of observers - void notifyObservers() const; private: T value_; ext::shared_ptr observable_; @@ -121,16 +117,6 @@ namespace QuantLib { const T& ObservableValue::value() const { return value_; } - - template - T& ObservableValue::ref() { - return value_; - } - - template - void ObservableValue::notifyObservers() const { - observable_->notifyObservers(); - } } #endif From 772110d44f554aad7c17e1056023793f14b72512 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Fri, 4 Oct 2024 19:14:21 +0200 Subject: [PATCH 06/20] QPR-12849 missing notifications --- ql/indexes/indexmanager.cpp | 12 ++++++++++-- ql/indexes/indexmanager.hpp | 1 - ql/utilities/observablevalue.hpp | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ql/indexes/indexmanager.cpp b/ql/indexes/indexmanager.cpp index 28a11127c43..3977b10def4 100644 --- a/ql/indexes/indexmanager.cpp +++ b/ql/indexes/indexmanager.cpp @@ -30,6 +30,7 @@ namespace QuantLib { } void IndexManager::setHistory(const std::string& name, TimeSeries history) { + notifier(name)->notifyObservers(); data_[name] = std::move(history); } @@ -57,9 +58,16 @@ namespace QuantLib { return temp; } - void IndexManager::clearHistory(const std::string& name) { data_.erase(name); } + void IndexManager::clearHistory(const std::string& name) { + notifier(name)->notifyObservers(); + data_.erase(name); + } - void IndexManager::clearHistories() { data_.clear(); } + void IndexManager::clearHistories() { + for (auto const& d : data_) + notifier(d.first)->notifyObservers(); + data_.clear(); + } bool IndexManager::hasHistoricalFixing(const std::string& name, const Date& fixingDate) const { auto const& indexIter = data_.find(name); diff --git a/ql/indexes/indexmanager.hpp b/ql/indexes/indexmanager.hpp index 6705650f0db..9fbb5440e6d 100644 --- a/ql/indexes/indexmanager.hpp +++ b/ql/indexes/indexmanager.hpp @@ -64,7 +64,6 @@ namespace QuantLib { bool noDuplicatedFixing = true; Date duplicatedDate; Real nullValue = Null(); - Real invalidValue = Null(); Real duplicatedValue = Null(); while (dBegin != dEnd) { Real currentValue = h[*dBegin]; diff --git a/ql/utilities/observablevalue.hpp b/ql/utilities/observablevalue.hpp index 461bb8c0b36..aa54ce7846f 100644 --- a/ql/utilities/observablevalue.hpp +++ b/ql/utilities/observablevalue.hpp @@ -117,6 +117,7 @@ namespace QuantLib { const T& ObservableValue::value() const { return value_; } + } #endif From 25c27569db2696e329b26a50a8a9a8933b908b12 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Fri, 4 Oct 2024 19:19:37 +0200 Subject: [PATCH 07/20] QPR-12849 update notifiers --- ql/indexes/indexmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ql/indexes/indexmanager.cpp b/ql/indexes/indexmanager.cpp index 3977b10def4..759a7bb1fc7 100644 --- a/ql/indexes/indexmanager.cpp +++ b/ql/indexes/indexmanager.cpp @@ -61,12 +61,14 @@ namespace QuantLib { void IndexManager::clearHistory(const std::string& name) { notifier(name)->notifyObservers(); data_.erase(name); + notifiers_.erase(name); } void IndexManager::clearHistories() { for (auto const& d : data_) notifier(d.first)->notifyObservers(); data_.clear(); + notifiers_.clear(); } bool IndexManager::hasHistoricalFixing(const std::string& name, const Date& fixingDate) const { From f609bb325aa7ab0d0ff8534656c5ebe73f144152 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Sun, 6 Oct 2024 12:21:51 +0200 Subject: [PATCH 08/20] QPR-12849 restore old behaviour w.r.t. invalid fixings --- ql/index.hpp | 13 +++---------- ql/indexes/indexmanager.hpp | 34 +++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ql/index.hpp b/ql/index.hpp index 3604152f80e..1bbe384caad 100644 --- a/ql/index.hpp +++ b/ql/index.hpp @@ -100,16 +100,9 @@ namespace QuantLib { ValueIterator vBegin, bool forceOverwrite = false) { checkNativeFixingsAllowed(); - DateIterator dBegin2 = dBegin, dEnd2 = dEnd; - ValueIterator vBegin2 = vBegin; - while (dBegin != dEnd) { - QL_REQUIRE(isValidFixingDate(*dBegin), - "At least on invalid fixing provided: " << dBegin->weekday() << *dBegin - << ", " << *vBegin); - ++dBegin; - ++vBegin; - } - IndexManager::instance().addFixings(name(), dBegin2, dEnd2, vBegin2, forceOverwrite); + IndexManager::instance().addFixings( + name(), dBegin, dEnd, vBegin, forceOverwrite, + [this](const Date& d) { return isValidFixingDate(d); }); } //! clears all stored historical fixings void clearFixings(); diff --git a/ql/indexes/indexmanager.hpp b/ql/indexes/indexmanager.hpp index 9fbb5440e6d..b6346356df5 100644 --- a/ql/indexes/indexmanager.hpp +++ b/ql/indexes/indexmanager.hpp @@ -59,27 +59,39 @@ namespace QuantLib { DateIterator dBegin, DateIterator dEnd, ValueIterator vBegin, - bool forceOverwrite = false) { + bool forceOverwrite = false, + const std::function& isValidFixingDate = {}) { auto& h = data_[name]; - bool noDuplicatedFixing = true; - Date duplicatedDate; + bool noInvalidFixing = true, noDuplicatedFixing = true; + Date invalidDate, duplicatedDate; Real nullValue = Null(); + Real invalidValue = Null(); Real duplicatedValue = Null(); while (dBegin != dEnd) { + bool validFixing = isValidFixingDate ? isValidFixingDate(*dBegin) : true; Real currentValue = h[*dBegin]; bool missingFixing = forceOverwrite || currentValue == nullValue; - if (missingFixing) - h[*(dBegin++)] = *(vBegin++); - else if (close(currentValue, *(vBegin))) { - ++dBegin; - ++vBegin; + if (validFixing) { + if (missingFixing) + h[*(dBegin++)] = *(vBegin++); + else if (close(currentValue, *(vBegin))) { + ++dBegin; + ++vBegin; + } else { + noDuplicatedFixing = false; + duplicatedDate = *(dBegin++); + duplicatedValue = *(vBegin++); + } } else { - noDuplicatedFixing = false; - duplicatedDate = *(dBegin++); - duplicatedValue = *(vBegin++); + noInvalidFixing = false; + invalidDate = *(dBegin++); + invalidValue = *(vBegin++); } } notifier(name)->notifyObservers(); + QL_REQUIRE(noInvalidFixing, "At least one invalid fixing provided: " + << invalidDate.weekday() << " " << invalidDate << ", " + << invalidValue); QL_REQUIRE(noDuplicatedFixing, "At least one duplicated fixing provided: " << duplicatedDate << ", " << duplicatedValue << " while " << h[duplicatedDate] From 6957b0a16c4eb225a63c7c6c84c0f2573b81e2c1 Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Sun, 6 Oct 2024 17:49:45 +0200 Subject: [PATCH 09/20] QPR-12849 keep notifiers --- ql/indexes/indexmanager.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ql/indexes/indexmanager.cpp b/ql/indexes/indexmanager.cpp index 759a7bb1fc7..3977b10def4 100644 --- a/ql/indexes/indexmanager.cpp +++ b/ql/indexes/indexmanager.cpp @@ -61,14 +61,12 @@ namespace QuantLib { void IndexManager::clearHistory(const std::string& name) { notifier(name)->notifyObservers(); data_.erase(name); - notifiers_.erase(name); } void IndexManager::clearHistories() { for (auto const& d : data_) notifier(d.first)->notifyObservers(); data_.clear(); - notifiers_.clear(); } bool IndexManager::hasHistoricalFixing(const std::string& name, const Date& fixingDate) const { From 0e5267690631d0edcfb3eab8222f58b573d7195e Mon Sep 17 00:00:00 2001 From: Peter Caspers Date: Sun, 6 Oct 2024 19:30:19 +0200 Subject: [PATCH 10/20] QPR-12849 hide new methods --- ql/indexes/indexmanager.hpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ql/indexes/indexmanager.hpp b/ql/indexes/indexmanager.hpp index b6346356df5..49ba0ad23e2 100644 --- a/ql/indexes/indexmanager.hpp +++ b/ql/indexes/indexmanager.hpp @@ -40,14 +40,7 @@ namespace QuantLib { private: IndexManager() = default; - - public: - //! returns whether historical fixings were stored for the index - bool hasHistory(const std::string& name) const; - //! returns the (possibly empty) history of the index fixings - const TimeSeries& getHistory(const std::string& name) const; - //! stores the historical fixings of the index - void setHistory(const std::string& name, TimeSeries history); + friend class Index; //! add a fixing void addFixing(const std::string& name, const Date& fixingDate, @@ -97,6 +90,14 @@ namespace QuantLib { << " while " << h[duplicatedDate] << " value is already present"); } + + public: + //! returns whether historical fixings were stored for the index + bool hasHistory(const std::string& name) const; + //! returns the (possibly empty) history of the index fixings + const TimeSeries& getHistory(const std::string& name) const; + //! stores the historical fixings of the index + void setHistory(const std::string& name, TimeSeries history); //! observer notifying of changes in the index fixings_ ext::shared_ptr notifier(const std::string& name) const; //! returns all names of the indexes for which fixings were stored From 61793d86d4fb14f719994864e7b21e79e24ad6e0 Mon Sep 17 00:00:00 2001 From: "jongbong.an" Date: Tue, 8 Oct 2024 09:23:02 +0900 Subject: [PATCH 11/20] added a kofr index --- QuantLib.vcxproj | 2 ++ QuantLib.vcxproj.filters | 6 +++++ ql/CMakeLists.txt | 2 ++ ql/indexes/ibor/Makefile.am | 2 ++ ql/indexes/ibor/all.hpp | 1 + ql/indexes/ibor/kofr.cpp | 31 ++++++++++++++++++++++++++ ql/indexes/ibor/kofr.hpp | 44 +++++++++++++++++++++++++++++++++++++ 7 files changed, 88 insertions(+) create mode 100644 ql/indexes/ibor/kofr.cpp create mode 100644 ql/indexes/ibor/kofr.hpp diff --git a/QuantLib.vcxproj b/QuantLib.vcxproj index c9e69684b9d..bc1236a45e9 100644 --- a/QuantLib.vcxproj +++ b/QuantLib.vcxproj @@ -848,6 +848,7 @@ + @@ -2137,6 +2138,7 @@ + diff --git a/QuantLib.vcxproj.filters b/QuantLib.vcxproj.filters index 001b00b67ee..de8e32fb43a 100644 --- a/QuantLib.vcxproj.filters +++ b/QuantLib.vcxproj.filters @@ -669,6 +669,9 @@ indexes\ibor + + indexes\ibor + indexes\ibor @@ -4613,6 +4616,9 @@ indexes\ibor + + indexes\ibor + indexes\ibor diff --git a/ql/CMakeLists.txt b/ql/CMakeLists.txt index ca7950156d0..1d8dc103927 100644 --- a/ql/CMakeLists.txt +++ b/ql/CMakeLists.txt @@ -235,6 +235,7 @@ set(QL_SOURCES indexes/ibor/euribor.cpp indexes/ibor/eurlibor.cpp indexes/ibor/fedfunds.cpp + indexes/ibor/kofr.cpp indexes/ibor/libor.cpp indexes/ibor/shibor.cpp indexes/ibor/sofr.cpp @@ -1261,6 +1262,7 @@ set(QL_HEADERS indexes/ibor/gbplibor.hpp indexes/ibor/jibar.hpp indexes/ibor/jpylibor.hpp + indexes/ibor/kofr.hpp indexes/ibor/libor.hpp indexes/ibor/mosprime.hpp indexes/ibor/nzdlibor.hpp diff --git a/ql/indexes/ibor/Makefile.am b/ql/indexes/ibor/Makefile.am index cc7721a4c0c..f0e17bf957a 100644 --- a/ql/indexes/ibor/Makefile.am +++ b/ql/indexes/ibor/Makefile.am @@ -23,6 +23,7 @@ this_include_HEADERS = \ gbplibor.hpp \ jibar.hpp \ jpylibor.hpp \ + kofr.hpp \ libor.hpp \ mosprime.hpp \ nzdlibor.hpp \ @@ -50,6 +51,7 @@ cpp_files = \ euribor.cpp \ eurlibor.cpp \ fedfunds.cpp \ + kofr.cpp \ libor.cpp \ shibor.cpp \ sofr.cpp \ diff --git a/ql/indexes/ibor/all.hpp b/ql/indexes/ibor/all.hpp index 4dbae78eaa9..52d07e304d0 100644 --- a/ql/indexes/ibor/all.hpp +++ b/ql/indexes/ibor/all.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/ql/indexes/ibor/kofr.cpp b/ql/indexes/ibor/kofr.cpp new file mode 100644 index 00000000000..2c0c7654871 --- /dev/null +++ b/ql/indexes/ibor/kofr.cpp @@ -0,0 +1,31 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2024 Jongbong An + + This file is part of QuantLib, a free-software/open-source library + for financial quantitative analysts and developers - http://quantlib.org/ + + QuantLib is free software: you can redistribute it and/or modify it + under the terms of the QuantLib license. You should have received a + copy of the license along with this program; if not, please email + . The license is also available online at + . + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +#include +#include +#include +#include +#include + +namespace QuantLib { + Kofr::Kofr(const Handle& h) + : OvernightIndex( + "KOFR", 0, KRWCurrency(), SouthKorea(SouthKorea::Settlement), Actual365Fixed(), h) {} + +} diff --git a/ql/indexes/ibor/kofr.hpp b/ql/indexes/ibor/kofr.hpp new file mode 100644 index 00000000000..4f23ac702f5 --- /dev/null +++ b/ql/indexes/ibor/kofr.hpp @@ -0,0 +1,44 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2024 Jongbong An + + This file is part of QuantLib, a free-software/open-source library + for financial quantitative analysts and developers - http://quantlib.org/ + + QuantLib is free software: you can redistribute it and/or modify it + under the terms of the QuantLib license. You should have received a + copy of the license along with this program; if not, please email + . The license is also available online at + . + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +/*! \file kofr.hpp + \brief %KOFR index +*/ + +#ifndef quantlib_kofr_hpp +#define quantlib_kofr_hpp + +#include + +namespace QuantLib { + + //! %KOFR index. + /*! Korea Overnight Financing Repo Rate (KOFR) published by Korea Securities Depository (KSD) + Please refer to + (1) https://www.bok.or.kr/eng/main/contents.do?menuNo=400399 (Overview) + (2) https://www.kofr.kr/main.jsp (Detailed information) + */ + class Kofr : public OvernightIndex { + public: + explicit Kofr(const Handle& h = {}); + }; + +} + +#endif From 55c163c23969490ccc722e42d20ddd40bfc3d58e Mon Sep 17 00:00:00 2001 From: Luigi Ballabio Date: Wed, 9 Oct 2024 15:17:49 +0200 Subject: [PATCH 12/20] Remove classes deprecated in version 1.32 --- QuantLib.vcxproj | 18 -- QuantLib.vcxproj.filters | 54 ---- cmake/GenerateHeaders.cmake | 27 +- ql/CMakeLists.txt | 18 -- ql/cashflows/digitalcmscoupon.cpp | 5 - ql/cashflows/digitalcmscoupon.hpp | 5 - ql/cashflows/digitaliborcoupon.cpp | 5 - ql/cashflows/digitaliborcoupon.hpp | 5 - .../coupons/digitalcmsspreadcoupon.cpp | 5 - .../coupons/digitalcmsspreadcoupon.hpp | 5 - ql/experimental/exoticoptions/Makefile.am | 20 +- .../analyticamericanmargrabeengine.hpp | 23 -- .../analyticcomplexchooserengine.hpp | 23 -- .../analyticcompoundoptionengine.hpp | 23 -- .../analyticeuropeanmargrabeengine.hpp | 23 -- .../analyticsimplechooserengine.hpp | 23 -- .../exoticoptions/complexchooseroption.hpp | 23 -- .../exoticoptions/compoundoption.hpp | 23 -- .../exoticoptions/margrabeoption.hpp | 23 -- .../exoticoptions/simplechooseroption.hpp | 23 -- ql/experimental/termstructures/Makefile.am | 5 +- .../multicurvesensitivities.hpp | 26 -- ql/functional.hpp | 6 - ql/math/Makefile.am | 5 +- ql/math/all.hpp | 1 - ql/math/sampledcurve.cpp | 87 ------- ql/math/sampledcurve.hpp | 230 +----------------- ql/methods/finitedifferences/Makefile.am | 4 +- ql/methods/finitedifferences/all.hpp | 3 - .../finitedifferences/bsmtermoperator.hpp | 19 +- ql/methods/finitedifferences/fdtypedefs.hpp | 34 +-- .../finitedifferences/parallelevolver.hpp | 94 +------ ql/methods/finitedifferences/pdeshortrate.hpp | 28 --- .../finitedifferences/shoutcondition.hpp | 28 --- ql/models/marketmodels/Makefile.am | 3 +- .../marketmodels/duffsdeviceinnerproduct.hpp | 28 --- ql/pricingengines/vanilla/Makefile.am | 10 +- ql/pricingengines/vanilla/all.hpp | 2 - ql/pricingengines/vanilla/fdconditions.hpp | 27 -- .../vanilla/fddividendengine.hpp | 28 --- .../vanilla/fdmultiperiodengine.hpp | 198 +-------------- .../vanilla/fdstepconditionengine.hpp | 28 --- ql/pricingengines/vanilla/fdvanillaengine.cpp | 150 ------------ ql/pricingengines/vanilla/fdvanillaengine.hpp | 64 +---- test-suite/CMakeLists.txt | 1 - test-suite/Makefile.am | 1 - test-suite/operators.cpp | 2 +- test-suite/sampledcurve.cpp | 92 ------- test-suite/testsuite.vcxproj | 1 - test-suite/testsuite.vcxproj.filters | 3 - 50 files changed, 29 insertions(+), 1553 deletions(-) delete mode 100644 ql/experimental/exoticoptions/analyticamericanmargrabeengine.hpp delete mode 100644 ql/experimental/exoticoptions/analyticcomplexchooserengine.hpp delete mode 100644 ql/experimental/exoticoptions/analyticcompoundoptionengine.hpp delete mode 100644 ql/experimental/exoticoptions/analyticeuropeanmargrabeengine.hpp delete mode 100644 ql/experimental/exoticoptions/analyticsimplechooserengine.hpp delete mode 100644 ql/experimental/exoticoptions/complexchooseroption.hpp delete mode 100644 ql/experimental/exoticoptions/compoundoption.hpp delete mode 100644 ql/experimental/exoticoptions/margrabeoption.hpp delete mode 100644 ql/experimental/exoticoptions/simplechooseroption.hpp delete mode 100644 ql/experimental/termstructures/multicurvesensitivities.hpp delete mode 100644 ql/math/sampledcurve.cpp delete mode 100644 ql/methods/finitedifferences/pdeshortrate.hpp delete mode 100644 ql/methods/finitedifferences/shoutcondition.hpp delete mode 100644 ql/models/marketmodels/duffsdeviceinnerproduct.hpp delete mode 100644 ql/pricingengines/vanilla/fdconditions.hpp delete mode 100644 ql/pricingengines/vanilla/fddividendengine.hpp delete mode 100644 ql/pricingengines/vanilla/fdstepconditionengine.hpp delete mode 100644 ql/pricingengines/vanilla/fdvanillaengine.cpp delete mode 100644 test-suite/sampledcurve.cpp diff --git a/QuantLib.vcxproj b/QuantLib.vcxproj index c9e69684b9d..5963f69932a 100644 --- a/QuantLib.vcxproj +++ b/QuantLib.vcxproj @@ -663,32 +663,23 @@ - - - - - - - - - @@ -791,7 +782,6 @@ - @@ -1221,7 +1211,6 @@ - @@ -1233,7 +1222,6 @@ - @@ -1358,7 +1346,6 @@ - @@ -1607,14 +1594,11 @@ - - - @@ -2329,7 +2313,6 @@ - @@ -2649,7 +2632,6 @@ - diff --git a/QuantLib.vcxproj.filters b/QuantLib.vcxproj.filters index 001b00b67ee..c8dcc4cb4a6 100644 --- a/QuantLib.vcxproj.filters +++ b/QuantLib.vcxproj.filters @@ -450,12 +450,6 @@ methods\finitedifferences - - methods\finitedifferences - - - methods\finitedifferences - methods\finitedifferences @@ -1482,9 +1476,6 @@ models\marketmodels - - models\marketmodels - models\marketmodels @@ -2532,18 +2523,9 @@ pricingengines\vanilla - - pricingengines\vanilla - - - pricingengines\vanilla - pricingengines\vanilla - - pricingengines\vanilla - pricingengines\vanilla @@ -3132,15 +3114,6 @@ experimental\exoticoptions - - experimental\exoticoptions - - - experimental\exoticoptions - - - experimental\exoticoptions - experimental\exoticoptions @@ -3156,9 +3129,6 @@ pricingengines\barrier - - experimental\exoticoptions - experimental\exoticoptions @@ -3168,9 +3138,6 @@ experimental\exoticoptions - - experimental\exoticoptions - experimental\exoticoptions @@ -3189,9 +3156,6 @@ experimental\exoticoptions - - experimental\exoticoptions - experimental\exoticoptions @@ -3207,9 +3171,6 @@ experimental\exoticoptions - - experimental\exoticoptions - experimental\exoticoptions @@ -3486,9 +3447,6 @@ experimental\termstructures - - experimental\termstructures - experimental\varianceoption @@ -3639,12 +3597,6 @@ experimental\barrieroption - - experimental\exoticoptions - - - experimental\exoticoptions - experimental\inflation @@ -4862,9 +4814,6 @@ math - - math - math\statistics @@ -5792,9 +5741,6 @@ pricingengines\vanilla - - pricingengines\vanilla - pricingengines\vanilla diff --git a/cmake/GenerateHeaders.cmake b/cmake/GenerateHeaders.cmake index f1ec159d192..9e2bd938116 100644 --- a/cmake/GenerateHeaders.cmake +++ b/cmake/GenerateHeaders.cmake @@ -38,29 +38,14 @@ function(generate_dir_headers source_dir binary_dir) file(GLOB children_hpp RELATIVE ${source_dir} "${source_dir}/*.hpp") list(FILTER children_hpp EXCLUDE REGEX "all.hpp") - # These headers were moved to another location. - # Therefore, we can ignore them as they only contain a warning and the new includes. - if (${source_dir} MATCHES "experimental" AND ${source_dir} MATCHES "exoticoptions") - list(FILTER children_hpp EXCLUDE REGEX "margrabeoption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticamericanmargrabeengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticeuropeanmargrabeengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "compoundoption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticcompoundoptionengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "simplechooseroption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticsimplechooserengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "complexchooseroption.hpp") - list(FILTER children_hpp EXCLUDE REGEX "analyticcomplexchooserengine.hpp") - endif () - - list(FILTER children_hpp EXCLUDE REGEX "multicurvesensitivities.hpp") - list(FILTER children_hpp EXCLUDE REGEX "shoutcondition.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fdcondition.hpp") - list(FILTER children_hpp EXCLUDE REGEX "pdeshortrate.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fddividendengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fdstepconditionengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "duffsdeviceinnerproduct.hpp") list(FILTER children_hpp EXCLUDE REGEX "dividendvanillaoption.hpp") list(FILTER children_hpp EXCLUDE REGEX "averageoiscouponpricer.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdmultiperiodengine.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdvanillaengine.hpp") + list(FILTER children_hpp EXCLUDE REGEX "sampledcurve.hpp") + list(FILTER children_hpp EXCLUDE REGEX "bsmtermoperator.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdtypedefs.hpp") + list(FILTER children_hpp EXCLUDE REGEX "parallelevolver.hpp") file(GLOB children_dir RELATIVE ${source_dir} "${source_dir}/*") list(FILTER children_dir EXCLUDE REGEX "CMakeFiles") diff --git a/ql/CMakeLists.txt b/ql/CMakeLists.txt index ca7950156d0..a0e7ee40b20 100644 --- a/ql/CMakeLists.txt +++ b/ql/CMakeLists.txt @@ -429,7 +429,6 @@ set(QL_SOURCES math/randomnumbers/xoshiro256starstaruniformrng.cpp math/richardsonextrapolation.cpp math/rounding.cpp - math/sampledcurve.cpp math/statistics/discrepancystatistics.cpp math/statistics/generalstatistics.cpp math/statistics/histogram.cpp @@ -752,7 +751,6 @@ set(QL_SOURCES pricingengines/vanilla/fdhestonvanillaengine.cpp pricingengines/vanilla/fdsabrvanillaengine.cpp pricingengines/vanilla/fdsimplebsswingengine.cpp - pricingengines/vanilla/fdvanillaengine.cpp pricingengines/vanilla/hestonexpansionengine.cpp pricingengines/vanilla/integralengine.cpp pricingengines/vanilla/jumpdiffusionengine.cpp @@ -1090,32 +1088,23 @@ set(QL_HEADERS experimental/credit/spotlosslatentmodel.hpp experimental/credit/spreadedhazardratecurve.hpp experimental/credit/syntheticcdo.hpp - experimental/exoticoptions/analyticamericanmargrabeengine.hpp - experimental/exoticoptions/analyticcomplexchooserengine.hpp - experimental/exoticoptions/analyticcompoundoptionengine.hpp - experimental/exoticoptions/analyticeuropeanmargrabeengine.hpp experimental/exoticoptions/analyticholderextensibleoptionengine.hpp experimental/exoticoptions/analyticpartialtimebarrieroptionengine.hpp experimental/exoticoptions/analyticpdfhestonengine.hpp - experimental/exoticoptions/analyticsimplechooserengine.hpp experimental/exoticoptions/analytictwoassetbarrierengine.hpp experimental/exoticoptions/analytictwoassetcorrelationengine.hpp experimental/exoticoptions/analyticwriterextensibleoptionengine.hpp - experimental/exoticoptions/complexchooseroption.hpp - experimental/exoticoptions/compoundoption.hpp experimental/exoticoptions/continuousarithmeticasianlevyengine.hpp experimental/exoticoptions/continuousarithmeticasianvecerengine.hpp experimental/exoticoptions/everestoption.hpp experimental/exoticoptions/himalayaoption.hpp experimental/exoticoptions/holderextensibleoption.hpp experimental/exoticoptions/kirkspreadoptionengine.hpp - experimental/exoticoptions/margrabeoption.hpp experimental/exoticoptions/mceverestengine.hpp experimental/exoticoptions/mchimalayaengine.hpp experimental/exoticoptions/mcpagodaengine.hpp experimental/exoticoptions/pagodaoption.hpp experimental/exoticoptions/partialtimebarrieroption.hpp - experimental/exoticoptions/simplechooseroption.hpp experimental/exoticoptions/spreadoption.hpp experimental/exoticoptions/twoassetbarrieroption.hpp experimental/exoticoptions/twoassetcorrelationoption.hpp @@ -1205,7 +1194,6 @@ set(QL_HEADERS experimental/swaptions/irregularswaption.hpp experimental/termstructures/basisswapratehelpers.hpp experimental/termstructures/crosscurrencyratehelpers.hpp - experimental/termstructures/multicurvesensitivities.hpp experimental/variancegamma/analyticvariancegammaengine.hpp experimental/variancegamma/fftengine.hpp experimental/variancegamma/fftvanillaengine.hpp @@ -1616,7 +1604,6 @@ set(QL_HEADERS methods/finitedifferences/parallelevolver.hpp methods/finitedifferences/pde.hpp methods/finitedifferences/pdebsm.hpp - methods/finitedifferences/pdeshortrate.hpp methods/finitedifferences/schemes/boundaryconditionschemehelper.hpp methods/finitedifferences/schemes/craigsneydscheme.hpp methods/finitedifferences/schemes/cranknicolsonscheme.hpp @@ -1627,7 +1614,6 @@ set(QL_HEADERS methods/finitedifferences/schemes/methodoflinesscheme.hpp methods/finitedifferences/schemes/modifiedcraigsneydscheme.hpp methods/finitedifferences/schemes/trbdf2scheme.hpp - methods/finitedifferences/shoutcondition.hpp methods/finitedifferences/solvers/fdm1dimsolver.hpp methods/finitedifferences/solvers/fdm2dblackscholessolver.hpp methods/finitedifferences/solvers/fdm2dimsolver.hpp @@ -1739,7 +1725,6 @@ set(QL_HEADERS models/marketmodels/driftcomputation/lmmdriftcalculator.hpp models/marketmodels/driftcomputation/lmmnormaldriftcalculator.hpp models/marketmodels/driftcomputation/smmdriftcalculator.hpp - models/marketmodels/duffsdeviceinnerproduct.hpp models/marketmodels/evolutiondescription.hpp models/marketmodels/evolver.hpp models/marketmodels/evolvers/lognormalcmswapratepc.hpp @@ -1966,14 +1951,11 @@ set(QL_HEADERS pricingengines/vanilla/fdblackscholesshoutengine.hpp pricingengines/vanilla/fdcirvanillaengine.hpp pricingengines/vanilla/fdcevvanillaengine.hpp - pricingengines/vanilla/fdconditions.hpp - pricingengines/vanilla/fddividendengine.hpp pricingengines/vanilla/fdhestonhullwhitevanillaengine.hpp pricingengines/vanilla/fdhestonvanillaengine.hpp pricingengines/vanilla/fdmultiperiodengine.hpp pricingengines/vanilla/fdsabrvanillaengine.hpp pricingengines/vanilla/fdsimplebsswingengine.hpp - pricingengines/vanilla/fdstepconditionengine.hpp pricingengines/vanilla/fdvanillaengine.hpp pricingengines/vanilla/hestonexpansionengine.hpp pricingengines/vanilla/integralengine.hpp diff --git a/ql/cashflows/digitalcmscoupon.cpp b/ql/cashflows/digitalcmscoupon.cpp index 5225357c81f..7ec59e84350 100644 --- a/ql/cashflows/digitalcmscoupon.cpp +++ b/ql/cashflows/digitalcmscoupon.cpp @@ -185,11 +185,6 @@ namespace QuantLib { return *this; } - DigitalCmsLeg& DigitalCmsLeg::withReplication() { - replication_ = ext::make_shared(); - return *this; - } - DigitalCmsLeg& DigitalCmsLeg::withNakedOption(bool nakedOption) { nakedOption_ = nakedOption; return *this; diff --git a/ql/cashflows/digitalcmscoupon.hpp b/ql/cashflows/digitalcmscoupon.hpp index 8a6ccc2374f..824042e6f63 100644 --- a/ql/cashflows/digitalcmscoupon.hpp +++ b/ql/cashflows/digitalcmscoupon.hpp @@ -83,11 +83,6 @@ namespace QuantLib { DigitalCmsLeg& withPutPayoffs(Rate payoff); DigitalCmsLeg& withPutPayoffs(const std::vector& payoffs); DigitalCmsLeg& withReplication(const ext::shared_ptr&); - /*! \deprecated Use the overload that passes a replication instead. - Deprecated in version 1.32. - */ - [[deprecated("Use the overload that passes a replication instead")]] - DigitalCmsLeg& withReplication(); DigitalCmsLeg& withNakedOption(bool nakedOption = true); operator Leg() const; diff --git a/ql/cashflows/digitaliborcoupon.cpp b/ql/cashflows/digitaliborcoupon.cpp index d3c465fbb76..b0cd505750a 100644 --- a/ql/cashflows/digitaliborcoupon.cpp +++ b/ql/cashflows/digitaliborcoupon.cpp @@ -185,11 +185,6 @@ namespace QuantLib { return *this; } - DigitalIborLeg& DigitalIborLeg::withReplication() { - replication_ = ext::make_shared(); - return *this; - } - DigitalIborLeg& DigitalIborLeg::withNakedOption(bool nakedOption) { nakedOption_ = nakedOption; return *this; diff --git a/ql/cashflows/digitaliborcoupon.hpp b/ql/cashflows/digitaliborcoupon.hpp index 293bfdcb62c..758856b6b45 100644 --- a/ql/cashflows/digitaliborcoupon.hpp +++ b/ql/cashflows/digitaliborcoupon.hpp @@ -83,11 +83,6 @@ namespace QuantLib { DigitalIborLeg& withPutPayoffs(Rate payoff); DigitalIborLeg& withPutPayoffs(const std::vector& payoffs); DigitalIborLeg& withReplication(const ext::shared_ptr&); - /*! \deprecated Use the overload that passes a replication instead. - Deprecated in version 1.32. - */ - [[deprecated("Use the overload that passes a replication instead")]] - DigitalIborLeg& withReplication(); DigitalIborLeg& withNakedOption(bool nakedOption = true); operator Leg() const; diff --git a/ql/experimental/coupons/digitalcmsspreadcoupon.cpp b/ql/experimental/coupons/digitalcmsspreadcoupon.cpp index a982ba6b440..64d486b5f8c 100644 --- a/ql/experimental/coupons/digitalcmsspreadcoupon.cpp +++ b/ql/experimental/coupons/digitalcmsspreadcoupon.cpp @@ -184,11 +184,6 @@ namespace QuantLib { return *this; } - DigitalCmsSpreadLeg& DigitalCmsSpreadLeg::withReplication() { - replication_ = ext::make_shared(); - return *this; - } - DigitalCmsSpreadLeg& DigitalCmsSpreadLeg::withNakedOption(bool nakedOption) { nakedOption_ = nakedOption; return *this; diff --git a/ql/experimental/coupons/digitalcmsspreadcoupon.hpp b/ql/experimental/coupons/digitalcmsspreadcoupon.hpp index 169447ed8d1..df0f906a70a 100644 --- a/ql/experimental/coupons/digitalcmsspreadcoupon.hpp +++ b/ql/experimental/coupons/digitalcmsspreadcoupon.hpp @@ -81,11 +81,6 @@ namespace QuantLib { DigitalCmsSpreadLeg& withPutPayoffs(Rate payoff); DigitalCmsSpreadLeg& withPutPayoffs(const std::vector& payoffs); DigitalCmsSpreadLeg& withReplication(const ext::shared_ptr&); - /*! \deprecated Use the overload that passes a replication instead. - Deprecated in version 1.32. - */ - [[deprecated("Use the overload that passes a replication instead")]] - DigitalCmsSpreadLeg& withReplication(); DigitalCmsSpreadLeg& withNakedOption(bool nakedOption = true); operator Leg() const; diff --git a/ql/experimental/exoticoptions/Makefile.am b/ql/experimental/exoticoptions/Makefile.am index 3bbbe2bd090..d14a9c0cc10 100644 --- a/ql/experimental/exoticoptions/Makefile.am +++ b/ql/experimental/exoticoptions/Makefile.am @@ -4,32 +4,23 @@ AM_CPPFLAGS = -I${top_builddir} -I${top_srcdir} this_includedir=${includedir}/${subdir} this_include_HEADERS = \ all.hpp \ - analyticamericanmargrabeengine.hpp \ - analyticcomplexchooserengine.hpp \ - analyticcompoundoptionengine.hpp \ - analyticeuropeanmargrabeengine.hpp \ analyticholderextensibleoptionengine.hpp \ analyticpartialtimebarrieroptionengine.hpp \ analyticpdfhestonengine.hpp \ - analyticsimplechooserengine.hpp \ analytictwoassetbarrierengine.hpp \ analytictwoassetcorrelationengine.hpp \ analyticwriterextensibleoptionengine.hpp \ - complexchooseroption.hpp \ - compoundoption.hpp \ continuousarithmeticasianlevyengine.hpp \ continuousarithmeticasianvecerengine.hpp \ everestoption.hpp \ himalayaoption.hpp \ holderextensibleoption.hpp \ kirkspreadoptionengine.hpp \ - margrabeoption.hpp \ mceverestengine.hpp \ mchimalayaengine.hpp \ mcpagodaengine.hpp \ pagodaoption.hpp \ partialtimebarrieroption.hpp \ - simplechooseroption.hpp \ spreadoption.hpp \ twoassetbarrieroption.hpp \ twoassetcorrelationoption.hpp \ @@ -83,16 +74,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp \ - margrabeoption.hpp \ - analyticamericanmargrabeengine.hpp \ - analyticeuropeanmargrabeengine.hpp \ - compoundoption.hpp \ - analyticcompoundoptionengine.hpp \ - simplechooseroption.hpp \ - analyticsimplechooserengine.hpp \ - complexchooseroption.hpp \ - analyticcomplexchooserengine.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/experimental/exoticoptions/analyticamericanmargrabeengine.hpp b/ql/experimental/exoticoptions/analyticamericanmargrabeengine.hpp deleted file mode 100644 index c8658a2c819..00000000000 --- a/ql/experimental/exoticoptions/analyticamericanmargrabeengine.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2010 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/analyticcomplexchooserengine.hpp b/ql/experimental/exoticoptions/analyticcomplexchooserengine.hpp deleted file mode 100644 index 8f7d91d31ca..00000000000 --- a/ql/experimental/exoticoptions/analyticcomplexchooserengine.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2014 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/analyticcompoundoptionengine.hpp b/ql/experimental/exoticoptions/analyticcompoundoptionengine.hpp deleted file mode 100644 index 23d6603bf27..00000000000 --- a/ql/experimental/exoticoptions/analyticcompoundoptionengine.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2009 Dimitri Reiswich - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/analyticeuropeanmargrabeengine.hpp b/ql/experimental/exoticoptions/analyticeuropeanmargrabeengine.hpp deleted file mode 100644 index 77b1b9f02ce..00000000000 --- a/ql/experimental/exoticoptions/analyticeuropeanmargrabeengine.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2010 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/analyticsimplechooserengine.hpp b/ql/experimental/exoticoptions/analyticsimplechooserengine.hpp deleted file mode 100644 index c1c389f8044..00000000000 --- a/ql/experimental/exoticoptions/analyticsimplechooserengine.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2010 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/complexchooseroption.hpp b/ql/experimental/exoticoptions/complexchooseroption.hpp deleted file mode 100644 index 673a3d76a82..00000000000 --- a/ql/experimental/exoticoptions/complexchooseroption.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2014 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/compoundoption.hpp b/ql/experimental/exoticoptions/compoundoption.hpp deleted file mode 100644 index e3b27458cb8..00000000000 --- a/ql/experimental/exoticoptions/compoundoption.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2009 Dimitri Reiswich - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/margrabeoption.hpp b/ql/experimental/exoticoptions/margrabeoption.hpp deleted file mode 100644 index 4f758cb247c..00000000000 --- a/ql/experimental/exoticoptions/margrabeoption.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2010 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/exoticoptions/simplechooseroption.hpp b/ql/experimental/exoticoptions/simplechooseroption.hpp deleted file mode 100644 index 32e032bc24a..00000000000 --- a/ql/experimental/exoticoptions/simplechooseroption.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2010 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -// Deprecated in version 1.32 -#pragma message("Warning: this file will disappear in a future release; include instead.") - -#include diff --git a/ql/experimental/termstructures/Makefile.am b/ql/experimental/termstructures/Makefile.am index 8c4743d0d3b..e7d989a53af 100644 --- a/ql/experimental/termstructures/Makefile.am +++ b/ql/experimental/termstructures/Makefile.am @@ -5,8 +5,7 @@ this_includedir=${includedir}/${subdir} this_include_HEADERS = \ all.hpp \ basisswapratehelpers.hpp \ - crosscurrencyratehelpers.hpp \ - multicurvesensitivities.hpp + crosscurrencyratehelpers.hpp cpp_files = \ basisswapratehelpers.cpp \ @@ -39,7 +38,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp multicurvesensitivities.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/experimental/termstructures/multicurvesensitivities.hpp b/ql/experimental/termstructures/multicurvesensitivities.hpp deleted file mode 100644 index 14d22630baf..00000000000 --- a/ql/experimental/termstructures/multicurvesensitivities.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/*! - Copyright (C) 2016 Michael von den Driesch - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -#ifndef quantlib_multicurve_sensitivity_hpp -#define quantlib_multicurve_sensitivity_hpp - -// Deprecated in version 1.32 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") - -#endif diff --git a/ql/functional.hpp b/ql/functional.hpp index 4bb48692666..f4968bd66fa 100644 --- a/ql/functional.hpp +++ b/ql/functional.hpp @@ -66,12 +66,6 @@ namespace QuantLib::ext { #pragma GCC diagnostic pop #endif - /*! \deprecated To check if a function is empty, use it in a bool context - instead of comparing it to QL_NULL_FUNCTION. - Deprecated in version 1.32. - */ - #define QL_NULL_FUNCTION nullptr - } diff --git a/ql/math/Makefile.am b/ql/math/Makefile.am index 46ccd1efc77..bff247cdf0a 100644 --- a/ql/math/Makefile.am +++ b/ql/math/Makefile.am @@ -53,8 +53,7 @@ cpp_files = \ primenumbers.cpp \ quadratic.cpp \ richardsonextrapolation.cpp \ - rounding.cpp \ - sampledcurve.cpp + rounding.cpp if UNITY_BUILD @@ -92,7 +91,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp sampledcurve.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/math/all.hpp b/ql/math/all.hpp index 7df092f2b55..4640f657c9b 100644 --- a/ql/math/all.hpp +++ b/ql/math/all.hpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/ql/math/sampledcurve.cpp b/ql/math/sampledcurve.cpp deleted file mode 100644 index 8cd0fa46d1f..00000000000 --- a/ql/math/sampledcurve.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2005 Joseph Wang - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -#include - -namespace QuantLib { - - Real SampledCurve::valueAtCenter() const { - QL_REQUIRE(!empty(), "empty sampled curve"); - Size jmid = size()/2; - if (size() % 2 == 1) - return values_[jmid]; - else - return (values_[jmid]+values_[jmid-1])/2.0; - } - - Real SampledCurve::firstDerivativeAtCenter() const { - QL_REQUIRE(size()>=3, - "the size of the curve must be at least 3"); - Size jmid = size()/2; - if (size() % 2 == 1) { - return (values_[jmid+1]-values_[jmid-1])/ - (grid_[jmid+1]-grid_[jmid-1]); - } else { - return (values_[jmid]-values_[jmid-1])/ - (grid_[jmid]-grid_[jmid-1]); - } - } - - Real SampledCurve::secondDerivativeAtCenter() const { - QL_REQUIRE(size()>=4, - "the size of the curve must be at least 4"); - Size jmid = size()/2; - if (size() % 2 == 1) { - Real deltaPlus = (values_[jmid+1]-values_[jmid])/ - (grid_[jmid+1]-grid_[jmid]); - Real deltaMinus = (values_[jmid]-values_[jmid-1])/ - (grid_[jmid]-grid_[jmid-1]); - Real dS = (grid_[jmid+1]-grid_[jmid-1])/2.0; - return (deltaPlus-deltaMinus)/dS; - } else { - Real deltaPlus = (values_[jmid+1]-values_[jmid-1])/ - (grid_[jmid+1]-grid_[jmid-1]); - Real deltaMinus = (values_[jmid]-values_[jmid-2])/ - (grid_[jmid]-grid_[jmid-2]); - return (deltaPlus-deltaMinus)/ - (grid_[jmid]-grid_[jmid-1]); - } - } - - void SampledCurve::regrid(const Array &new_grid) { - CubicInterpolation priceSpline(grid_.begin(), grid_.end(), - values_.begin(), - CubicInterpolation::Spline, false, - CubicInterpolation::SecondDerivative, 0.0, - CubicInterpolation::SecondDerivative, 0.0); - priceSpline.update(); - Array newValues(new_grid.size()); - Array::iterator val; - Array::const_iterator grid; - for (val = newValues.begin(), grid = new_grid.begin() ; - grid != new_grid.end(); - ++val, ++grid) { - *val = priceSpline(*grid, true); - } - values_.swap(newValues); - grid_ = new_grid; - } - -} - diff --git a/ql/math/sampledcurve.hpp b/ql/math/sampledcurve.hpp index 0b747466c76..bd303add80d 100644 --- a/ql/math/sampledcurve.hpp +++ b/ql/math/sampledcurve.hpp @@ -17,237 +17,11 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file sampledcurve.hpp - \brief a class that contains a sampled curve -*/ - #ifndef quantlib_sampled_curve_hpp #define quantlib_sampled_curve_hpp -#include -#include -#include - -namespace QuantLib { - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.32. - */ - class [[deprecated("Use the new finite-differences framework instead")]] SampledCurve { - public: - SampledCurve(Size gridSize = 0); - SampledCurve(const Array &grid); - - //! \name inspectors - //@{ - const Array& grid() const; - Array& grid(); - const Array& values() const; - Array& values(); - Real gridValue(Size i) const; - Real& gridValue(Size i); - Real value(Size i) const; - Real& value(Size i); - Size size() const; - bool empty() const; - //@} - - //! \name modifiers - //@{ - void setGrid(const Array&); - void setValues(const Array&); - template - void sample(const F& f) { - Array::iterator i, j; - for(i=grid_.begin(), j = values_.begin(); - i != grid_.end(); ++i, ++j) - *j = f(*i); - } - //@} - - //! \name calculations - //@{ - /*! \todo replace or complement with a more general function - valueAt(spot) - */ - Real valueAtCenter() const; - /*! \todo replace or complement with a more general function - firstDerivativeAt(spot) - */ - Real firstDerivativeAtCenter() const; - /*! \todo replace or complement with a more general function - secondDerivativeAt(spot) - */ - Real secondDerivativeAtCenter() const; - //@} - - //! \name utilities - //@{ - QL_DEPRECATED_DISABLE_WARNING - void swap(SampledCurve&) noexcept; - QL_DEPRECATED_ENABLE_WARNING - void setLogGrid(Real min, Real max) { - setGrid(BoundedLogGrid(min, max, size()-1)); - } - void regridLogGrid(Real min, Real max) { - regrid(BoundedLogGrid(min, max, size() - 1), - [](Real x) -> Real { return std::log(x); }); - } - void shiftGrid(Real s) { - grid_ += s; - } - void scaleGrid(Real s) { - grid_ *= s; - } - - void regrid(const Array &new_grid); - -#if defined(__GNUC__) && (__GNUC__ >= 7) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wnoexcept-type" -#endif - - template - void regrid(const Array &new_grid, - T func) { - Array transformed_grid(grid_.size()); - - std::transform(grid_.begin(), grid_.end(), - transformed_grid.begin(), func); - CubicInterpolation priceSpline(transformed_grid.begin(), - transformed_grid.end(), - values_.begin(), - CubicInterpolation::Spline, false, - CubicInterpolation::SecondDerivative, 0.0, - CubicInterpolation::SecondDerivative, 0.0); - priceSpline.update(); - - Array newValues = new_grid; - std::transform(newValues.begin(), newValues.end(), - newValues.begin(), func); - for (Real& newValue : newValues) { - newValue = priceSpline(newValue, true); - } - values_.swap(newValues); - grid_ = new_grid; - } - -#if defined(__GNUC__) && (__GNUC__ >= 7) -#pragma GCC diagnostic pop -#endif - - QL_DEPRECATED_DISABLE_WARNING - template - const SampledCurve& transform(T x) { - std::transform(values_.begin(), values_.end(), - values_.begin(), x); - return *this; - } - - template - const SampledCurve& transformGrid(T x) { - std::transform(grid_.begin(), grid_.end(), - grid_.begin(), x); - return *this; - } - QL_DEPRECATED_ENABLE_WARNING - //@} - private: - Array grid_; - Array values_; - }; - - QL_DEPRECATED_DISABLE_WARNING - - /* \relates SampledCurve */ - void swap(SampledCurve&, SampledCurve&) noexcept; - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.32. - */ - [[deprecated("Use the new finite-differences framework instead")]] - typedef SampledCurve SampledCurveSet; - - QL_DEPRECATED_ENABLE_WARNING - - - // inline definitions - - QL_DEPRECATED_DISABLE_WARNING - - inline SampledCurve::SampledCurve(Size gridSize) - : grid_(gridSize), values_(gridSize) {} - - inline SampledCurve::SampledCurve(const Array& grid) - : grid_(grid), values_(grid.size()) {} - - inline Array& SampledCurve::grid() { - return grid_; - } - - inline const Array& SampledCurve::grid() const { - return grid_; - } - - inline const Array& SampledCurve::values() const { - return values_; - } - - inline Array& SampledCurve::values() { - return values_; - } - - inline Real SampledCurve::gridValue(Size i) const { - return grid_[i]; - } - - inline Real& SampledCurve::gridValue(Size i) { - return grid_[i]; - } - - inline Real SampledCurve::value(Size i) const { - return values_[i]; - } - - inline Real& SampledCurve::value(Size i) { - return values_[i]; - } - - inline Size SampledCurve::size() const { - return grid_.size(); - } - - inline bool SampledCurve::empty() const { - return grid_.empty(); - } - - inline void SampledCurve::setGrid(const Array &g) { - grid_ = g; - } - - inline void SampledCurve::setValues(const Array &g) { - values_ = g; - } - - inline void SampledCurve::swap(SampledCurve& from) noexcept { - grid_.swap(from.grid_); - values_.swap(from.values_); - } - - inline void swap(SampledCurve& c1, SampledCurve& c2) noexcept { - c1.swap(c2); - } - - inline std::ostream& operator<<(std::ostream& out, - const SampledCurve& a) { - out << "[ " << a.grid() << "; " - << a.values() << " ]"; - return out; - } - - QL_DEPRECATED_ENABLE_WARNING - -} +// Deprecated in version 1.37 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") #endif diff --git a/ql/methods/finitedifferences/Makefile.am b/ql/methods/finitedifferences/Makefile.am index c6a4f056e92..e077fd986ba 100644 --- a/ql/methods/finitedifferences/Makefile.am +++ b/ql/methods/finitedifferences/Makefile.am @@ -23,8 +23,6 @@ this_include_HEADERS = \ parallelevolver.hpp \ pde.hpp \ pdebsm.hpp \ - pdeshortrate.hpp \ - shoutcondition.hpp \ stepcondition.hpp \ trbdf2.hpp \ tridiagonaloperator.hpp \ @@ -69,7 +67,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp shoutcondition.hpp pdeshortrate.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp bsmtermoperator.hpp fdtypedefs.hpp parallelevolver.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/methods/finitedifferences/all.hpp b/ql/methods/finitedifferences/all.hpp index 872f8b6b9cc..d549c19549a 100644 --- a/ql/methods/finitedifferences/all.hpp +++ b/ql/methods/finitedifferences/all.hpp @@ -3,19 +3,16 @@ #include #include -#include #include #include #include #include #include #include -#include #include #include #include #include -#include #include #include #include diff --git a/ql/methods/finitedifferences/bsmtermoperator.hpp b/ql/methods/finitedifferences/bsmtermoperator.hpp index e47f8c38a6c..34114882e05 100644 --- a/ql/methods/finitedifferences/bsmtermoperator.hpp +++ b/ql/methods/finitedifferences/bsmtermoperator.hpp @@ -17,26 +17,11 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file bsmtermoperator.hpp - \brief differential operator for Black-Scholes-Merton equation -*/ - #ifndef quantlib_bsm_term_operator_hpp #define quantlib_bsm_term_operator_hpp -#include -#include -#include -#include - -namespace QuantLib { - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.32. - */ - [[deprecated("Use the new finite-differences framework instead")]] - typedef PdeOperator BSMTermOperator; -} +// Deprecated in version 1.37 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") #endif diff --git a/ql/methods/finitedifferences/fdtypedefs.hpp b/ql/methods/finitedifferences/fdtypedefs.hpp index 01bd49b51ec..2d7675e0564 100644 --- a/ql/methods/finitedifferences/fdtypedefs.hpp +++ b/ql/methods/finitedifferences/fdtypedefs.hpp @@ -24,38 +24,8 @@ #ifndef quantlib_fd_typedefs_hpp #define quantlib_fd_typedefs_hpp -#include -#include - -namespace QuantLib { - - /*! \deprecated Define your typedef if needed. - Deprecated in version 1.32. - */ - [[deprecated("Define your typedef if needed")]] - typedef FiniteDifferenceModel< - CrankNicolson > - StandardFiniteDifferenceModel; - - QL_DEPRECATED_DISABLE_WARNING - - /*! \deprecated Define your typedef if needed. - Deprecated in version 1.32. - */ - [[deprecated("Define your typedef if needed")]] - typedef FiniteDifferenceModel > > - StandardSystemFiniteDifferenceModel; - - QL_DEPRECATED_ENABLE_WARNING - - /*! \deprecated Define your typedef if needed. - Deprecated in version 1.32. - */ - [[deprecated("Define your typedef if needed")]] - typedef StepCondition StandardStepCondition; - -} +// Deprecated in version 1.37 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") #endif diff --git a/ql/methods/finitedifferences/parallelevolver.hpp b/ql/methods/finitedifferences/parallelevolver.hpp index a293267df8c..a6f67b10060 100644 --- a/ql/methods/finitedifferences/parallelevolver.hpp +++ b/ql/methods/finitedifferences/parallelevolver.hpp @@ -32,98 +32,8 @@ #ifndef quantlib_system_evolver_hpp #define quantlib_system_evolver_hpp -#include -#include -#include -#include - -namespace QuantLib { - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.32. - */ - template - class [[deprecated("Use the new finite-differences framework instead")]] StepConditionSet { - typedef ext::shared_ptr > itemType; - std::vector stepConditions_; - public: - void applyTo(std::vector& a, Time t) const { - //#pragma omp parallel for - for (Size i=0; i < stepConditions_.size(); i++) { - stepConditions_[i]->applyTo(a[i], t); - } - } - void push_back(const itemType& a) { - stepConditions_.push_back(a); - } - }; - - template - class BoundaryConditionSet { - std::vector bcSet_; - public: - void push_back(const bc_set& a) { - bcSet_.push_back(a); - } - const bc_set& operator[](Size i) const { - return bcSet_[i]; - } - }; - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.32. - */ - template - class [[deprecated("Use the new finite-differences framework instead")]] ParallelEvolverTraits { - public: - typedef std::vector array_type; - typedef std::vector operator_type; - typedef std::vector bc_type; - typedef BoundaryConditionSet bc_set; - QL_DEPRECATED_DISABLE_WARNING - typedef StepConditionSet condition_type; - QL_DEPRECATED_ENABLE_WARNING - }; - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.32. - */ - template - class [[deprecated("Use the new finite-differences framework instead")]] ParallelEvolver { - public: - // typedefs - QL_DEPRECATED_DISABLE_WARNING - typedef ParallelEvolverTraits traits; - QL_DEPRECATED_ENABLE_WARNING - typedef typename traits::operator_type operator_type; - typedef typename traits::array_type array_type; - typedef typename traits::bc_set bc_set; - // constructors - ParallelEvolver(const operator_type& L, - const bc_set& bcs) { - evolvers_.reserve(L.size()); - for (Size i=0; i < L.size(); i++) { - evolvers_.push_back(ext::shared_ptr(new - Evolver(L[i], bcs[i]))); - } - } - void step(array_type& a, - Time t) { - //#pragma omp parallel for - for (Size i=0; i < evolvers_.size(); i++) { - evolvers_[i]->step(a[i], t); - } - } - void setStep(Time dt) { - for (Size i=0; i < evolvers_.size(); i++) { - evolvers_[i]->setStep(dt); - } - } - private: - std::vector > evolvers_; - }; - -} +// Deprecated in version 1.37 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") #endif diff --git a/ql/methods/finitedifferences/pdeshortrate.hpp b/ql/methods/finitedifferences/pdeshortrate.hpp deleted file mode 100644 index 5ccc4745c7a..00000000000 --- a/ql/methods/finitedifferences/pdeshortrate.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2005 Joseph Wang - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -#ifndef quantlib_pdeshortrate_hpp -#define quantlib_pdeshortrate_hpp - -// Deprecated in version 1.32 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") - - -#endif - diff --git a/ql/methods/finitedifferences/shoutcondition.hpp b/ql/methods/finitedifferences/shoutcondition.hpp deleted file mode 100644 index 28f16eaa156..00000000000 --- a/ql/methods/finitedifferences/shoutcondition.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl - Copyright (C) 2003, 2004, 2005 StatPro Italia srl - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -#ifndef quantlib_fd_shout_condition_hpp -#define quantlib_fd_shout_condition_hpp - -// Deprecated in version 1.32 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") - - -#endif diff --git a/ql/models/marketmodels/Makefile.am b/ql/models/marketmodels/Makefile.am index 701c5075664..1826bc55f5f 100644 --- a/ql/models/marketmodels/Makefile.am +++ b/ql/models/marketmodels/Makefile.am @@ -11,7 +11,6 @@ this_include_HEADERS = \ constrainedevolver.hpp \ curvestate.hpp \ discounter.hpp \ - duffsdeviceinnerproduct.hpp \ evolutiondescription.hpp \ evolver.hpp \ forwardforwardmappings.hpp \ @@ -80,7 +79,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp duffsdeviceinnerproduct.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/models/marketmodels/duffsdeviceinnerproduct.hpp b/ql/models/marketmodels/duffsdeviceinnerproduct.hpp deleted file mode 100644 index 90325dc6aa3..00000000000 --- a/ql/models/marketmodels/duffsdeviceinnerproduct.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2006 Ferdinando Ametrano - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - - -#ifndef quantlib_duffs_device_inner_product_hpp -#define quantlib_duffs_device_inner_product_hpp - -// Deprecated in version 1.32 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") - - -#endif diff --git a/ql/pricingengines/vanilla/Makefile.am b/ql/pricingengines/vanilla/Makefile.am index e9fa5cc3df7..c316b9cf923 100644 --- a/ql/pricingengines/vanilla/Makefile.am +++ b/ql/pricingengines/vanilla/Makefile.am @@ -30,16 +30,13 @@ this_include_HEADERS = \ fdblackscholesvanillaengine.hpp \ fdblackscholesshoutengine.hpp \ fdcevvanillaengine.hpp \ - fddividendengine.hpp \ fdhestonhullwhitevanillaengine.hpp \ fdhestonvanillaengine.hpp \ fdcirvanillaengine.hpp \ fdmultiperiodengine.hpp \ fdsabrvanillaengine.hpp \ fdsimplebsswingengine.hpp \ - fdstepconditionengine.hpp \ - fdvanillaengine.hpp \ - fdconditions.hpp \ + fdvanillaengine.hpp \ mcamericanengine.hpp \ mcdigitalengine.hpp \ mceuropeanengine.hpp \ @@ -49,7 +46,7 @@ this_include_HEADERS = \ mcvanillaengine.hpp \ qdfpamericanengine.hpp \ qdplusamericanengine.hpp - + cpp_files = \ analyticbsmhullwhiteengine.cpp \ analyticdigitalamericanengine.cpp \ @@ -81,7 +78,6 @@ cpp_files = \ fdcirvanillaengine.cpp \ fdsabrvanillaengine.cpp \ fdsimplebsswingengine.cpp \ - fdvanillaengine.cpp \ mcamericanengine.cpp \ mcdigitalengine.cpp \ mchestonhullwhiteengine.cpp \ @@ -114,7 +110,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp fdconditions.hpp fddividendengine.hpp fdstepconditionengine.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp fdmultiperiodengine.hpp fdvanillaengine.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/pricingengines/vanilla/all.hpp b/ql/pricingengines/vanilla/all.hpp index d2db86ead6d..4fc04856115 100644 --- a/ql/pricingengines/vanilla/all.hpp +++ b/ql/pricingengines/vanilla/all.hpp @@ -30,10 +30,8 @@ #include #include #include -#include #include #include -#include #include #include #include diff --git a/ql/pricingengines/vanilla/fdconditions.hpp b/ql/pricingengines/vanilla/fdconditions.hpp deleted file mode 100644 index baf4ca1f22f..00000000000 --- a/ql/pricingengines/vanilla/fdconditions.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2005 Joseph Wang - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -#ifndef quantlib_fd_conditions_hpp -#define quantlib_fd_conditions_hpp - -// Deprecated in version 1.32 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") - - -#endif diff --git a/ql/pricingengines/vanilla/fddividendengine.hpp b/ql/pricingengines/vanilla/fddividendengine.hpp deleted file mode 100644 index 23e051723de..00000000000 --- a/ql/pricingengines/vanilla/fddividendengine.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - Copyright (C) 2005 Joseph Wang - Copyright (C) 2007, 2009 StatPro Italia srl - - This file is part of QuantLib, a free-software/open-source library - for financial quantitative analysts and developers - http://quantlib.org/ - - QuantLib is free software: you can redistribute it and/or modify it - under the terms of the QuantLib license. You should have received a - copy of the license along with this program; if not, please email - . The license is also available online at - . - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the license for more details. -*/ - -#ifndef quantlib_fd_dividend_engine_hpp -#define quantlib_fd_dividend_engine_hpp - -// Deprecated in version 1.32 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") - - -#endif diff --git a/ql/pricingengines/vanilla/fdmultiperiodengine.hpp b/ql/pricingengines/vanilla/fdmultiperiodengine.hpp index bae66c733d5..59158c45076 100644 --- a/ql/pricingengines/vanilla/fdmultiperiodengine.hpp +++ b/ql/pricingengines/vanilla/fdmultiperiodengine.hpp @@ -18,205 +18,11 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file fdmultiperiodengine.hpp - \brief base engine for options with events happening at specific times -*/ - #ifndef quantlib_fd_multi_period_engine_hpp #define quantlib_fd_multi_period_engine_hpp -#include -#include -#include -#include -#include - -namespace QuantLib { - - QL_DEPRECATED_DISABLE_WARNING - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.32. - */ - template