QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
pathwiseproductcallspecified.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4Copyright (C) 2009 Mark Joshi
5
6This file is part of QuantLib, a free-software/open-source library
7for financial quantitative analysts and developers - http://quantlib.org/
8
9QuantLib is free software: you can redistribute it and/or modify it
10under the terms of the QuantLib license. You should have received a
11copy 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
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20
21#ifndef quantlib_market_model_pathwise_call_specified_hpp
22#define quantlib_market_model_pathwise_call_specified_hpp
23
24#include <ql/methods/montecarlo/exercisestrategy.hpp>
25#include <ql/models/marketmodels/curvestates/lmmcurvestate.hpp>
26#include <ql/models/marketmodels/evolutiondescription.hpp>
27#include <ql/models/marketmodels/pathwisemultiproduct.hpp>
28#include <ql/types.hpp>
29#include <ql/utilities/clone.hpp>
30#include <memory>
31#include <valarray>
32#include <vector>
33
34namespace QuantLib
35{
36 class curveState;
37
38
40 {
41 public:
47
48 std::vector<Size> suggestedNumeraires() const override;
49 const EvolutionDescription& evolution() const override;
50 std::vector<Time> possibleCashFlowTimes() const override;
51 Size numberOfProducts() const override;
53 void reset() override;
54 bool nextTimeStep(const CurveState& currentState,
55 std::vector<Size>& numberCashFlowsThisStep,
56 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >&
57 cashFlowsGenerated) override;
58
59 std::unique_ptr<MarketModelPathwiseMultiProduct> clone() const override;
60
61 bool alreadyDeflated() const override;
66 void enableCallability();
67 void disableCallability();
68
69
70 private:
75 std::vector<std::valarray<bool> > isPresent_;
76 std::vector<Time> cashFlowTimes_;
78 bool wasCalled_ = false;
79 std::vector<Size> dummyCashFlowsThisStep_;
80 std::vector<std::vector<CashFlow> > dummyCashFlowsGenerated_;
82 bool callable_ = true;
83 };
84
85}
86
87#endif
const ExerciseStrategy< CurveState > & strategy() const
std::vector< Size > suggestedNumeraires() const override
Clone< MarketModelPathwiseMultiProduct > underlying_
Clone< MarketModelPathwiseMultiProduct > rebate_
std::vector< std::vector< CashFlow > > dummyCashFlowsGenerated_
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 MarketModelPathwiseMultiProduct & underlying() const
const EvolutionDescription & evolution() const override
Clone< ExerciseStrategy< CurveState > > strategy_
const MarketModelPathwiseMultiProduct & rebate() const
void reset() override
during simulation put product at start of path
cloning proxy to an underlying object
Definition: clone.hpp:40
Curve state for market-model simulations
Definition: curvestate.hpp:41
Market-model evolution description.
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35