bootstrapping quantlib code example
Example: bootstrapping quantlib
template <class Traits, class Interpolator,
template <class> class Bootstrap = IterativeBootstrap>
class PiecewiseYieldCurve
: public Traits::template curve<Interpolator>::type,
public LazyObject {
private:
typedef typename Traits::template curve<Interpolator>::type base_curve;
typedef PiecewiseYieldCurve<Traits,Interpolator,Bootstrap> this_curve;
typedef typename Traits::helper helper;
public:
typedef Traits traits_type;
typedef Interpolator interpolator_type;
PiecewiseYieldCurve(
Natural settlementDays,
const Calendar& calendar,
const std::vector<shared_ptr<helper> >& instruments,
const DayCounter& dayCounter,
Real accuracy = 1.0e-12,
const Interpolator& i = Interpolator());
// inspectors not shown
void update();
private:
void performCalculations() const;
DiscountFactor discountImpl(Time) const;
std::vector<shared_ptr<helper> > instruments_;
Real accuracy_;
friend class Bootstrap<this_curve>;
friend class BootstrapError<this_curve>;
Bootstrap<this_curve> bootstrap_;
};