Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove features deprecated in version 1.19 #1147

Merged
merged 1 commit into from Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions ql/cashflows/inflationcouponpricer.hpp
Expand Up @@ -143,10 +143,6 @@ namespace QuantLib {
//! Black-formula pricer for capped/floored yoy inflation coupons
class BlackYoYInflationCouponPricer : public YoYInflationCouponPricer {
public:
/*! \deprecated Use one of the other constructors.
Deprecated in version 1.19.
*/
QL_DEPRECATED
BlackYoYInflationCouponPricer()
: YoYInflationCouponPricer(Handle<YoYOptionletVolatilitySurface>(),
Handle<YieldTermStructure>()) {}
Expand All @@ -167,10 +163,6 @@ namespace QuantLib {
//! Unit-Displaced-Black-formula pricer for capped/floored yoy inflation coupons
class UnitDisplacedBlackYoYInflationCouponPricer : public YoYInflationCouponPricer {
public:
/*! \deprecated Use one of the other constructors.
Deprecated in version 1.19.
*/
QL_DEPRECATED
UnitDisplacedBlackYoYInflationCouponPricer()
: YoYInflationCouponPricer(Handle<YoYOptionletVolatilitySurface>(),
Handle<YieldTermStructure>()) {}
Expand All @@ -191,10 +183,6 @@ namespace QuantLib {
//! Bachelier-formula pricer for capped/floored yoy inflation coupons
class BachelierYoYInflationCouponPricer : public YoYInflationCouponPricer {
public:
/*! \deprecated Use one of the other constructors.
Deprecated in version 1.19.
*/
QL_DEPRECATED
BachelierYoYInflationCouponPricer()
: YoYInflationCouponPricer(Handle<YoYOptionletVolatilitySurface>(),
Handle<YieldTermStructure>()) {}
Expand Down
12 changes: 0 additions & 12 deletions ql/indexes/bmaindex.cpp
Expand Up @@ -51,18 +51,6 @@ namespace QuantLib {
registerWith (h);
}

BMAIndex::BMAIndex(const Handle<YieldTermStructure>& h,
const Calendar& fixingCalendar)
: InterestRateIndex("BMA",
1 * Weeks,
1,
USDCurrency(),
fixingCalendar,
ActualActual(ActualActual::ISDA)),
termStructure_(h) {
registerWith (h);
}

bool BMAIndex::isValidFixingDate(const Date& date) const {
Calendar cal = fixingCalendar();
// either the fixing date is last Wednesday, or all days
Expand Down
6 changes: 0 additions & 6 deletions ql/indexes/bmaindex.hpp
Expand Up @@ -41,12 +41,6 @@ namespace QuantLib {
public:
explicit BMAIndex(const Handle<YieldTermStructure>& h =
Handle<YieldTermStructure>());
/*! \deprecated Use the other constructor instead.
Deprecated in version 1.19.
*/
QL_DEPRECATED
BMAIndex(const Handle<YieldTermStructure>& h,
const Calendar& fixingCalendar);
//! \name Index interface
//@{
/*! BMA is fixed weekly on Wednesdays.
Expand Down
17 changes: 0 additions & 17 deletions ql/methods/finitedifferences/americancondition.hpp
Expand Up @@ -41,14 +41,6 @@ namespace QuantLib {
explicit AmericanCondition(const Array& intrinsicValues)
: impl_(new ArrayImpl(intrinsicValues)) {}

/*! \deprecated Use the other constructor.
Deprecated in version 1.19.
*/
QL_DEPRECATED
AmericanCondition(Option::Type type,
Real strike)
: impl_(new PayoffImpl(type, strike)) {}

void applyTo(Array& a, Time) const override {
//#pragma omp parallel for
for (Size i = 0; i < a.size(); i++) {
Expand Down Expand Up @@ -79,15 +71,6 @@ namespace QuantLib {

Real getValue(const Array&, int i) override { return intrinsicValues_[i]; }
};

class PayoffImpl : public Impl {
private:
ext::shared_ptr<const Payoff> payoff_;
public:
PayoffImpl(Option::Type type, Real strike)
: payoff_(new PlainVanillaPayoff(type, strike)) {};
Real getValue(const Array& a, int i) override { return (*payoff_)(std::exp(a[i])); }
};
};
}

Expand Down
10 changes: 0 additions & 10 deletions ql/methods/finitedifferences/fdtypedefs.hpp
Expand Up @@ -42,16 +42,6 @@ namespace QuantLib {
//! default choice for step condition
typedef StepCondition<Array> StandardStepCondition;

QL_DEPRECATED_DISABLE_WARNING

/*! \deprecated Inherit from StandardStepCondition directly.
Deprecated in version 1.19.
*/
QL_DEPRECATED
typedef CurveDependentStepCondition<Array> StandardCurveDependentStepCondition;

QL_DEPRECATED_ENABLE_WARNING

}


Expand Down
21 changes: 0 additions & 21 deletions ql/methods/finitedifferences/shoutcondition.hpp
Expand Up @@ -46,17 +46,6 @@ namespace QuantLib {
: resTime_(resTime), rate_(rate),
impl_(new ArrayImpl(intrinsicValues)) {}

/*! \deprecated Use the other constructor.
Deprecated in version 1.19.
*/
QL_DEPRECATED
ShoutCondition(Option::Type type,
Real strike,
Time resTime,
Rate rate)
: resTime_(resTime), rate_(rate),
impl_(new PayoffImpl(type, strike)) {}

void applyTo(Array& a, Time t) const override {
DiscountFactor B = std::exp(-rate_ * (t - resTime_));
//#pragma omp parallel for
Expand Down Expand Up @@ -91,16 +80,6 @@ namespace QuantLib {

Real getValue(const Array&, int i) override { return intrinsicValues_[i]; }
};

class PayoffImpl : public Impl {
private:
ext::shared_ptr<const Payoff> payoff_;
public:
PayoffImpl(Option::Type type, Real strike)
: payoff_(new PlainVanillaPayoff(type, strike)) {};

Real getValue(const Array& a, int i) override { return (*payoff_)(std::exp(a[i])); }
};
};

}
Expand Down
81 changes: 0 additions & 81 deletions ql/methods/finitedifferences/stepcondition.hpp
Expand Up @@ -38,87 +38,6 @@ namespace QuantLib {
virtual void applyTo(array_type& a, Time t) const = 0;
};

/* */
/*! Abstract base class which allows step conditions to use both
payoff and array functions.

\deprecated Inherit from StepCondition directly instead.
Deprecated in version 1.19.
*/
template <class array_type>
class QL_DEPRECATED CurveDependentStepCondition :
public StepCondition<array_type> {
public:
void applyTo(Array &a, Time) const {
//#pragma omp parallel for
for (Size i = 0; i < a.size(); i++) {
a[i] =
applyToValue(a[i], getValue(a,i));
}
}
protected:

#if defined(QL_PATCH_MSVC)
#pragma warning(push)
#pragma warning(disable:4996)
#endif

CurveDependentStepCondition(Option::Type type, Real strike)
: curveItem_(new PayoffWrapper(type, strike)) {};
CurveDependentStepCondition(const Payoff *p)
: curveItem_(new PayoffWrapper(p)) {};
CurveDependentStepCondition(const array_type & a)
: curveItem_(new ArrayWrapper(a)) {};

#if defined(QL_PATCH_MSVC)
#pragma warning(pop)
#endif

class CurveWrapper;

ext::shared_ptr<CurveWrapper> curveItem_;
Real getValue(const array_type &a, Size index) const {
return curveItem_->getValue(a, index);
}

virtual Real applyToValue(Real, Real) const {
QL_FAIL("not yet implemented");
}

class CurveWrapper {
public:
virtual ~CurveWrapper() = default;
virtual Real getValue(const array_type &a,
int i) = 0;
};

class ArrayWrapper : public CurveWrapper {
private:
array_type value_;
public:
ArrayWrapper (const array_type &a)
: value_(a) {}

Real getValue(const array_type&, int i) {
return value_[i];
}
};

class PayoffWrapper : public CurveWrapper {
private:
ext::shared_ptr<const Payoff> payoff_;
public:
PayoffWrapper (const Payoff * p)
: payoff_(p) {};
PayoffWrapper (Option::Type type, Real strike)
: payoff_(new PlainVanillaPayoff(type, strike)) {};
Real getValue(const array_type &a,
int i) {
return (*payoff_)(a[i]);
}
};
};


//! %null step condition
/*! \ingroup findiff */
Expand Down
17 changes: 0 additions & 17 deletions ql/models/calibrationhelper.hpp
Expand Up @@ -58,23 +58,6 @@ namespace QuantLib {
registerWith(volatility_);
}

/*! \deprecated Use the other constructor. It you're
inheriting from BlackCalibrationHelper, move
`termStructure_` to your derived class.
Deprecated in version 1.19.
*/
QL_DEPRECATED
BlackCalibrationHelper(Handle<Quote> volatility,
Handle<YieldTermStructure> termStructure,
CalibrationErrorType calibrationErrorType = RelativePriceError,
const VolatilityType type = ShiftedLognormal,
const Real shift = 0.0)
: volatility_(std::move(volatility)), termStructure_(std::move(termStructure)),
volatilityType_(type), shift_(shift), calibrationErrorType_(calibrationErrorType) {
registerWith(volatility_);
registerWith(termStructure_);
}

void performCalculations() const override {
marketValue_ = blackPrice(volatility_->value());
}
Expand Down
105 changes: 0 additions & 105 deletions ql/termstructures/inflation/interpolatedyoyinflationcurve.hpp
Expand Up @@ -54,22 +54,6 @@ namespace QuantLib {
const std::vector<Rate>& rates,
const Interpolator& interpolator = Interpolator());

/*! \deprecated Use the constructor not taking a yield
term structure.
Deprecated in version 1.19.
*/
QL_DEPRECATED
InterpolatedYoYInflationCurve(const Date& referenceDate,
const Calendar& calendar,
const DayCounter& dayCounter,
const Period& lag,
Frequency frequency,
bool indexIsInterpolated,
const Handle<YieldTermStructure>& yTS,
std::vector<Date> dates,
const std::vector<Rate>& rates,
const Interpolator& interpolator = Interpolator());

//! \name InflationTermStructure interface
//@{
Date baseDate() const override;
Expand Down Expand Up @@ -105,22 +89,6 @@ namespace QuantLib {
bool indexIsInterpolated,
const Interpolator& interpolator
= Interpolator());

/*! \deprecated Use the constructor not taking a yield
term structure.
Deprecated in version 1.19.
*/
QL_DEPRECATED
InterpolatedYoYInflationCurve(const Date& referenceDate,
const Calendar& calendar,
const DayCounter& dayCounter,
Rate baseYoYRate,
const Period& lag,
Frequency frequency,
bool indexIsInterpolated,
const Handle<YieldTermStructure>& yTS,
const Interpolator& interpolator
= Interpolator());
};

typedef InterpolatedYoYInflationCurve<Linear> YoYInflationCurve;
Expand Down Expand Up @@ -186,64 +154,6 @@ namespace QuantLib {
this->interpolation_.update();
}

template <class Interpolator>
InterpolatedYoYInflationCurve<Interpolator>::InterpolatedYoYInflationCurve(
const Date& referenceDate,
const Calendar& calendar,
const DayCounter& dayCounter,
const Period& lag,
Frequency frequency,
bool indexIsInterpolated,
const Handle<YieldTermStructure>& yTS,
std::vector<Date> dates,
const std::vector<Rate>& rates,
const Interpolator& interpolator)
: YoYInflationTermStructure(
referenceDate, calendar, dayCounter, rates[0], lag, frequency, indexIsInterpolated, yTS),
InterpolatedCurve<Interpolator>(std::vector<Time>(), rates, interpolator),
dates_(std::move(dates)) {

QL_REQUIRE(dates_.size()>1, "too few dates: " << dates_.size());

// check that the data starts from the beginning,
// i.e. referenceDate - lag, at least must be in the relevant
// period
std::pair<Date,Date> lim =
inflationPeriod(referenceDate - this->observationLag(), frequency);
QL_REQUIRE(lim.first <= dates_[0] && dates_[0] <= lim.second,
"first data date is not in base period, date: " << dates_[0]
<< " not within [" << lim.first << "," << lim.second << "]");

QL_REQUIRE(this->data_.size() == dates_.size(),
"indices/dates count mismatch: "
<< this->data_.size() << " vs " << dates_.size());

this->times_.resize(dates_.size());
this->times_[0] = timeFromReference(dates_[0]);

for (Size i = 1; i < dates_.size(); i++) {
QL_REQUIRE(dates_[i] > dates_[i-1],
"dates not sorted");
// YoY inflation data may be positive or negative
// but must be greater than -1
QL_REQUIRE(this->data_[i] > -1.0,
"year-on-year inflation data < -100 %");

// this can be negative
this->times_[i] = timeFromReference(dates_[i]);

QL_REQUIRE(!close(this->times_[i],this->times_[i-1]),
"two dates correspond to the same time "
"under this curve's day count convention");
}

this->interpolation_ =
this->interpolator_.interpolate(this->times_.begin(),
this->times_.end(),
this->data_.begin());
this->interpolation_.update();
}

template <class Interpolator>
InterpolatedYoYInflationCurve<Interpolator>::
InterpolatedYoYInflationCurve(const Date& referenceDate,
Expand All @@ -258,21 +168,6 @@ namespace QuantLib {
lag, frequency, indexIsInterpolated),
InterpolatedCurve<Interpolator>(interpolator) {}

template <class Interpolator>
InterpolatedYoYInflationCurve<Interpolator>::
InterpolatedYoYInflationCurve(const Date& referenceDate,
const Calendar& calendar,
const DayCounter& dayCounter,
Rate baseYoYRate,
const Period& lag,
Frequency frequency,
bool indexIsInterpolated,
const Handle<YieldTermStructure>& yTS,
const Interpolator& interpolator)
: YoYInflationTermStructure(referenceDate, calendar, dayCounter, baseYoYRate,
lag, frequency, indexIsInterpolated, yTS),
InterpolatedCurve<Interpolator>(interpolator) {}


template <class T>
Date InterpolatedYoYInflationCurve<T>::baseDate() const{
Expand Down