QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
sensitivityanalysis.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008, 2010 Ferdinando Ametrano
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
24#ifndef quantlib_sensitivity_analysis_hpp
25#define quantlib_sensitivity_analysis_hpp
26
27#include <ql/types.hpp>
28#include <ql/utilities/null.hpp>
29#include <ql/shared_ptr.hpp>
30#include <vector>
31
32namespace QuantLib {
33
34 template <class T>
35 class Handle;
36 class Quote;
37 class SimpleQuote;
38 class Instrument;
39
44 };
45
47 std::ostream& operator<<(std::ostream&,
49
51 Real aggregateNPV(const std::vector<ext::shared_ptr<Instrument> >&,
52 const std::vector<Real>& quantities);
53
55
64 std::pair<Real, Real>
65 parallelAnalysis(const std::vector<Handle<SimpleQuote> >&,
66 const std::vector<ext::shared_ptr<Instrument> >&,
67 const std::vector<Real>& quantities,
68 Real shift = 0.0001,
70 Real referenceNpv = Null<Real>());
71
73
82 std::pair<Real, Real>
83 parallelAnalysis(const std::vector<std::vector<Handle<SimpleQuote> > >&,
84 const std::vector<ext::shared_ptr<Instrument> >&,
85 const std::vector<Real>& quantities,
86 Real shift = 0.0001,
88 Real referenceNpv = Null<Real>());
89
91
98 std::pair<Real, Real> bucketAnalysis(const Handle<SimpleQuote>& quote,
99 const std::vector<ext::shared_ptr<Instrument> >&,
100 const std::vector<Real>& quantities,
101 Real shift = 0.0001,
103 Real referenceNpv = Null<Real>());
104
106
114 void bucketAnalysis(std::vector<Real>& deltaVector, // result
115 std::vector<Real>& gammaVector, // result
116 std::vector<Real>& referenceValues,
117 const Handle<SimpleQuote>& quote,
118 const std::vector<Handle<Quote> >& parameters,
119 Real shift = 0.0001,
121
123
132 std::pair<std::vector<Real>, std::vector<Real> >
133 bucketAnalysis(const std::vector<Handle<SimpleQuote> >& quotes,
134 const std::vector<ext::shared_ptr<Instrument> >&,
135 const std::vector<Real>& quantities,
136 Real shift = 0.0001,
138
140
150 void
151 bucketAnalysis(std::vector<std::vector<Real> >& deltaMatrix, // result
152 std::vector<std::vector<Real> >& gammaMatrix, // result
153 const std::vector<Handle<SimpleQuote> >& quotes,
154 const std::vector<Handle<Quote> >& parameters,
155 Real shift = 0.0001,
157
158
160
169 std::pair<std::vector<std::vector<Real> >, std::vector<std::vector<Real> > >
170 bucketAnalysis(const std::vector<std::vector<Handle<SimpleQuote> > >&,
171 const std::vector<ext::shared_ptr<Instrument> >&,
172 const std::vector<Real>& quantities,
173 Real shift = 0.0001,
175
176}
177
178#endif
Shared handle to an observable.
Definition: handle.hpp:41
template class providing a null value for a given type.
Definition: null.hpp:76
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35
Real aggregateNPV(const vector< ext::shared_ptr< Instrument > > &instruments, const vector< Real > &quant)
utility fuction for weighted sum of NPVs
pair< Real, Real > parallelAnalysis(const vector< Handle< SimpleQuote > > &quotes, const vector< ext::shared_ptr< Instrument > > &instruments, const vector< Real > &quantities, Real shift, SensitivityAnalysis type, Real referenceNpv)
parallel shift PV01 sensitivity analysis for a SimpleQuote vector
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)
pair< Real, Real > bucketAnalysis(const Handle< SimpleQuote > &quote, const vector< ext::shared_ptr< Instrument > > &instruments, const vector< Real > &quantities, Real shift, SensitivityAnalysis type, Real referenceNpv)
(bucket) PV01 sensitivity analysis for a (single) SimpleQuote
SensitivityAnalysis
Finite differences calculation.