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];
118 template <
class Interpolator>
148 Date d = c->dates()[i];
149 return c->zeroRate(
d, c->dayCounter(),
161 Real r = *(std::min_element(c->data().begin(), c->data().end()));
175 Real r = *(std::max_element(c->data().begin(), c->data().end()));
199 template <
class Interpolator>
229 Date d = c->dates()[i];
230 return c->forwardRate(
d,
d, c->dayCounter(),
242 Real r = *(std::min_element(c->data().begin(), c->data().end()));
256 Real r = *(std::max_element(c->data().begin(), c->data().end()));
279 template <
class Interpolator>
309 Date d = c->dates()[i];
310 return c->zeroRate(
d, c->dayCounter(),
323 Real r = *(std::min_element(c->data().begin(), c->data().end()));
324 result =
r<0.0 ?
Real(
r*2.0) :
r/2.0;
330 Real t = c->timeFromReference(c->dates()[i]);
331 return std::max(result, -1.0 /
t + 1E-8);
340 Real r = *(std::max_element(c->data().begin(), c->data().end()));
341 return r<0.0 ?
Real(
r/2.0) :
r*2.0;
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 minValueAfter(Size i, const C *c, bool validData, Size)
static Size maxIterations()
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 minValueAfter(Size, const C *c, bool validData, Size)
static Size maxIterations()
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 minValueAfter(Size i, const C *c, bool validData, Size)
static Size maxIterations()
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 minValueAfter(Size, const C *c, bool validData, Size)
static Size maxIterations()
static Real maxValueAfter(Size, const C *c, bool validData, Size)
interpolated zero-rates structure