QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
swapforwardmappings.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) 2006 Ferdinando Ametrano
5 Copyright (C) 2006, 2008 Mark Joshi
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file swapforwardmappings.hpp
22 \brief Utility functions for mapping between swap rate and forward rate
23*/
24
25#ifndef quantlib_swap_forward_mappings_hpp
26#define quantlib_swap_forward_mappings_hpp
27
28#include <ql/math/matrix.hpp>
29
30namespace QuantLib {
31
32 class CurveState;
33 class MarketModel;
34
36 public:
37
38 //! compute annuity of arbitrary swap-rate
39 static Real annuity(const CurveState& cs,
40 Size startIndex,
41 Size endIndex,
42 Size numeraireIndex);
43
44 //! compute derivative of swap-rate to underlying forward rate
45 static Real swapDerivative(const CurveState& cs,
46 Size startIndex,
47 Size endIndex,
48 Size forwardIndex);
49
50 /*! Returns the dsr[i]/df[j] jacobian between
51 coterminal swap rates and forward rates */
53
54 /*! Returns the Z matrix to switch base from forward to
55 coterminal swap rates */
56 static Matrix coterminalSwapZedMatrix(const CurveState& cs, Spread displacement);
57
58 /*! Returns the dsr[i]/df[j] jacobian between
59 coinitial swap rates and forward rates */
61
62 /*! Returns the Z matrix to switch base from forward to
63 coinitial swap rates */
64 static Matrix coinitialSwapZedMatrix(const CurveState& cs, Spread displacement);
65
66
67 /*! Returns the dsr[i]/df[j] jacobian between
68 constant maturity swap rates and forward rates */
70 Size spanningForwards);
71
72 /*! Returns the Z matrix to switch base from forward to
73 constant maturity swap rates */
74 static Matrix cmSwapZedMatrix(const CurveState& cs, Size spanningForwards, Spread displacement);
75
76 /*! computes the implied vol of a swaption specified by two indices
77 using the freezing coefficients methdodology. This routine is easy to use but not very efficient
78 and if you want to do a lot of cases, then a different approach should be used.
79
80 Tested in SwapForwardMappingsTest::testSwaptionImpliedVolatility() in swapforwardmappings.cpp
81 */
82 static Real
83 swaptionImpliedVolatility(const MarketModel& volStructure,
84 Size startIndex,
85 Size endIndex);
86
87 };
88
89}
90
91#endif
Curve state for market-model simulations
Definition: curvestate.hpp:41
base class for market models
Definition: marketmodel.hpp:39
Matrix used in linear algebra.
Definition: matrix.hpp:41
static Matrix coinitialSwapZedMatrix(const CurveState &cs, Spread displacement)
static Matrix coterminalSwapZedMatrix(const CurveState &cs, Spread displacement)
static Matrix cmSwapZedMatrix(const CurveState &cs, Size spanningForwards, Spread displacement)
static Real swaptionImpliedVolatility(const MarketModel &volStructure, Size startIndex, Size endIndex)
static Real swapDerivative(const CurveState &cs, Size startIndex, Size endIndex, Size forwardIndex)
compute derivative of swap-rate to underlying forward rate
static Matrix coinitialSwapForwardJacobian(const CurveState &cs)
static Real annuity(const CurveState &cs, Size startIndex, Size endIndex, Size numeraireIndex)
compute annuity of arbitrary swap-rate
static Matrix cmSwapForwardJacobian(const CurveState &cs, Size spanningForwards)
static Matrix coterminalSwapForwardJacobian(const CurveState &cs)
QL_REAL Real
real number
Definition: types.hpp:50
Real Spread
spreads on interest rates
Definition: types.hpp:74
std::size_t Size
size of a container
Definition: types.hpp:58
matrix used in linear algebra.
Definition: any.hpp:35