#include <orea/engine/sensitivityaggregator.hpp>
Public Types | |
typedef std::pair< RiskFactorKey, RiskFactorKey > | CrossPair |
Public Member Functions | |
SensitivityAggregator (const std::map< std::string, std::set< std::pair< std::string, QuantLib::Size > > > &categories) | |
SensitivityAggregator (const std::map< std::string, std::function< bool(std::string)> > &categories) | |
void | aggregate (SensitivityStream &ss, const QuantLib::ext::shared_ptr< ScenarioFilter > &filter=QuantLib::ext::make_shared< ScenarioFilter >()) |
void | reset () |
Reset the aggregator to it's initial state by clearing all aggregations. More... | |
const std::set< SensitivityRecord > & | sensitivities (const std::string &category) const |
void | generateDeltaGamma (const std::string &category, std::map< RiskFactorKey, QuantLib::Real > &deltas, std::map< CrossPair, QuantLib::Real > &gammas) |
Private Member Functions | |
void | init () |
Initialise the container of aggregated records. More... | |
void | add (SensitivityRecord &sr, std::set< SensitivityRecord > &records) |
Add a sensitivity record to the set of aggregated records . More... | |
bool | inCategory (const std::string &tradeId, const std::string &category) const |
Determine if the tradeId is in the given category . More... | |
Private Attributes | |
std::map< std::string, std::set< std::pair< std::string, QuantLib::Size > > > | setCategories_ |
std::map< std::string, std::function< bool(std::string)> > | categories_ |
Container for category names and their definition via functions. More... | |
std::map< std::string, std::set< SensitivityRecord > > | aggRecords_ |
Sensitivity records aggregated according to categories_ More... | |
Class for aggregating SensitivityRecords.
The SensitivityRecords are aggregated according to categories of predefined trade IDs.
Definition at line 40 of file sensitivityaggregator.hpp.
typedef std::pair<RiskFactorKey, RiskFactorKey> CrossPair |
Return the deltas and gammas for the given category
Definition at line 75 of file sensitivityaggregator.hpp.
SensitivityAggregator | ( | const std::map< std::string, std::set< std::pair< std::string, QuantLib::Size > > > & | categories | ) |
Constructor that uses sets of trades to define the aggregation categories.
The categories
map has a string key that defines the name of the category and a value that defines the set of trade IDs in that category.
SensitivityAggregator | ( | const std::map< std::string, std::function< bool(std::string)> > & | categories | ) |
Constructor that uses functions to define the aggregation categories.
The categories
map has a string key that defines the name of the category. The map value is a function that when given a trade ID, returns a bool indicating if the trade ID is in the category.
void aggregate | ( | SensitivityStream & | ss, |
const QuantLib::ext::shared_ptr< ScenarioFilter > & | filter = QuantLib::ext::make_shared<ScenarioFilter>() |
||
) |
Update the aggregator with SensitivityRecords from the stream ss
after applying the optional filter. If no filter is specified, all risk factors are aggregated.
Definition at line 52 of file sensitivityaggregator.cpp.
void reset | ( | ) |
Reset the aggregator to it's initial state by clearing all aggregations.
Definition at line 79 of file sensitivityaggregator.cpp.
const set< SensitivityRecord > & sensitivities | ( | const std::string & | category | ) | const |
Return the set of aggregated sensitivities for the given category
Definition at line 87 of file sensitivityaggregator.cpp.
void generateDeltaGamma | ( | const std::string & | category, |
std::map< RiskFactorKey, QuantLib::Real > & | deltas, | ||
std::map< CrossPair, QuantLib::Real > & | gammas | ||
) |
Definition at line 96 of file sensitivityaggregator.cpp.
|
private |
Initialise the container of aggregated records.
Definition at line 124 of file sensitivityaggregator.cpp.
|
private |
Add a sensitivity record to the set of aggregated records
.
Definition at line 131 of file sensitivityaggregator.cpp.
|
private |
Determine if the tradeId
is in the given category
.
Definition at line 142 of file sensitivityaggregator.cpp.
|
private |
Container for category names and their definition via sets. This will be empty if constructor is provided functions directly.
Definition at line 83 of file sensitivityaggregator.hpp.
|
private |
Container for category names and their definition via functions.
Definition at line 85 of file sensitivityaggregator.hpp.
|
private |
Sensitivity records aggregated according to categories_
Definition at line 87 of file sensitivityaggregator.hpp.