Logo
Reference manual - version orea_version
Public Types | Public Member Functions | List of all members
SensitivityAggregator Class Reference

#include <orea/engine/sensitivityaggregator.hpp>

Public Types

typedef std::pair< RiskFactorKey, RiskFactorKeyCrossPair
 

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 boost::shared_ptr< ScenarioFilter > &filter=boost::make_shared< ScenarioFilter >())
 
void reset ()
 Reset the aggregator to it's initial state by clearing all aggregations.
 
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)
 

Detailed Description

Class for aggregating SensitivityRecords.

The SensitivityRecords are aggregated according to categories of predefined trade IDs.

Member Typedef Documentation

◆ CrossPair

typedef std::pair<RiskFactorKey, RiskFactorKey> CrossPair

Return the deltas and gammas for the given category

Constructor & Destructor Documentation

◆ SensitivityAggregator() [1/2]

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() [2/2]

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.

Member Function Documentation

◆ aggregate()

void aggregate ( SensitivityStream ss,
const boost::shared_ptr< ScenarioFilter > &  filter = boost::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.

Warning:
No checks are performed for duplicate records from the stream. It is the stream's responsibility to guard against duplicates if it needs to.

◆ sensitivities()

const std::set<SensitivityRecord>& sensitivities ( const std::string &  category) const

Return the set of aggregated sensitivities for the given category