QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
cmswapcurvestate.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, 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_cmswapcurvestate_hpp
23#define quantlib_cmswapcurvestate_hpp
24
26
27namespace QuantLib {
28
29 //! %Curve state for constant-maturity-swap market models
31 public:
32 explicit CMSwapCurveState(const std::vector<Time>& rateTimes,
33 Size spanningForwards);
34
35 //! \name Modifiers
36 //@{
37 void setOnCMSwapRates(const std::vector<Rate>& cmSwapRates,
38 Size firstValidIndex = 0);
39 //@}
40 //! \name Inspectors
41 //@{
42 Real discountRatio(Size i, Size j) const override;
43 Rate forwardRate(Size i) const override;
44
45 Rate coterminalSwapRate(Size i) const override;
46 Rate coterminalSwapAnnuity(Size numeraire, Size i) const override;
47
48 Rate cmSwapRate(Size i, Size spanningForwards) const override;
49 Rate cmSwapAnnuity(Size numeraire, Size i, Size spanningForwards) const override;
50 const std::vector<Rate>& forwardRates() const override;
51 const std::vector<Rate>& coterminalSwapRates() const override;
52 const std::vector<Rate>& cmSwapRates(Size spanningForwards) const override;
53 std::unique_ptr<CurveState> clone() const override;
54 //@}
55 private:
58 std::vector<DiscountFactor> discRatios_;
59 mutable std::vector<Rate> forwardRates_;
60 // fixed number of spanning forwards
61 std::vector<Rate> cmSwapRates_;
62 std::vector<Real> cmSwapAnnuities_;
63 // irregular number of spanning forwards
64 mutable std::vector<Rate> irrCMSwapRates_;
65 mutable std::vector<Real> irrCMSwapAnnuities_;
66 mutable std::vector<Rate> cotSwapRates_;
67 mutable std::vector<Real> cotAnnuities_;
68 };
69
70}
71
72#endif
Curve state for constant-maturity-swap market models
const std::vector< Rate > & cmSwapRates(Size spanningForwards) const override
Real discountRatio(Size i, Size j) const override
std::vector< Rate > forwardRates_
Rate cmSwapAnnuity(Size numeraire, Size i, Size spanningForwards) const override
std::vector< Real > irrCMSwapAnnuities_
Rate coterminalSwapRate(Size i) const override
Rate forwardRate(Size i) const override
Rate cmSwapRate(Size i, Size spanningForwards) const override
std::vector< Rate > irrCMSwapRates_
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_
void setOnCMSwapRates(const std::vector< Rate > &cmSwapRates, Size firstValidIndex=0)
std::unique_ptr< CurveState > clone() const override
std::vector< Real > cotAnnuities_
const std::vector< Rate > & coterminalSwapRates() const override
Curve state for market-model simulations
Definition: curvestate.hpp:41
const std::vector< Time > & rateTimes() const
Definition: curvestate.hpp:60
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