27#ifndef ql_bootstrap_traits_hpp
28#define ql_bootstrap_traits_hpp
46 template <
class Interpolator>
76 Real r = -std::log(c->data()[i-1])/c->times()[i-1];
77 return std::exp(-
r * c->times()[i]);
88 return *(std::min_element(c->data().begin(),
89 c->data().end()))/2.0;
91 Time dt = c->times()[i] - c->times()[i-1];
100 Time dt = c->times()[i] - c->times()[i-1];
130 template <
class Interpolator>
160 Date d = c->dates()[i];
161 return c->zeroRate(
d, c->dayCounter(),
173 Real r = *(std::min_element(c->data().begin(), c->data().end()));
187 Real r = *(std::max_element(c->data().begin(), c->data().end()));
223 template <
class Interpolator>
253 Date d = c->dates()[i];
254 return c->forwardRate(
d,
d, c->dayCounter(),
266 Real r = *(std::min_element(c->data().begin(), c->data().end()));
280 Real r = *(std::max_element(c->data().begin(), c->data().end()));
315 template <
class Interpolator>
345 Date d = c->dates()[i];
346 return c->zeroRate(
d, c->dayCounter(),
359 Real r = *(std::min_element(c->data().begin(), c->data().end()));
360 result =
r<0.0 ?
Real(
r*2.0) :
r/2.0;
366 return std::max(result, -1.0 / c->times()[i] + 1E-8);
375 Real r = *(std::max_element(c->data().begin(), c->data().end()));
376 return r<0.0 ?
Real(
r/2.0) :
r*2.0;
387 return std::exp(x) + (-1.0 / c->times()[i] + 1E-8);
392 return std::log(x - (-1.0 / c->times()[i] + 1E-8));
base helper class used for bootstrapping
Base helper class for bootstrapping.
YieldTermStructure based on interpolation of discount factors.
YieldTermStructure based on interpolation of forward rates.
YieldTermStructure based on interpolation of zero rates.
YieldTermStructure based on interpolation of zero rates.
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
Interest-rate term structure.
interpolated discount factor structure
interpolated forward-rate structure
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
interpolated simply-compounded zero-rates structure
ext::shared_ptr< YieldTermStructure > r
InterpolatedDiscountCurve< Interpolator > type
BootstrapHelper< YieldTermStructure > helper
static Real maxValueAfter(Size i, const C *c, bool validData, Size)
static void updateGuess(std::vector< Real > &data, Real discount, Size i)
static Date initialDate(const YieldTermStructure *c)
static Real initialValue(const YieldTermStructure *)
static Real guess(Size i, const C *c, bool validData, Size)
static Real transformInverse(Real x, Size i, const C *c)
static Real minValueAfter(Size i, const C *c, bool validData, Size)
static Size maxIterations()
static Real transformDirect(Real x, Size i, const C *c)
InterpolatedForwardCurve< Interpolator > type
BootstrapHelper< YieldTermStructure > helper
static Date initialDate(const YieldTermStructure *c)
static void updateGuess(std::vector< Real > &data, Real forward, Size i)
static Real initialValue(const YieldTermStructure *)
static Real guess(Size i, const C *c, bool validData, Size)
static Real transformInverse(Real x, Size i, const C *c)
static Real minValueAfter(Size, const C *c, bool validData, Size)
static Size maxIterations()
static Real transformDirect(Real x, Size i, const C *c)
static Real maxValueAfter(Size, const C *c, bool validData, Size)
InterpolatedSimpleZeroCurve< Interpolator > type
Simple Zero-curve traits.
BootstrapHelper< YieldTermStructure > helper
static void updateGuess(std::vector< Real > &data, Real rate, Size i)
static Date initialDate(const YieldTermStructure *c)
static Real initialValue(const YieldTermStructure *)
static Real guess(Size i, const C *c, bool validData, Size)
static Real transformInverse(Real x, Size i, const C *c)
static Real minValueAfter(Size i, const C *c, bool validData, Size)
static Size maxIterations()
static Real transformDirect(Real x, Size i, const C *c)
static Real maxValueAfter(Size, const C *c, bool validData, Size)
InterpolatedZeroCurve< Interpolator > type
BootstrapHelper< YieldTermStructure > helper
static void updateGuess(std::vector< Real > &data, Real rate, Size i)
static Date initialDate(const YieldTermStructure *c)
static Real initialValue(const YieldTermStructure *)
static Real guess(Size i, const C *c, bool validData, Size)
static Real transformInverse(Real x, Size i, const C *c)
static Real minValueAfter(Size, const C *c, bool validData, Size)
static Size maxIterations()
static Real transformDirect(Real x, Size i, const C *c)
static Real maxValueAfter(Size, const C *c, bool validData, Size)
interpolated zero-rates structure