QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
barrieroption.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) 2003, 2004 Neil Firth
5 Copyright (C) 2003, 2004 Ferdinando Ametrano
6 Copyright (C) 2003, 2004, 2007 StatPro Italia srl
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
22/*! \file barrieroption.hpp
23 \brief Barrier option on a single asset
24*/
25
26#ifndef quantlib_barrier_option_hpp
27#define quantlib_barrier_option_hpp
28
33
34namespace QuantLib {
35
36 class GeneralizedBlackScholesProcess;
37
38 //! %Barrier option on a single asset.
39 /*! The analytic pricing engine will be used if none if passed.
40
41 \ingroup instruments
42 */
44 public:
45 class arguments;
46 class engine;
47 BarrierOption(Barrier::Type barrierType,
48 Real barrier,
49 Real rebate,
50 const ext::shared_ptr<StrikedTypePayoff>& payoff,
51 const ext::shared_ptr<Exercise>& exercise);
52 void setupArguments(PricingEngine::arguments*) const override;
53
54 /*! \warning see VanillaOption for notes on implied-volatility
55 calculation.
56 */
57 //@{
59 Real price,
60 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
61 Real accuracy = 1.0e-4,
62 Size maxEvaluations = 100,
63 Volatility minVol = 1.0e-7,
64 Volatility maxVol = 4.0) const;
66 Real price,
67 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process,
68 const DividendSchedule& dividends,
69 Real accuracy = 1.0e-4,
70 Size maxEvaluations = 100,
71 Volatility minVol = 1.0e-7,
72 Volatility maxVol = 4.0) const;
73 //@}
74 protected:
75 // arguments
79 };
80
81 //! %Arguments for barrier option calculation
82 class BarrierOption::arguments : public OneAssetOption::arguments {
83 public:
84 arguments();
88 void validate() const override;
89 };
90
91 //! %Barrier-option %engine base class
93 : public GenericEngine<BarrierOption::arguments,
94 BarrierOption::results> {
95 protected:
96 bool triggered(Real underlying) const;
97 };
98
99}
100
101#endif
Barrier type.
Arguments for barrier option calculation
Barrier-option engine base class
bool triggered(Real underlying) const
Barrier option on a single asset.
Barrier::Type barrierType_
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
Schedule of dividend dates.
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
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
Option on a single asset.
Payoffs for various options.