Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
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
29namespace QuantExt {
30
31/*! A null instrument that always returns an NPV of 0
32 */
33class NullInstrument : public QuantLib::Instrument {
34public:
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
46inline bool NullInstrument::isExpired() const {
47 return true;
48}
49
51 NPV_ = 0.0;
52 errorEstimate_ = 0.0;
53}
54
55}
56
57#endif
void performCalculations() const override
Populate results.
bool isExpired() const override
Always returns true.