QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
doublebarrieroption.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 doublebarrieroption.hpp
21 \brief double Barrier european option on a single asset
22*/
23
24#ifndef quantlib_double_barrier_option_hpp
25#define quantlib_double_barrier_option_hpp
26
30
31namespace QuantLib {
32
33 class GeneralizedBlackScholesProcess;
34
35 //! %Double Barrier option on a single asset.
36 /*! The analytic pricing engine will be used if none if passed.
37
38 \ingroup instruments
39 */
41 public:
42 class arguments;
43 class engine;
45 Real barrier_lo,
46 Real barrier_hi,
47 Real rebate,
48 const ext::shared_ptr<StrikedTypePayoff>& payoff,
49 const ext::shared_ptr<Exercise>& exercise);
50 void setupArguments(PricingEngine::arguments*) const override;
51 /*! \warning see VanillaOption for notes on implied-volatility
52 calculation.
53 */
55 Real price,
56 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
57 Real accuracy = 1.0e-4,
58 Size maxEvaluations = 100,
59 Volatility minVol = 1.0e-7,
60 Volatility maxVol = 4.0) const;
61 protected:
62 // arguments
67 };
68
69 //! %Arguments for double barrier option calculation
70 class DoubleBarrierOption::arguments : public OneAssetOption::arguments {
71 public:
72 arguments();
77 void validate() const override;
78 };
79
80 //! %Double-Barrier-option %engine base class
82 : public GenericEngine<DoubleBarrierOption::arguments,
83 DoubleBarrierOption::results> {
84 protected:
85 bool triggered(Real underlying) const;
86 };
87
88}
89
90#endif
Arguments for double barrier option calculation
Double-Barrier-option engine base class
Double Barrier option on a single asset.
void setupArguments(PricingEngine::arguments *) const override
Volatility impliedVolatility(Real price, const ext::shared_ptr< GeneralizedBlackScholesProcess > &process, Real accuracy=1.0e-4, Size maxEvaluations=100, Volatility minVol=1.0e-7, Volatility maxVol=4.0) const
template base class for option pricing engines
Base class for options on a single asset.
ext::shared_ptr< Payoff > payoff() const
Definition: option.hpp:45
ext::shared_ptr< Exercise > exercise() const
Definition: option.hpp:46
Double Barrier type.
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Option on a single asset.
Payoffs for various options.