1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2005, 2006 Klaus Spanderen
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
/*! \file lfmprocess.hpp
\brief stochastic process of a libor forward model
*/
#ifndef quantlib_libor_forward_model_process_hpp
#define quantlib_libor_forward_model_process_hpp
#include <ql/cashflow.hpp>
#include <ql/indexes/iborindex.hpp>
#include <ql/termstructures/volatility/optionlet/optionletvolatilitystructure.hpp>
#include <ql/stochasticprocess.hpp>
#include <ql/legacy/libormarketmodels/lfmcovarparam.hpp>
namespace QuantLib {
//! libor-forward-model process
/*! stochastic process of a libor forward model using the
rolling forward measure incl. predictor-corrector step
References:
Glasserman, Paul, 2004, Monte Carlo Methods in Financial Engineering,
Springer, Section 3.7
Antoon Pelsser, 2000, Efficient Methods for Valuing Interest Rate
Derivatives, Springer, 8
Hull, John, White, Alan, 1999, Forward Rate Volatilities, Swap Rate
Volatilities and the Implementation of the Libor Market Model
(<http://www.rotman.utoronto.ca/~amackay/fin/libormktmodel2.pdf>)
\test the correctness is tested by Monte-Carlo reproduction of
caplet & ratchet NPVs and comparison with Black pricing.
\warning this class does not work correctly with Visual C++ 6.
\ingroup processes
*/
class LiborForwardModelProcess : public StochasticProcess {
public:
LiborForwardModelProcess(Size size,
const boost::shared_ptr<IborIndex>& index);
Disposable<Array> initialValues() const;
Disposable<Array> drift(Time t, const Array& x) const;
Disposable<Matrix> diffusion(Time t, const Array& x) const;
Disposable<Matrix> covariance(Time t0, const Array& x0, Time dt) const;
Disposable<Array> apply(const Array& x0, const Array& dx) const;
// implements the predictor-corrector schema
Disposable<Array> evolve(Time t0, const Array& x0,
Time dt, const Array& dw) const;
Size size() const;
Size factors() const;
boost::shared_ptr<IborIndex> index() const;
Leg cashFlows(
Real amount = 1.0) const;
void setCovarParam(
const boost::shared_ptr<LfmCovarianceParameterization>& param);
boost::shared_ptr<LfmCovarianceParameterization> covarParam() const;
// convenience support methods
Size nextIndexReset(Time t) const;
const std::vector<Time> & fixingTimes() const;
const std::vector<Date> & fixingDates() const;
const std::vector<Time> & accrualStartTimes() const;
const std::vector<Time> & accrualEndTimes() const;
std::vector<DiscountFactor> discountBond(
const std::vector<Rate> & rates) const;
private:
Size size_;
const boost::shared_ptr<IborIndex> index_;
boost::shared_ptr<LfmCovarianceParameterization> lfmParam_;
Array initialValues_;
std::vector<Time> fixingTimes_;
std::vector<Date> fixingDates_;
std::vector<Time> accrualStartTimes_;
std::vector<Time> accrualEndTimes_;
std::vector<Time> accrualPeriod_;
mutable Array m1, m2;
};
}
#endif
|