QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
pathwiseproductswaption.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) 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_swaption_hpp
22#define quantlib_market_model_pathwise_swaption_hpp
23
24#include <ql/types.hpp>
28#include <vector>
29#include <memory>
30
31namespace QuantLib {
32
33 class EvolutionDescription;
34 class CurveState;
35
36 /*!
37 Main use is to test market pathwise vegas. The swaptions are payers and co-terminal.
38 The class is tested in TestPathwiseVegas by running against the numerical version below.
39 */
41 {
42 public:
43
45 const std::vector<Time>& rateTimes,
46 const std::vector<Rate>& strikes);
47
49
50 std::vector<Size> suggestedNumeraires() const override;
51 const EvolutionDescription& evolution() const override;
52 std::vector<Time> possibleCashFlowTimes() const override;
53 Size numberOfProducts() const override;
55
56 // has division by the numeraire already been done?
57 bool alreadyDeflated() const override;
58
59
60 //! during simulation put product at start of path
61 void reset() override;
62
63 //! return value indicates whether path is finished, TRUE means done
64 bool nextTimeStep(const CurveState& currentState,
65 std::vector<Size>& numberCashFlowsThisStep,
66 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >&
67 cashFlowsGenerated) override;
68
69 //! returns a newly-allocated copy of itself
70 std::unique_ptr<MarketModelPathwiseMultiProduct> clone() const override;
71
72 private:
73 std::vector<Real> rateTimes_;
74 std::vector<Rate> strikes_;
76 // things that vary in a path
78
80 };
81
82 /*!
83 Easiest way to test MarketModelPathwiseCoterminalSwaptionsDeflated is by doing a numerical differentiation version.
84
85 */
87 {
88 public:
89
91 const std::vector<Time>& rateTimes,
92 const std::vector<Rate>& strikes,
94
96
97 std::vector<Size> suggestedNumeraires() const override;
98 const EvolutionDescription& evolution() const override;
99 std::vector<Time> possibleCashFlowTimes() const override;
100 Size numberOfProducts() const override;
102
103 // has division by the numeraire already been done?
104 bool alreadyDeflated() const override;
105
106
107 //! during simulation put product at start of path
108 void reset() override;
109
110 //! return value indicates whether path is finished, TRUE means done
111 bool nextTimeStep(const CurveState& currentState,
112 std::vector<Size>& numberCashFlowsThisStep,
113 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >&
114 cashFlowsGenerated) override;
115
116 //! returns a newly-allocated copy of itself
117 std::unique_ptr<MarketModelPathwiseMultiProduct> clone() const override;
118
119 private:
120 std::vector<Real> rateTimes_;
121 std::vector<Rate> strikes_;
123 // things that vary in a path
125
127
131 std::vector<Rate> forwards_;
132 };
133
134
135
136
137}
138
139
140#endif
Curve state for market-model simulations
Definition: curvestate.hpp:41
Market-model evolution description.
Curve state for Libor market models
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
const EvolutionDescription & evolution() const override
void reset() override
during simulation put product at start of path
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
void reset() override
during simulation put product at start of path
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Custom types.