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

Future Option Helper. More...

#include <qle/models/futureoptionhelper.hpp>

+ Inheritance diagram for FutureOptionHelper:
+ Collaboration diagram for FutureOptionHelper:

Public Member Functions

 FutureOptionHelper (const Period &maturity, const Calendar &calendar, const Real strike, const Handle< QuantExt::PriceTermStructure > priceCurve, const Handle< Quote > volatility, BlackCalibrationHelper::CalibrationErrorType errorType=BlackCalibrationHelper::RelativePriceError)
 
 FutureOptionHelper (const Date &exerciseDate, const Real strike, const Handle< QuantExt::PriceTermStructure > priceCurve, const Handle< Quote > volatility, BlackCalibrationHelper::CalibrationErrorType errorType=BlackCalibrationHelper::RelativePriceError)
 
void addTimesTo (std::list< Time > &) const override
 
void performCalculations () const override
 
Real modelValue () const override
 
Real blackPrice (Real volatility) const override
 
QuantLib::ext::shared_ptr< VanillaOption > option () const
 
Real strike () const
 
const Handle< QuantExt::PriceTermStructure > & priceCurve () const
 

Private Attributes

Handle< QuantExt::PriceTermStructurepriceCurve_
 
const bool hasMaturity_
 
Period maturity_
 
Date exerciseDate_
 
Calendar calendar_
 
const Real strike_
 
Real tau_
 
Real atm_
 
Option::Type type_
 
QuantLib::ext::shared_ptr< VanillaOption > option_
 
Real effStrike_
 

Detailed Description

Future Option Helper.

Definition at line 37 of file futureoptionhelper.hpp.

Constructor & Destructor Documentation

◆ FutureOptionHelper() [1/2]

FutureOptionHelper ( const Period &  maturity,
const Calendar &  calendar,
const Real  strike,
const Handle< QuantExt::PriceTermStructure priceCurve,
const Handle< Quote >  volatility,
BlackCalibrationHelper::CalibrationErrorType  errorType = BlackCalibrationHelper::RelativePriceError 
)

Definition at line 28 of file futureoptionhelper.cpp.

32 : BlackCalibrationHelper(volatility, errorType), priceCurve_(priceCurve), hasMaturity_(true),
33 maturity_(maturity), calendar_(calendar), strike_(strike) {
34 registerWith(priceCurve_);
35}
Handle< QuantExt::PriceTermStructure > priceCurve_
const Handle< QuantExt::PriceTermStructure > & priceCurve() const

◆ FutureOptionHelper() [2/2]

FutureOptionHelper ( const Date &  exerciseDate,
const Real  strike,
const Handle< QuantExt::PriceTermStructure priceCurve,
const Handle< Quote >  volatility,
BlackCalibrationHelper::CalibrationErrorType  errorType = BlackCalibrationHelper::RelativePriceError 
)

Definition at line 37 of file futureoptionhelper.cpp.

41 : BlackCalibrationHelper(volatility, errorType), priceCurve_(priceCurve), hasMaturity_(false),
42 exerciseDate_(exerciseDate), strike_(strike) {
43 registerWith(priceCurve_);
44}

Member Function Documentation

◆ addTimesTo()

void addTimesTo ( std::list< Time > &  ) const
override

Definition at line 47 of file futureoptionhelper.hpp.

47{}

◆ performCalculations()

void performCalculations ( ) const
override

Definition at line 46 of file futureoptionhelper.cpp.

46 {
47 if (hasMaturity_)
48 exerciseDate_ = calendar_.advance(priceCurve_->referenceDate(), maturity_);
49 tau_ = priceCurve_->timeFromReference(exerciseDate_);
50 atm_ = priceCurve_->price(tau_);
52 if (effStrike_ == Null<Real>())
54 type_ = effStrike_ >= atm_ ? Option::Call : Option::Put;
55 QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff(new PlainVanillaPayoff(type_, effStrike_));
56 QuantLib::ext::shared_ptr<Exercise> exercise = QuantLib::ext::make_shared<EuropeanExercise>(exerciseDate_);
57 option_ = QuantLib::ext::shared_ptr<VanillaOption>(new VanillaOption(payoff, exercise));
58 BlackCalibrationHelper::performCalculations();
59}
QuantLib::ext::shared_ptr< VanillaOption > option_

◆ modelValue()

Real modelValue ( ) const
override

Definition at line 61 of file futureoptionhelper.cpp.

61 {
62 calculate();
63 option_->setPricingEngine(engine_);
64 return option_->NPV();
65}
QuantLib::ext::shared_ptr< PricingEngine > engine_
Definition: cdsoption.cpp:78

◆ blackPrice()

Real blackPrice ( Real  volatility) const
override

Definition at line 67 of file futureoptionhelper.cpp.

67 {
68 calculate();
69 const Real stdDev = volatility * std::sqrt(tau_);
70 return blackFormula(type_, effStrike_, atm_, stdDev, 1.0);
71}

◆ option()

QuantLib::ext::shared_ptr< VanillaOption > option ( ) const

Definition at line 51 of file futureoptionhelper.hpp.

51{ return option_; }

◆ strike()

Real strike ( ) const

Definition at line 52 of file futureoptionhelper.hpp.

52 {
53 calculate();
54 return effStrike_;
55 }

◆ priceCurve()

const Handle< QuantExt::PriceTermStructure > & priceCurve ( ) const

Definition at line 56 of file futureoptionhelper.hpp.

56{ return priceCurve_; }

Member Data Documentation

◆ priceCurve_

Handle<QuantExt::PriceTermStructure> priceCurve_
private

Definition at line 59 of file futureoptionhelper.hpp.

◆ hasMaturity_

const bool hasMaturity_
private

Definition at line 60 of file futureoptionhelper.hpp.

◆ maturity_

Period maturity_
private

Definition at line 61 of file futureoptionhelper.hpp.

◆ exerciseDate_

Date exerciseDate_
mutableprivate

Definition at line 62 of file futureoptionhelper.hpp.

◆ calendar_

Calendar calendar_
private

Definition at line 63 of file futureoptionhelper.hpp.

◆ strike_

const Real strike_
private

Definition at line 64 of file futureoptionhelper.hpp.

◆ tau_

Real tau_
mutableprivate

Definition at line 65 of file futureoptionhelper.hpp.

◆ atm_

Real atm_
mutableprivate

Definition at line 66 of file futureoptionhelper.hpp.

◆ type_

Option::Type type_
mutableprivate

Definition at line 67 of file futureoptionhelper.hpp.

◆ option_

QuantLib::ext::shared_ptr<VanillaOption> option_
mutableprivate

Definition at line 68 of file futureoptionhelper.hpp.

◆ effStrike_

Real effStrike_
mutableprivate

Definition at line 69 of file futureoptionhelper.hpp.