QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AnalyticDoubleBarrierEngine Class Reference

Pricing engine for double barrier european options using analytical formulae. More...

#include <analyticdoublebarrierengine.hpp>

+ Inheritance diagram for AnalyticDoubleBarrierEngine:
+ Collaboration diagram for AnalyticDoubleBarrierEngine:

Public Member Functions

 AnalyticDoubleBarrierEngine (ext::shared_ptr< GeneralizedBlackScholesProcess > process, int series=5)
 
void calculate () const override
 
- Public Member Functions inherited from GenericEngine< DoubleBarrierOption::arguments, DoubleBarrierOption::results >
PricingEngine::argumentsgetArguments () const override
 
const PricingEngine::resultsgetResults () const override
 
void reset () override
 
void update () override
 
- Public Member Functions inherited from PricingEngine
 ~PricingEngine () override=default
 
virtual argumentsgetArguments () const =0
 
virtual const resultsgetResults () const =0
 
virtual void reset ()=0
 
virtual void calculate () const =0
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Private Member Functions

Real underlying () const
 
Real strike () const
 
Time residualTime () const
 
Volatility volatility () const
 
Real volatilitySquared () const
 
Real barrierLo () const
 
Real barrierHi () const
 
Real stdDeviation () const
 
Rate riskFreeRate () const
 
DiscountFactor riskFreeDiscount () const
 
Rate dividendYield () const
 
Rate costOfCarry () const
 
DiscountFactor dividendDiscount () const
 
Real vanillaEquivalent () const
 
Real callKO () const
 
Real putKO () const
 
Real callKI () const
 
Real putKI () const
 

Private Attributes

ext::shared_ptr< GeneralizedBlackScholesProcessprocess_
 
CumulativeNormalDistribution f_
 
int series_
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from DoubleBarrierOption::engine
bool triggered (Real underlying) const
 
- Protected Attributes inherited from GenericEngine< DoubleBarrierOption::arguments, DoubleBarrierOption::results >
DoubleBarrierOption::arguments arguments_
 
DoubleBarrierOption::results results_
 

Detailed Description

Pricing engine for double barrier european options using analytical formulae.

The formulas are taken from "The complete guide to option pricing formulas 2nd Ed", E.G. Haug, McGraw-Hill, p.156 and following. Implements the Ikeda and Kunitomo series (see "Pricing Options with Curved Boundaries" Mathematical Finance 2/1992"). This code handles only flat barriers

Note
the formula holds only when strike is in the barrier range
Tests:
the correctness of the returned value is tested by reproducing results available in literature.

Definition at line 49 of file analyticdoublebarrierengine.hpp.

Constructor & Destructor Documentation

◆ AnalyticDoubleBarrierEngine()

AnalyticDoubleBarrierEngine ( ext::shared_ptr< GeneralizedBlackScholesProcess process,
int  series = 5 
)
explicit

Definition at line 27 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ calculate()

void calculate ( ) const
overridevirtual

Implements PricingEngine.

Definition at line 33 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:

◆ underlying()

Real underlying ( ) const
private

Definition at line 100 of file analyticdoublebarrierengine.cpp.

+ Here is the caller graph for this function:

◆ strike()

Real strike ( ) const
private

Definition at line 104 of file analyticdoublebarrierengine.cpp.

+ Here is the caller graph for this function:

◆ residualTime()

Time residualTime ( ) const
private

Definition at line 111 of file analyticdoublebarrierengine.cpp.

+ Here is the caller graph for this function:

◆ volatility()

Volatility volatility ( ) const
private

Definition at line 115 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ volatilitySquared()

Real volatilitySquared ( ) const
private

Definition at line 119 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ barrierLo()

Real barrierLo ( ) const
private

Definition at line 127 of file analyticdoublebarrierengine.cpp.

+ Here is the caller graph for this function:

◆ barrierHi()

Real barrierHi ( ) const
private

Definition at line 131 of file analyticdoublebarrierengine.cpp.

+ Here is the caller graph for this function:

◆ stdDeviation()

Real stdDeviation ( ) const
private

Definition at line 123 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ riskFreeRate()

Rate riskFreeRate ( ) const
private

Definition at line 135 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ riskFreeDiscount()

DiscountFactor riskFreeDiscount ( ) const
private

Definition at line 140 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dividendYield()

Rate dividendYield ( ) const
private

Definition at line 144 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ costOfCarry()

Rate costOfCarry ( ) const
private

Definition at line 153 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dividendDiscount()

DiscountFactor dividendDiscount ( ) const
private

Definition at line 149 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vanillaEquivalent()

Real vanillaEquivalent ( ) const
private

Definition at line 157 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ callKO()

Real callKO ( ) const
private

Definition at line 169 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ putKO()

Real putKO ( ) const
private

Definition at line 205 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ callKI()

Real callKI ( ) const
private

Definition at line 200 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ putKI()

Real putKI ( ) const
private

Definition at line 236 of file analyticdoublebarrierengine.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ process_

ext::shared_ptr<GeneralizedBlackScholesProcess> process_
private

Definition at line 56 of file analyticdoublebarrierengine.hpp.

◆ f_

Definition at line 57 of file analyticdoublebarrierengine.hpp.

◆ series_

int series_
private

Definition at line 58 of file analyticdoublebarrierengine.hpp.