Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
pairwisevarianceswapengine.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/pricingengines/pairwisevarianceswapengine.hpp
20 \brief pairwise variance swap engine
21 \ingroup engines
22*/
23
24#pragma once
25
26#include <ql/quote.hpp>
27#include <ql/termstructures/yieldtermstructure.hpp>
28#include <ql/time/daycounters/actualactual.hpp>
29
30#include <ql/exercise.hpp>
31#include <ql/index.hpp>
32#include <ql/instruments/europeanoption.hpp>
33#include <ql/pricingengines/vanilla/analyticeuropeanengine.hpp>
34
36
37namespace QuantExt {
38using namespace QuantLib;
39
40struct Variances {
50
52 accruedVariance1 = 0.0;
53 accruedVariance2 = 0.0;
55 futureVariance1 = 0.0;
56 futureVariance2 = 0.0;
58 totalVariance1 = 0.0;
59 totalVariance2 = 0.0;
61 }
62};
63
65public:
66 PairwiseVarianceSwapEngine(const QuantLib::ext::shared_ptr<QuantLib::Index>& index1,
67 const QuantLib::ext::shared_ptr<QuantLib::Index>& index2,
68 const QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess>& process1,
69 const QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess>& process2,
70 const Handle<YieldTermStructure>& discountingTS, Handle<Quote> correlation);
71
72 void calculate() const override;
73
74protected:
75 Variances calculateVariances(const Schedule& valuationSchedule, const Schedule& laggedValuationSchedule,
76 const Date& evalDate) const;
77
78 QuantLib::ext::shared_ptr<Index> index1_;
79 QuantLib::ext::shared_ptr<Index> index2_;
80 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> process1_;
81 QuantLib::ext::shared_ptr<GeneralizedBlackScholesProcess> process2_;
82 Handle<YieldTermStructure> discountingTS_;
83 Handle<Quote> correlation_;
84};
85
86} // namespace QuantExt
base class for pairwise variance-swap engines
QuantLib::ext::shared_ptr< Index > index2_
Variances calculateVariances(const Schedule &valuationSchedule, const Schedule &laggedValuationSchedule, const Date &evalDate) const
QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > process2_
QuantLib::ext::shared_ptr< GeneralizedBlackScholesProcess > process1_
QuantLib::ext::shared_ptr< Index > index1_
Pirwise Variance swap.