QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
pathwiseproductswap.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) 2009 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_swap_hpp
22#define quantlib_market_model_pathwise_swap_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 Swap for doing Greeks. Fairly useless when used directly, but if we want to look a breakable swap
38 it becomes useful.
39
40 */
42 {
43 public:
44
46 const std::vector<Time>& rateTimes,
47 const std::vector<Time>& accruals,
48 const std::vector<Rate>& strikes,
49 Real multiplier = 1.0 // easy way to swtich between payer and receiver
50 );
51
52 ~MarketModelPathwiseSwap() override = default;
53
54 std::vector<Size> suggestedNumeraires() const override;
55 const EvolutionDescription& evolution() const override;
56 std::vector<Time> possibleCashFlowTimes() const override;
57 Size numberOfProducts() const override;
59
60 // has division by the numeraire already been done?
61 bool alreadyDeflated() const override;
62
63
64 //! during simulation put product at start of path
65 void reset() override;
66
67 //! return value indicates whether path is finished, TRUE means done
68 bool nextTimeStep(const CurveState& currentState,
69 std::vector<Size>& numberCashFlowsThisStep,
70 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >&
71 cashFlowsGenerated) override;
72
73 //! returns a newly-allocated copy of itself
74 std::unique_ptr<MarketModelPathwiseMultiProduct> clone() const override;
75
76 private:
77 std::vector<Real> rateTimes_;
78 std::vector<Real> accruals_;
79 std::vector<Rate> strikes_;
82
83 // things that vary in a path
85
87 };
88}
89
90#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
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
Size maxNumberOfCashFlowsPerProductPerStep() const override
void reset() override
during simulation put product at start of path
~MarketModelPathwiseSwap() override=default
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.