Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
filteredsensitivitystream.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 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 orea/engine/filteredsensitivitystream.hpp
20 \brief Class that wraps a sensitivity stream and filters out negligible records
21 */
22
23#pragma once
24
26
27#include <fstream>
28#include <set>
29#include <string>
30
31namespace ore {
32namespace analytics {
33
34//! Class that wraps a sensitivity stream and filters out negligible records
36public:
37 /*! Constructor providing the thresholds. If the absolute value of the delta is
38 greater than the \p deltaThreshold or the absolute value of the gamma is greater
39 than the \p gammaThreshold, then the SensitivityRecord is streamed
40 */
41 FilteredSensitivityStream(const QuantLib::ext::shared_ptr<SensitivityStream>& ss, QuantLib::Real deltaThreshold,
42 QuantLib::Real gammaThreshold);
43 //! Constructor that uses the same \p threshold for delta and gamma
44 FilteredSensitivityStream(const QuantLib::ext::shared_ptr<SensitivityStream>& ss, QuantLib::Real threshold);
45 //! Returns the next SensitivityRecord in the stream after filtering
46 SensitivityRecord next() override;
47 //! Resets the stream so that SensitivityRecord objects can be streamed again
48 void reset() override;
49
50private:
51 //! The underlying sensitivity stream that has been wrapped
52 QuantLib::ext::shared_ptr<SensitivityStream> ss_;
53 //! The delta threshold
54 QuantLib::Real deltaThreshold_;
55 //! The gamma threshold
56 QuantLib::Real gammaThreshold_;
57 //! Set to hold Delta Keys appearing in CrossGammas
58 std::set<RiskFactorKey> deltaKeys_;
59};
60
61} // namespace analytics
62} // namespace ore
Class that wraps a sensitivity stream and filters out negligible records.
QuantLib::Real gammaThreshold_
The gamma threshold.
FilteredSensitivityStream(const QuantLib::ext::shared_ptr< SensitivityStream > &ss, QuantLib::Real deltaThreshold, QuantLib::Real gammaThreshold)
QuantLib::ext::shared_ptr< SensitivityStream > ss_
The underlying sensitivity stream that has been wrapped.
QuantLib::Real deltaThreshold_
The delta threshold.
void reset() override
Resets the stream so that SensitivityRecord objects can be streamed again.
SensitivityRecord next() override
Returns the next SensitivityRecord in the stream after filtering.
std::set< RiskFactorKey > deltaKeys_
Set to hold Delta Keys appearing in CrossGammas.
Base Class for streaming SensitivityRecords.
Base class for sensitivity record streamer.