QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
analyticpartialtimebarrieroptionengine.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) 2014 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis
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 analyticpartialtimebarrieroptionengine.hpp
21 \brief Analytic engine for partial-time barrier options
22*/
23
24#ifndef quantlib_analytic_partial_time_barrier_option_engine_hpp
25#define quantlib_analytic_partial_time_barrier_option_engine_hpp
26
29
30namespace QuantLib {
31
32 //! analytic engine for partial-time %barrier %options.
33 /*! Formulas from Haug, Option Pricing Formulas.
34
35 It doesn't currently cover the case of knock-in
36 partial-time end options.
37 */
40 public:
42 ext::shared_ptr<GeneralizedBlackScholesProcess> process);
43 void calculate() const override;
44
45 private:
46 ext::shared_ptr<GeneralizedBlackScholesProcess> process_;
48 const ext::shared_ptr<PlainVanillaPayoff>& payoff,
49 const ext::shared_ptr<GeneralizedBlackScholesProcess>& process) const;
50 Real underlying() const;
51 Time residualTime() const;
52 Time coverEventTime() const;
53 Volatility volatility(Time t, Real strike) const;
54 Real M(Real a,Real b,Real rho) const;
55 Real d1(Real strike, Rate b)const;
56 Real d2(Real strike, Rate b)const;
57 Real e1(Real barrier, Real strike, Rate b) const;
58 Real e2(Real barrier, Real strike, Rate b) const;
59 Real e3(Real barrier, Real strike, Rate b) const;
60 Real e4(Real barrier, Real strike, Rate b) const;
61 Real f1(Real barrier, Real strike, Rate b) const;
62 Real f2(Real barrier, Real strike, Rate b) const;
63 Real rho() const;
64 Rate mu(Real strike, Rate b) const;
65 Real CoB2(Barrier::Type barrierType, Real barrier, Real strike, Rate r, Rate q) const;
66 Real CoB1(Real barrier, Real strike, Rate r, Rate q) const;
67 Real CA(Integer n, Real barrier, Real strike, Rate r, Rate q) const;
68 Real CIA(Integer n, Real barrier, Real strike, Rate r, Rate q) const;
69 Real g1(Real barrier, Real strike, Rate b)const;
70 Real g2(Real barrier, Real strike, Rate b)const;
71 Real g3(Real barrier, Real strike, Rate b)const;
72 Real g4(Real barrier, Real strike, Rate b)const;
73 Real HS(Real S, Real H, Real power)const;
74 };
75
76}
77
78
79#endif
Black-Scholes processes.
Real CA(Integer n, Real barrier, Real strike, Rate r, Rate q) const
Real CIA(Integer n, Real barrier, Real strike, Rate r, Rate q) const
Real CoB2(Barrier::Type barrierType, Real barrier, Real strike, Rate r, Rate q) const
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Real CoB1(Real barrier, Real strike, Rate r, Rate q) const
Arguments for partial-time barrier option calculation
Base class for partial-time barrier option engines.
const DefaultType & t
std::function< Real(Real)> b
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
QL_REAL Real
real number
Definition: types.hpp:50
Real Volatility
volatility
Definition: types.hpp:78
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Real Rate
interest rates
Definition: types.hpp:70
Partial-time barrier option.
ext::shared_ptr< QuantLib::Payoff > payoff
Definition: any.hpp:37
ext::shared_ptr< YieldTermStructure > q
ext::shared_ptr< YieldTermStructure > r