QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
discretizeddoublebarrieroption.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) 2015 Thema Consulting SA
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/*! \file discretizeddoublebarrieroption.hpp
21 \brief discretized double barrier option
22*/
23
24#ifndef quantlib_discretized_double_barrier_option_h
25#define quantlib_discretized_double_barrier_option_h
26
31
32namespace QuantLib {
33
34 //! Standard discretized option helper class
35 /*! This class is used with the BinomialDoubleBarrierEngine to
36 implement a standard binomial algorithm for double barrier
37 options
38 */
40 public:
42 const StochasticProcess& process,
43 const TimeGrid& grid = TimeGrid());
44
45 void reset(Size size) override;
46
47 const Array& vanilla() const {
48 return vanilla_.values();
49 }
50
52 return arguments_;
53 }
54
55 std::vector<Time> mandatoryTimes() const override { return stoppingTimes_; }
56
57 void checkBarrier(Array &optvalues, const Array &grid) const;
58 protected:
59 void postAdjustValuesImpl() override;
60
61 private:
63 std::vector<Time> stoppingTimes_;
65 };
66
67 //! Derman-Kani-Ergener-Bardhan discretized option helper class
68 /*! This class is used with the BinomialDoubleBarrierEngine to
69 implement the enhanced binomial algorithm of E.Derman, I.Kani,
70 D.Ergener, I.Bardhan ("Enhanced Numerical Methods for Options with
71 Barriers", 1995)
72
73 \note This algorithm is only suitable if the payoff can be approximated
74 linearly, e.g. is not usable for cash-or-nothing payoffs.
75 */
77 public:
79 const StochasticProcess& process,
80 const TimeGrid& grid = TimeGrid());
81
82 void reset(Size size) override;
83
84 std::vector<Time> mandatoryTimes() const override { return unenhanced_.mandatoryTimes(); }
85
86 protected:
87 void postAdjustValuesImpl() override;
88
89 private:
90 void adjustBarrier(Array &optvalues, const Array &grid);
92 };
93}
94
95#endif
Binomial trees under the BSM model.
1-D array used in linear algebra.
Definition: array.hpp:52
Discretized asset class used by numerical methods.
const Array & values() const
Derman-Kani-Ergener-Bardhan discretized option helper class.
Standard discretized option helper class.
void checkBarrier(Array &optvalues, const Array &grid) const
std::vector< Time > mandatoryTimes() const override
const DoubleBarrierOption::arguments & arguments() const
Arguments for double barrier option calculation
multi-dimensional stochastic process class.
time grid class
Definition: timegrid.hpp:43
Discretized asset classes.
discretized vanilla option
double Barrier european option on a single asset
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35