QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
varianceswap.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Warren Chou
5 Copyright (C) 2008 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_variance_swap_hpp
26#define quantlib_variance_swap_hpp
27
28#include <ql/processes/blackscholesprocess.hpp>
29#include <ql/instruments/payoffs.hpp>
30#include <ql/option.hpp>
31#include <ql/position.hpp>
32
33namespace QuantLib {
34
36
40 class VarianceSwap : public Instrument {
41 public:
42 class arguments;
43 class results;
44 class engine;
48 const Date& startDate,
49 const Date& maturityDate);
51
52 bool isExpired() const override;
54
56 // inspectors
57 Real strike() const;
59 Date startDate() const;
60 Date maturityDate() const;
61 Real notional() const;
62 // results
63 Real variance() const;
65 // other
66 void setupArguments(PricingEngine::arguments* args) const override;
67 void fetchResults(const PricingEngine::results*) const override;
68
69 protected:
70 void setupExpired() const override;
71 // data members
76 // results
77 mutable Real variance_;
78 };
79
80
83 public:
85 void validate() const override;
91 };
92
93
96 public:
98 void reset() override {
101 }
102 };
103
106 public GenericEngine<VarianceSwap::arguments,
107 VarianceSwap::results> {};
108
109
110 // inline definitions
111
113 return startDate_;
114 }
115
117 return maturityDate_;
118 }
119
120 inline Real VarianceSwap::strike() const {
121 return strike_;
122 }
123
125 return notional_;
126 }
127
129 return position_;
130 }
131
132}
133
134
135#endif
Concrete date class.
Definition: date.hpp:125
template base class for option pricing engines
Abstract instrument class.
Definition: instrument.hpp:44
template class providing a null value for a given type.
Definition: null.hpp:76
Arguments for forward fair-variance calculation
void validate() const override
base class for variance-swap engines
Results from variance-swap calculation
bool isExpired() const override
returns whether the instrument might have value greater than zero.
void setupArguments(PricingEngine::arguments *args) const override
Position::Type position_
Position::Type position() const
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
QL_REAL Real
real number
Definition: types.hpp:50
Definition: any.hpp:35