QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
lfmprocess.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) 2005, 2006 Klaus Spanderen
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 lfmprocess.hpp
21 \brief stochastic process of a libor forward model
22*/
23
24#ifndef quantlib_libor_forward_model_process_hpp
25#define quantlib_libor_forward_model_process_hpp
26
27#include <ql/cashflow.hpp>
32
33namespace QuantLib {
34
35 //! libor-forward-model process
36 /*! stochastic process of a libor forward model using the
37 rolling forward measure incl. predictor-corrector step
38
39 References:
40
41 Glasserman, Paul, 2004, Monte Carlo Methods in Financial Engineering,
42 Springer, Section 3.7
43
44 Antoon Pelsser, 2000, Efficient Methods for Valuing Interest Rate
45 Derivatives, Springer, 8
46
47 Hull, John, White, Alan, 1999, Forward Rate Volatilities, Swap Rate
48 Volatilities and the Implementation of the Libor Market Model
49 (<http://www.rotman.utoronto.ca/~amackay/fin/libormktmodel2.pdf>)
50
51 \test the correctness is tested by Monte-Carlo reproduction of
52 caplet & ratchet NPVs and comparison with Black pricing.
53
54 \warning this class does not work correctly with Visual C++ 6.
55
56 \ingroup processes
57 */
59 public:
60 LiborForwardModelProcess(Size size, ext::shared_ptr<IborIndex> index);
61
62 Array initialValues() const override;
63 Array drift(Time t, const Array& x) const override;
64 Matrix diffusion(Time t, const Array& x) const override;
65 Matrix covariance(Time t0, const Array& x0, Time dt) const override;
66 Array apply(const Array& x0, const Array& dx) const override;
67
68 // implements the predictor-corrector schema
69 Array evolve(Time t0, const Array& x0, Time dt, const Array& dw) const override;
70
71 Size size() const override;
72 Size factors() const override;
73
74 ext::shared_ptr<IborIndex> index() const;
76 Real amount = 1.0) const;
77
78 void setCovarParam(
79 const ext::shared_ptr<LfmCovarianceParameterization>& param);
80 ext::shared_ptr<LfmCovarianceParameterization> covarParam() const;
81
82 // convenience support methods
84 const std::vector<Time> & fixingTimes() const;
85 const std::vector<Date> & fixingDates() const;
86 const std::vector<Time> & accrualStartTimes() const;
87 const std::vector<Time> & accrualEndTimes() const;
88
89 std::vector<DiscountFactor> discountBond(
90 const std::vector<Rate> & rates) const;
91
92 private:
94
95 const ext::shared_ptr<IborIndex> index_;
96 ext::shared_ptr<LfmCovarianceParameterization> lfmParam_;
97
99
100 std::vector<Time> fixingTimes_;
101 std::vector<Date> fixingDates_;
102 std::vector<Time> accrualStartTimes_;
103 std::vector<Time> accrualEndTimes_;
104 std::vector<Time> accrualPeriod_;
105
106 mutable Array m1, m2;
107 };
108
109}
110
111
112#endif
Base class for cash flows.
1-D array used in linear algebra.
Definition: array.hpp:52
libor-forward-model process
Definition: lfmprocess.hpp:58
Array drift(Time t, const Array &x) const override
returns the drift part of the equation, i.e.,
Definition: lfmprocess.cpp:68
Size size() const override
returns the number of dimensions of the stochastic process
Definition: lfmprocess.cpp:183
Leg cashFlows(Real amount=1.0) const
Definition: lfmprocess.cpp:167
Array evolve(Time t0, const Array &x0, Time dt, const Array &dw) const override
Definition: lfmprocess.cpp:103
const std::vector< Time > & fixingTimes() const
Definition: lfmprocess.cpp:191
std::vector< Date > fixingDates_
Definition: lfmprocess.hpp:101
const ext::shared_ptr< IborIndex > index_
Definition: lfmprocess.hpp:95
ext::shared_ptr< LfmCovarianceParameterization > lfmParam_
Definition: lfmprocess.hpp:96
Matrix diffusion(Time t, const Array &x) const override
returns the diffusion part of the equation, i.e.
Definition: lfmprocess.cpp:85
std::vector< Time > accrualPeriod_
Definition: lfmprocess.hpp:104
const std::vector< Time > & accrualEndTimes() const
Definition: lfmprocess.cpp:205
Size factors() const override
returns the number of independent factors of the process
Definition: lfmprocess.cpp:187
ext::shared_ptr< LfmCovarianceParameterization > covarParam() const
Definition: lfmprocess.cpp:157
std::vector< Time > accrualEndTimes_
Definition: lfmprocess.hpp:103
Matrix covariance(Time t0, const Array &x0, Time dt) const override
Definition: lfmprocess.cpp:89
const std::vector< Time > & accrualStartTimes() const
Definition: lfmprocess.cpp:200
Array initialValues() const override
returns the initial values of the state variables
Definition: lfmprocess.cpp:147
std::vector< Time > fixingTimes_
Definition: lfmprocess.hpp:100
std::vector< DiscountFactor > discountBond(const std::vector< Rate > &rates) const
Definition: lfmprocess.cpp:214
void setCovarParam(const ext::shared_ptr< LfmCovarianceParameterization > &param)
Definition: lfmprocess.cpp:151
Array apply(const Array &x0, const Array &dx) const override
Definition: lfmprocess.cpp:93
const std::vector< Date > & fixingDates() const
Definition: lfmprocess.cpp:195
ext::shared_ptr< IborIndex > index() const
Definition: lfmprocess.cpp:162
std::vector< Time > accrualStartTimes_
Definition: lfmprocess.hpp:102
Matrix used in linear algebra.
Definition: matrix.hpp:41
multi-dimensional stochastic process class.
const DefaultType & t
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
base class for Inter-Bank-Offered-Rate indexes
volatility & correlation function for libor forward model process
Definition: any.hpp:35
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
optionlet (caplet/floorlet) volatility structure
stochastic processes