26#ifndef quantlib_fitted_bond_discount_curve_hpp
27#define quantlib_fitted_bond_discount_curve_hpp
90 std::vector<ext::shared_ptr<BondHelper> > bonds,
93 Real accuracy = 1.0e-10,
94 Size maxEvaluations = 10000,
96 Real simplexLambda = 1.0,
97 Size maxStationaryStateIterations = 100);
100 std::vector<ext::shared_ptr<BondHelper> > bonds,
103 Real accuracy = 1.0e-10,
104 Size maxEvaluations = 10000,
106 Real simplexLambda = 1.0,
107 Size maxStationaryStateIterations = 100);
197 virtual std::unique_ptr<FittingMethod>
clone()
const = 0;
213 ext::shared_ptr<OptimizationMethod>(),
215 Real minCutoffTime = 0.0,
310 return constrainAtZero_;
321 inline ext::shared_ptr<OptimizationMethod>
323 return optimizationMethod_;
327 if (
t < minCutoffTime_) {
329 return std::exp(std::log(discountFunction(x, minCutoffTime_)) / minCutoffTime_ *
t);
330 }
else if (
t > maxCutoffTime_) {
332 return discountFunction(x, maxCutoffTime_) *
333 std::exp((std::log(discountFunction(x, maxCutoffTime_ + 1E-4)) -
334 std::log(discountFunction(x, maxCutoffTime_))) *
335 1E4 * (
t - maxCutoffTime_));
337 return discountFunction(x,
t);
1-D array used in linear algebra.
1-D array used in linear algebra.
cloning proxy to an underlying object
Base fitting method used to construct a fitted bond discount curve.
FittedBondDiscountCurve * curve_
internal reference to the FittedBondDiscountCurve instance
virtual void init()
rerun every time instruments/referenceDate changes
Array weights() const
return weights being used
virtual Size size() const =0
total number of coefficients to fit/solve for
Array guessSolution_
optional guess solution to be passed into constructor.
ext::shared_ptr< OptimizationMethod > optimizationMethod_
bool constrainAtZero() const
return whether there is a constraint at zero
Real minimumCostValue() const
final value of cost function after optimization
Integer numberOfIterations() const
final number of iterations used in the optimization problem
Array solution_
solution array found from optimization, set in calculate()
bool constrainAtZero_
constrains discount function to unity at , if true
EndCriteria::Type errorCode_
virtual std::unique_ptr< FittingMethod > clone() const =0
clone of the current object
Integer numberOfIterations_
virtual ~FittingMethod()=default
virtual DiscountFactor discountFunction(const Array &x, Time t) const =0
discount function called by FittedBondDiscountCurve
EndCriteria::Type errorCode() const
error code of the optimization
Array l2() const
return l2 penalties being used
ext::shared_ptr< OptimizationMethod > optimizationMethod() const
return optimization method being used
ext::shared_ptr< FittingCost > costFunction_
base class sets this cost function used in the optimization routine
DiscountFactor discount(const Array &x, Time t) const
open discountFunction to public
Array solution() const
output array of results of optimization problem
Discount curve fitted to a set of fixed-coupon bonds.
const FittingMethod & fitResults() const
class holding the results of the fit
void performCalculations() const override
std::vector< ext::shared_ptr< BondHelper > > bondHelpers_
DiscountFactor discountImpl(Time) const override
discount factor calculation
Size maxStationaryStateIterations_
Date maxDate() const override
the latest date for which the curve can return values
Size numberOfBonds() const
total number of bonds used to fit the yield curve
Clone< FittingMethod > fittingMethod_
Framework for calculation on demand and result caching.
virtual void calculate() const
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
virtual Natural settlementDays() const
the settlementDays used for reference date calculation
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
virtual Calendar calendar() const
the calendar used for reference and/or option date calculation
virtual DayCounter dayCounter() const
the day counter used for date/time conversion
Interest-rate term structure.
cloning proxy to an underlying object
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
unsigned QL_INTEGER Natural
positive integer
QL_INTEGER Integer
integer number
std::size_t Size
size of a container
framework for calculation on demand and result caching
Abstract optimization method class.