QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
pathwiseproductcaplet.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Mark Joshi
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
21#ifndef quantlib_market_model_pathwise_caplet_hpp
22#define quantlib_market_model_pathwise_caplet_hpp
23
24#include <ql/types.hpp>
25#include <ql/models/marketmodels/pathwisemultiproduct.hpp>
26#include <ql/models/marketmodels/evolutiondescription.hpp>
27#include <vector>
28#include <memory>
29
30namespace QuantLib {
31
32 class EvolutionDescription;
33 class CurveState;
34
36
45 {
46 public:
47
49 const std::vector<Time>& rateTimes,
50 const std::vector<Real>& accruals,
51 const std::vector<Time>& paymentTimes,
52 const std::vector<Rate>& strikes);
53
54 ~MarketModelPathwiseMultiCaplet() override = default;
55
56 std::vector<Size> suggestedNumeraires() const override;
57 const EvolutionDescription& evolution() const override;
58 std::vector<Time> possibleCashFlowTimes() const override;
59 Size numberOfProducts() const override;
61
62 // has division by the numeraire already been done?
63 bool alreadyDeflated() const override;
64
65
67 void reset() override;
68
70
71 bool nextTimeStep(const CurveState& currentState,
72 std::vector<Size>& numberCashFlowsThisStep,
73 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >&
74 cashFlowsGenerated) override;
75
77 std::unique_ptr<MarketModelPathwiseMultiProduct> clone() const override;
78
79 private:
80 std::vector<Real> rateTimes_;
81 std::vector<Real> accruals_;
82 std::vector<Time> paymentTimes_;
83 std::vector<Rate> strikes_;
85 // things that vary in a path
87
89 };
90
92 {
93 public:
94
96 const std::vector<Time>& rateTimes,
97 const std::vector<Real>& accruals,
98 const std::vector<Time>& paymentTimes,
99 const std::vector<Rate>& strikes);
100
101 MarketModelPathwiseMultiDeflatedCaplet(const std::vector<Time>& rateTimes,
102 const std::vector<Real>& accruals,
103 const std::vector<Time>& paymentTimes,
104 Rate strike);
105
107
108 std::vector<Size> suggestedNumeraires() const override;
109 const EvolutionDescription& evolution() const override;
110 std::vector<Time> possibleCashFlowTimes() const override;
111 Size numberOfProducts() const override;
113
114 // has division by the numeraire already been done?
115 bool alreadyDeflated() const override;
116
117
119 void reset() override;
120
122
123 bool nextTimeStep(const CurveState& currentState,
124 std::vector<Size>& numberCashFlowsThisStep,
125 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >&
126 cashFlowsGenerated) override;
127
129 std::unique_ptr<MarketModelPathwiseMultiProduct> clone() const override;
130
131 private:
132 std::vector<Real> rateTimes_;
133 std::vector<Real> accruals_;
134 std::vector<Time> paymentTimes_;
135 std::vector<Rate> strikes_;
137 // things that vary in a path
139
141 };
142
149 {
150 public:
151 MarketModelPathwiseMultiDeflatedCap(const std::vector<Time>& rateTimes,
152 const std::vector<Real>& accruals,
153 const std::vector<Time>& paymentTimes,
154 Rate strike,
155 std::vector<std::pair<Size, Size> > startsAndEnds);
156
157
159
160 std::vector<Size> suggestedNumeraires() const override;
161 const EvolutionDescription& evolution() const override;
162 std::vector<Time> possibleCashFlowTimes() const override;
163 Size numberOfProducts() const override;
165
166 // has division by the numeraire already been done?
167 bool alreadyDeflated() const override;
168
169
171 void reset() override;
172
174
175 bool nextTimeStep(const CurveState& currentState,
176 std::vector<Size>& numberCashFlowsThisStep,
177 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >&
178 cashFlowsGenerated) override;
179
181 std::unique_ptr<MarketModelPathwiseMultiProduct> clone() const override;
182
183 private:
185
187
188 std::vector<std::pair<Size,Size> > startsAndEnds_;
189
190 // things that vary in a path
192 std::vector<Size> innerCashFlowSizes_;
193 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> > innerCashFlowsGenerated_;
194
195 };
196
197
198}
199#endif
Curve state for market-model simulations
Definition: curvestate.hpp:41
Market-model evolution description.
std::vector< Size > suggestedNumeraires() const override
bool nextTimeStep(const CurveState &currentState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
std::unique_ptr< MarketModelPathwiseMultiProduct > clone() const override
returns a newly-allocated copy of itself
~MarketModelPathwiseMultiCaplet() override=default
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
void reset() override
during simulation put product at start of path
std::vector< Size > suggestedNumeraires() const override
bool nextTimeStep(const CurveState &currentState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
std::unique_ptr< MarketModelPathwiseMultiProduct > clone() const override
returns a newly-allocated copy of itself
MarketModelPathwiseMultiDeflatedCaplet underlyingCaplets_
std::vector< std::pair< Size, Size > > startsAndEnds_
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > innerCashFlowsGenerated_
void reset() override
during simulation put product at start of path
std::vector< Size > suggestedNumeraires() const override
bool nextTimeStep(const CurveState &currentState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
std::unique_ptr< MarketModelPathwiseMultiProduct > clone() const override
returns a newly-allocated copy of itself
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
void reset() override
during simulation put product at start of path
Real Rate
interest rates
Definition: types.hpp:70
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35