Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
qle
instruments
nullinstrument.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/instruments/nullinstrument.hpp
20
\brief A null instrument that always returns an NPV of 0
21
*/
22
23
#ifndef quantext_null_instrument_hpp
24
#define quantext_null_instrument_hpp
25
26
#include <ql/currency.hpp>
27
#include <ql/instrument.hpp>
28
29
namespace
QuantExt
{
30
31
/*! A null instrument that always returns an NPV of 0
32
*/
33
class
NullInstrument
:
public
QuantLib::Instrument {
34
public
:
35
NullInstrument
() {}
36
37
//! \name Instrument interface
38
//@{
39
//! Always returns true.
40
bool
isExpired
()
const override
;
41
//! Populate results
42
void
performCalculations
()
const override
;
43
//@}
44
};
45
46
inline
bool
NullInstrument::isExpired
()
const
{
47
return
true
;
48
}
49
50
inline
void
NullInstrument::performCalculations
()
const
{
51
NPV_ = 0.0;
52
errorEstimate_ = 0.0;
53
}
54
55
}
56
57
#endif
QuantExt::NullInstrument
Definition:
nullinstrument.hpp:33
QuantExt::NullInstrument::NullInstrument
NullInstrument()
Definition:
nullinstrument.hpp:35
QuantExt::NullInstrument::performCalculations
void performCalculations() const override
Populate results.
Definition:
nullinstrument.hpp:50
QuantExt::NullInstrument::isExpired
bool isExpired() const override
Always returns true.
Definition:
nullinstrument.hpp:46
QuantExt
Definition:
namespaces.docs:19
Generated by
Doxygen
1.9.5