QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
bootstraperror.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Ferdinando Ametrano
5 Copyright (C) 2007 Chris Kenyon
6 Copyright (C) 2007 StatPro Italia srl
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
22/*! \file bootstraperror.hpp
23 \brief boostrap error.
24*/
25
26#ifndef quantlib_bootstrap_error_hpp
27#define quantlib_bootstrap_error_hpp
28
29#include <ql/shared_ptr.hpp>
30#include <ql/types.hpp>
31#include <utility>
32
33namespace QuantLib {
34
35 //! bootstrap error
36 template <class Curve>
38 typedef typename Curve::traits_type Traits;
39 public:
40 BootstrapError(const Curve* curve,
41 ext::shared_ptr<typename Traits::helper> instrument,
42 Size segment);
43 Real operator()(Rate guess) const;
44 const ext::shared_ptr<typename Traits::helper>& helper() {
45 return helper_;
46 }
47 private:
48 const Curve* curve_;
49 const ext::shared_ptr<typename Traits::helper> helper_;
51 };
52
53
54 // template definitions
55
56 template <class Curve>
58 ext::shared_ptr<typename Traits::helper> helper,
59 Size segment)
60 : curve_(curve), helper_(std::move(helper)), segment_(segment) {}
61
62#ifndef __DOXYGEN__
63 template <class Curve>
65 Traits::updateGuess(curve_->data_, guess, segment_);
66 curve_->interpolation_.update();
67 return helper_->quoteError();
68 }
69 #endif
70
71}
72
73#endif
ZeroSpreadedTermStructure curve_
Definition: cashflows.cpp:1187
const ext::shared_ptr< typename Traits::helper > helper_
Real operator()(Rate guess) const
const ext::shared_ptr< typename Traits::helper > & helper()
BootstrapError(const Curve *curve, ext::shared_ptr< typename Traits::helper > instrument, Size segment)
Curve::traits_type Traits
ResettingLegHelper helper_
QL_REAL Real
real number
Definition: types.hpp:50
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
STL namespace.
Maps shared_ptr to either the boost or std implementation.
Custom types.