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

#include <qle/pricingengines/volatilityfromvarianceswapengine.hpp>

+ Inheritance diagram for VolatilityFromVarianceSwapEngine:
+ Collaboration diagram for VolatilityFromVarianceSwapEngine:

Public Member Functions

void calculate () const override
 
 GeneralisedReplicatingVarianceSwapEngine (const QuantLib::ext::shared_ptr< QuantLib::Index > &index, const QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > &process, const Handle< YieldTermStructure > &discountingTS, const VarSwapSettings settings=VarSwapSettings(), const bool staticTodaysSpot=true)
 
- Public Member Functions inherited from GeneralisedReplicatingVarianceSwapEngine
 GeneralisedReplicatingVarianceSwapEngine (const QuantLib::ext::shared_ptr< QuantLib::Index > &index, const QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > &process, const Handle< YieldTermStructure > &discountingTS, const VarSwapSettings settings=VarSwapSettings(), const bool staticTodaysSpot=true)
 
void calculate () const override
 

Additional Inherited Members

- Protected Member Functions inherited from GeneralisedReplicatingVarianceSwapEngine
Real calculateAccruedVariance (const Calendar &jointCal) const
 
Real calculateFutureVariance (const Date &maturity) const
 
- Protected Attributes inherited from GeneralisedReplicatingVarianceSwapEngine
QuantLib::ext::shared_ptr< Index > index_
 
QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > process_
 
Handle< YieldTermStructure > discountingTS_
 
VarSwapSettings settings_
 
bool staticTodaysSpot_
 
Real cachedTodaysSpot_ = Null<Real>()
 

Detailed Description

Definition at line 32 of file volatilityfromvarianceswapengine.hpp.

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 28 of file volatilityfromvarianceswapengine.cpp.

28 {
29
31
32 const DiscountFactor df = discountingTS_->discount(arguments_.maturityDate);
33 const Real multiplier = arguments_.position == Position::Long ? 1.0 : -1.0;
34 const Real volatility = sqrt(boost::any_cast<Real>(results_.additionalResults.at("totalVariance")));
35 const Real volatilityStrike = sqrt(arguments_.strike);
36
37 results_.value = multiplier * df * arguments_.notional * 100.0 * (volatility - volatilityStrike);
38}
const Instrument::results * results_
Definition: cdsoption.cpp:81
RandomVariable sqrt(RandomVariable x)
Swap::arguments * arguments_
+ Here is the call graph for this function:

◆ GeneralisedReplicatingVarianceSwapEngine()

GeneralisedReplicatingVarianceSwapEngine ( const QuantLib::ext::shared_ptr< QuantLib::Index > &  index,
const QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > &  process,
const Handle< YieldTermStructure > &  discountingTS,
const VarSwapSettings  settings = VarSwapSettings(),
const bool  staticTodaysSpot = true 
)

Definition at line 79 of file varianceswapgeneralreplicationengine.cpp.

44 : index_(index), process_(process), discountingTS_(discountingTS), settings_(settings),
45 staticTodaysSpot_(staticTodaysSpot) {
46
47 QL_REQUIRE(process_, "Black-Scholes process not present.");
48
49 registerWith(process_);
50 registerWith(discountingTS_);
51}
QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > process_