QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
lmmcurvestate.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006, 2007 Ferdinando Ametrano
5 Copyright (C) 2006, 2007 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
22#ifndef quantlib_lmmcurvestate_hpp
23#define quantlib_lmmcurvestate_hpp
24
25#include <ql/models/marketmodels/curvestate.hpp>
26
27namespace QuantLib {
28
30
39 class LMMCurveState : public CurveState {
40 /* There will n+1 rate times expressing payment and reset times
41 of forward rates.
42
43 |-----|-----|-----|-----|-----| (size = 6)
44 t0 t1 t2 t3 t4 t5 rateTimes
45 f0 f1 f2 f3 f4 forwardRates
46 d0 d1 d2 d3 d4 d5 discountBonds
47 d0/d0 d1/d0 d2/d0 d3/d0 d4/d0 d5/d0 discountRatios
48 sr0 sr1 sr2 sr3 sr4 cotSwaps
49 */
50 public:
51 explicit LMMCurveState(const std::vector<Time>& rateTimes);
53
54 void setOnForwardRates(const std::vector<Rate>& fwdRates,
55 Size firstValidIndex = 0);
56
57 void setOnDiscountRatios(const std::vector<DiscountFactor>& discRatios,
58 Size firstValidIndex = 0);
60
62
63 Real discountRatio(Size i, Size j) const override;
64 Rate forwardRate(Size i) const override;
65
66 Rate coterminalSwapRate(Size i) const override;
67 Rate coterminalSwapAnnuity(Size numeraire, Size i) const override;
68
69 Rate cmSwapRate(Size i, Size spanningForwards) const override;
70 Rate cmSwapAnnuity(Size numeraire, Size i, Size spanningForwards) const override;
71 const std::vector<Rate>& forwardRates() const override;
72 const std::vector<Rate>& coterminalSwapRates() const override;
73 const std::vector<Rate>& cmSwapRates(Size spanningForwards) const override;
75 std::unique_ptr<CurveState> clone() const override;
76
77 private:
79 std::vector<DiscountFactor> discRatios_;
80 std::vector<Rate> forwardRates_;
81 mutable std::vector<Rate> cmSwapRates_;
82 mutable std::vector<Real> cmSwapAnnuities_;
83 mutable std::vector<Rate> cotSwapRates_;
84 mutable std::vector<Real> cotAnnuities_;
85
87 };
88
89}
90
91#endif
Curve state for market-model simulations
Definition: curvestate.hpp:41
const std::vector< Time > & rateTimes() const
Definition: curvestate.hpp:60
Curve state for Libor market models
const std::vector< Rate > & cmSwapRates(Size spanningForwards) const override
Real discountRatio(Size i, Size j) const override
std::vector< Rate > forwardRates_
void setOnForwardRates(const std::vector< Rate > &fwdRates, Size firstValidIndex=0)
void setOnDiscountRatios(const std::vector< DiscountFactor > &discRatios, Size firstValidIndex=0)
Rate cmSwapAnnuity(Size numeraire, Size i, Size spanningForwards) const override
Rate coterminalSwapRate(Size i) const override
Rate forwardRate(Size i) const override
Rate cmSwapRate(Size i, Size spanningForwards) const override
std::vector< Rate > cmSwapRates_
std::vector< Rate > cotSwapRates_
Rate coterminalSwapAnnuity(Size numeraire, Size i) const override
std::vector< Real > cmSwapAnnuities_
const std::vector< Rate > & forwardRates() const override
std::vector< DiscountFactor > discRatios_
std::unique_ptr< CurveState > clone() const override
std::vector< Real > cotAnnuities_
const std::vector< Rate > & coterminalSwapRates() const override
QL_REAL Real
real number
Definition: types.hpp:50
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35