QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
upperboundengine.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 Mark Joshi
5 Copyright (C) 2006 StatPro Italia srl
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_upper_bound_engine_hpp
23#define quantlib_upper_bound_engine_hpp
24
29#include <utility>
30#include <valarray>
31
32namespace QuantLib {
33
34 class MarketModelEvolver;
35 class MarketModelDiscounter;
36 class MarketModelMultiProduct;
37 class MarketModelExerciseValue;
38
39 //! Market-model %engine for upper-bound estimation
40 /*! \pre product and hedge must have the same rate times
41 and exercise times
42 */
44 public:
45 UpperBoundEngine(ext::shared_ptr<MarketModelEvolver> evolver,
46 std::vector<ext::shared_ptr<MarketModelEvolver> > innerEvolvers,
47 const MarketModelMultiProduct& underlying,
48 const MarketModelExerciseValue& rebate,
49 const MarketModelMultiProduct& hedge,
50 const MarketModelExerciseValue& hedgeRebate,
51 const ExerciseStrategy<CurveState>& hedgeStrategy,
52 Real initialNumeraireValue);
54 Size outerPaths,
55 Size innerPaths);
56 std::pair<Real,Real> singlePathValue(Size innerPaths);
57 private:
58 Real collectCashFlows(Size currentStep,
59 Real principalInNumerairePortfolio,
60 Size beginProduct,
61 Size endProduct) const;
62
63 ext::shared_ptr<MarketModelEvolver> evolver_;
64 std::vector<ext::shared_ptr<MarketModelEvolver> > innerEvolvers_;
66
72 std::valarray<bool> isExerciseTime_;
73
74 // workspace
75 std::vector<Size> numberCashFlowsThisStep_;
76 std::vector<std::vector<MarketModelMultiProduct::CashFlow> >
78 std::vector<MarketModelDiscounter> discounters_;
79 };
80
81}
82
83#endif
empirical-distribution risk measures
Composition of one or more market-model products.
Market-model engine for upper-bound estimation.
ext::shared_ptr< MarketModelEvolver > evolver_
std::vector< MarketModelDiscounter > discounters_
std::vector< ext::shared_ptr< MarketModelEvolver > > innerEvolvers_
MultiProductComposite composite_
std::vector< std::vector< MarketModelMultiProduct::CashFlow > > cashFlowsGenerated_
std::vector< Size > numberCashFlowsThisStep_
std::valarray< bool > isExerciseTime_
std::pair< Real, Real > singlePathValue(Size innerPaths)
Real collectCashFlows(Size currentStep, Real principalInNumerairePortfolio, Size beginProduct, Size endProduct) const
void multiplePathValues(Statistics &stats, Size outerPaths, Size innerPaths)
cloning proxy to an underlying object
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
Statistics tools for sequence (vector, list, array) samples.