Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
parsensitivitycubestream.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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/parsensitivitycubestream.hpp
20 \brief Class for streaming SensitivityRecords from a par sensitivity cube
21 */
22
23#pragma once
24
27
28#include <string>
29
30namespace ore {
31namespace analytics {
32
33/*! Class for streaming SensitivityRecords from a par sensitivity cube
34 */
36public:
37 /*! Constructor providing the sensitivity \p cube and currency of the sensitivities */
38 ParSensitivityCubeStream(const QuantLib::ext::shared_ptr<ZeroToParCube>& cube, const std::string& currency);
39
40 /*! Returns the next SensitivityRecord in the stream
41
42 \warning the cube must not change during successive calls to next()!
43 */
45
46 //! Resets the stream so that SensitivityRecord objects can be streamed again
47 void reset() override;
48
49private:
50 //! zero cube idx
52 //! Handle on the SensitivityCube
53 QuantLib::ext::shared_ptr<ZeroToParCube> cube_;
54 //! Currency of the sensitivities in the SensitivityCube
55 std::string currency_;
56 //! TradeId and index of current trade ID in the underlying cube
57 std::map<std::string, QuantLib::Size>::const_iterator tradeIdx_;
58 //! Par deltas for current trade ID
59 std::map<ore::analytics::RiskFactorKey, QuantLib::Real> currentDeltas_;
60 //! Iterator to current delta
61 std::map<ore::analytics::RiskFactorKey, QuantLib::Real>::iterator itCurrent_;
62
63 //! Shared initialisation
64 void init();
65};
66
67} // namespace analytics
68} // namespace ore
QuantLib::ext::shared_ptr< ZeroToParCube > cube_
Handle on the SensitivityCube.
std::string currency_
Currency of the sensitivities in the SensitivityCube.
std::map< std::string, QuantLib::Size >::const_iterator tradeIdx_
TradeId and index of current trade ID in the underlying cube.
std::map< ore::analytics::RiskFactorKey, QuantLib::Real >::iterator itCurrent_
Iterator to current delta.
void reset() override
Resets the stream so that SensitivityRecord objects can be streamed again.
ore::analytics::SensitivityRecord next() override
std::map< ore::analytics::RiskFactorKey, QuantLib::Real > currentDeltas_
Par deltas for current trade ID.
Base Class for streaming SensitivityRecords.
Base class for sensitivity record streamer.
Class for converting zero sensitivities to par sensitivities.