QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
gsrprocess.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) 2013, 2015 Peter Caspers
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
20/*! \file gsrprocess.hpp
21 \brief GSR model process with piecewise volatilities and mean reversions,
22 the dynamic is expressed in some T-forward measure.
23 If a single value for the mean reversion is provided, it is assumed
24 constant. Results are cached for performance reasons, so if parameters
25 change you need to call flushCache() to avoid inconsistent results.
26 For a derivation of the formulas, see http://ssrn.com/abstract=2246013
27*/
28
29#ifndef quantlib_gsr_process_hpp
30#define quantlib_gsr_process_hpp
31
35
36namespace QuantLib {
37
38 //! GSR stochastic process
39 /*! \ingroup processes */
41 public:
42 GsrProcess(const Array& times,
43 const Array& vols,
44 const Array& reversions,
45 Real T = 60.0,
46 const Date& referenceDate = Null<Date>(),
47 DayCounter dc = DayCounter());
48 //! \name StochasticProcess1D interface
49 //@{
50 Real x0() const override;
51 Real drift(Time t, Real x) const override;
52 Real diffusion(Time t, Real) const override;
53 Real expectation(Time t0, Real x0, Time dt) const override;
54 Real stdDeviation(Time t0, Real x0, Time dt) const override;
55 Real variance(Time t0, Real, Time dt) const override;
56 Real time(const Date& d) const override;
57 //@}
58 //! \name ForwardMeasureProcess1D interface
59 void setForwardMeasureTime(Time t) override;
60 //@}
61 //! additional inspectors
62 Real sigma(Time t) const;
63 Real reversion(Time t) const;
64 Real y(Time t) const;
65 Real G(Time t, Time T, Real x) const;
66 //! reset cache
67 void flushCache() const;
68
69 private:
70 void checkT(Time t) const;
74 };
75
76 // inline definitions
77
79 flushCache();
81 }
82
83 inline void GsrProcess::flushCache() const {
85 }
86
87} // namesapce QuantLib
88
89#endif
1-D array used in linear algebra.
Definition: array.hpp:52
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
forward-measure 1-D stochastic process
GSR stochastic process.
Definition: gsrprocess.hpp:40
Real G(Time t, Time T, Real x) const
Definition: gsrprocess.cpp:91
Real diffusion(Time t, Real) const override
returns the diffusion part of the equation, i.e.
Definition: gsrprocess.cpp:59
Real stdDeviation(Time t0, Real x0, Time dt) const override
Definition: gsrprocess.cpp:73
void checkT(Time t) const
Definition: gsrprocess.cpp:37
void flushCache() const
reset cache
Definition: gsrprocess.hpp:83
const detail::GsrProcessCore core_
Definition: gsrprocess.hpp:71
Real reversion(Time t) const
Definition: gsrprocess.cpp:84
Real drift(Time t, Real x) const override
returns the drift part of the equation, i.e.
Definition: gsrprocess.cpp:53
Real time(const Date &d) const override
Definition: gsrprocess.cpp:44
void setForwardMeasureTime(Time t) override
Definition: gsrprocess.hpp:78
Real expectation(Time t0, Real x0, Time dt) const override
Definition: gsrprocess.cpp:64
Real x0() const override
returns the initial value of the state variable
Definition: gsrprocess.cpp:51
template class providing a null value for a given type.
Definition: null.hpp:76
day counter class
const DefaultType & t
Date d
LinearInterpolation variance
forward-measure stochastic processes
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Core computations for the gsr process in risk neutral and T-forward measure.
Real sigma
Definition: any.hpp:35