Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
AnalyticEuropeanEngine Class Reference

Pricing engine for European vanilla options using analytical formulae. More...

#include <qle/pricingengines/analyticeuropeanengine.hpp>

+ Inheritance diagram for AnalyticEuropeanEngine:
+ Collaboration diagram for AnalyticEuropeanEngine:

Public Member Functions

 AnalyticEuropeanEngine (ext::shared_ptr< GeneralizedBlackScholesProcess > gbsp, const bool flipResults=false)
 
 AnalyticEuropeanEngine (ext::shared_ptr< GeneralizedBlackScholesProcess > process, Handle< YieldTermStructure > discountCurve, const bool flipResults=false)
 
void calculate () const override
 

Private Attributes

ext::shared_ptr< GeneralizedBlackScholesProcess > process_
 
Handle< YieldTermStructure > discountCurve_
 
bool flipResults_
 

Detailed Description

Pricing engine for European vanilla options using analytical formulae.

Definition at line 36 of file analyticeuropeanengine.hpp.

Constructor & Destructor Documentation

◆ AnalyticEuropeanEngine() [1/2]

AnalyticEuropeanEngine ( ext::shared_ptr< GeneralizedBlackScholesProcess >  gbsp,
const bool  flipResults = false 
)
explicit

Definition at line 38 of file analyticeuropeanengine.hpp.

39 : QuantLib::AnalyticEuropeanEngine(gbsp), flipResults_(flipResults) {}

◆ AnalyticEuropeanEngine() [2/2]

AnalyticEuropeanEngine ( ext::shared_ptr< GeneralizedBlackScholesProcess >  process,
Handle< YieldTermStructure >  discountCurve,
const bool  flipResults = false 
)

Definition at line 41 of file analyticeuropeanengine.hpp.

43 : QuantLib::AnalyticEuropeanEngine(process, discountCurve), flipResults_(flipResults) {}

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 31 of file analyticeuropeanengine.cpp.

31 {
32
33 QuantLib::AnalyticEuropeanEngine::calculate();
34
35 if (flipResults_) {
36
37 // Invert strike, spot, forward
38
39 auto resToInvert = vector<string>({"spot", "forward", "strike"});
40 for (const string& res : resToInvert) {
41 auto it = results_.additionalResults.find(res);
42 if (it != results_.additionalResults.end())
43 it->second = 1. / boost::any_cast<Real>(it->second);
44 }
45
46 // Swap riskFreeDiscount and dividendDiscount, discountFactor stays what it is
47
48 Real rfDiscount = Null<Real>();
49 Real divDiscount = Null<Real>();
50
51 if (auto tmp = results_.additionalResults.find("riskFreeDiscount"); tmp != results_.additionalResults.end())
52 rfDiscount = boost::any_cast<Real>(tmp->second);
53 if (auto tmp = results_.additionalResults.find("dividendDiscount"); tmp != results_.additionalResults.end())
54 divDiscount = boost::any_cast<Real>(tmp->second);
55
56 results_.additionalResults["riskFreeDiscount"] = divDiscount;
57 results_.additionalResults["dividendDiscount"] = rfDiscount;
58
59 }
60}
const Instrument::results * results_
Definition: cdsoption.cpp:81

Member Data Documentation

◆ process_

ext::shared_ptr<GeneralizedBlackScholesProcess> process_
private

Definition at line 47 of file analyticeuropeanengine.hpp.

◆ discountCurve_

Handle<YieldTermStructure> discountCurve_
private

Definition at line 48 of file analyticeuropeanengine.hpp.

◆ flipResults_

bool flipResults_
private

Definition at line 49 of file analyticeuropeanengine.hpp.