Logo
Reference manual - version orea_version
SimmTradeData Class Reference

#include <orea/simm/simmtradedata.hpp>

Classes

class  TradeAttributes
 Class to hold additional trade attributes that may be needed during CRIF generation. More...

Public Member Functions

 SimmTradeData ()
 Default constructor giving an empty string default portfolio and counterparty ID.
 SimmTradeData (const QuantLib::ext::shared_ptr< Portfolio > &portfolio, const QuantLib::ext::shared_ptr< ore::data::Market > &market, const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > &referenceData=nullptr, const QuantLib::ext::shared_ptr< ore::analytics::SimmBucketMapper > &bucketMapper=nullptr, const QuantLib::ext::shared_ptr< Portfolio > &auxiliaryPortfolio=nullptr)
 SimmTradeData (const string &defaultPortfolioId, const string &defaultCounterpartyId)
 Constructor with a specific default portfolio and counterparty ID.
void init ()
std::set< pair< string, QuantLib::Size > > get () const
 Return the set of all trade IDs in the container.
std::set< pair< string, QuantLib::Size > > get (const NettingSetDetails &nettingSetDetails) const
 Return the set of all trade IDs in the container with the given portfolioId.
std::set< pair< string, QuantLib::Size > > get (const string &portfolioId) const
 Return the set of all trade IDs in the container with the given nettingSetDetails.
std::set< stringportfolioIds () const
 Return the set of portfolio IDs in the container.
std::set< NettingSetDetails > nettingSetDetails () const
const stringportfolioId (const string &tradeId) const
const NettingSetDetails & nettingSetDetails (const string &tradeId) const
std::set< stringcounterpartyIds () const
 Return the set of counterparty IDs in the container.
const stringcounterpartyId (const string &tradeId) const
bool has (const string &tradeId) const
 Return true if there is already an entry for tradeId.
bool empty () const
 Return true if there is no trade data.
virtual void clear ()
 Clear the trade data.
bool hasAttributes (const string &tradeId) const
 Return true if the tradeId has additional attributes.
const QuantLib::ext::shared_ptr< TradeAttributes > & getAttributes (const string &tradeId) const
const bool hasNettingSetDetails () const
 Indicate whether the trades are using netting set details instead of just netting set ID.
const std::set< string > & simmTradeIds () const

Protected Member Functions

void setAttributes (const string &tradeId, const QuantLib::ext::shared_ptr< TradeAttributes > &attributes)
virtual void processPortfolio (const QuantLib::ext::shared_ptr< Portfolio > &portfolio, const QuantLib::ext::shared_ptr< ore::data::Market > &market, const QuantLib::ext::shared_ptr< Portfolio > &auxiliaryPortfolio=nullptr)
void add (const string &tradeId, const string &portfolioId, const string &counterpartyId)
void add (const string &tradeId, const NettingSetDetails &nettingSetDetails, const string &counterpartyId)
void add (const string &tradeId)

Protected Attributes

string defaultPortfolioId_
 The default portfolio ID assigned to trades without one.
NettingSetDetails defaultNettingSetDetails_
string defaultCounterpartyId_
 The default counterparty ID assigned to trades without one.
map< string, NettingSetDetails > nettingSetDetails_
map< string, stringcounterpartyIds_
 Map from trade ID to counterparty IDs.
std::set< stringsimmTradeIds_
 Vector of SIMM tradeIds.
bool hasNettingSetDetails_
 Indicate whether the trades are using netting set details instead of just netting set ID.
map< string, QuantLib::ext::shared_ptr< TradeAttributes > > tradeAttributes_
QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > referenceData_
QuantLib::ext::shared_ptr< ore::analytics::SimmBucketMapperbucketMapper_
bool initialised_ = false
QuantLib::ext::shared_ptr< Portfolio > portfolio_
QuantLib::ext::shared_ptr< ore::data::Marketmarket_
QuantLib::ext::shared_ptr< Portfolio > auxiliaryPortfolio_

Detailed Description

A simple container class for holding trade IDs along with their corresponding portfolio id, counterparty id, SIMM/Schedule product class. There is also the option to provide extra trade attributes that can be requested during CRIF generation.

Constructor & Destructor Documentation

◆ SimmTradeData()

SimmTradeData ( const QuantLib::ext::shared_ptr< Portfolio > & portfolio,
const QuantLib::ext::shared_ptr< ore::data::Market > & market,
const QuantLib::ext::shared_ptr< ore::data::ReferenceDataManager > & referenceData = nullptr,
const QuantLib::ext::shared_ptr< ore::analytics::SimmBucketMapper > & bucketMapper = nullptr,
const QuantLib::ext::shared_ptr< Portfolio > & auxiliaryPortfolio = nullptr )

Construct from portfolio object. The portfolio ID is taken to be the netting set ID. Market is passed for IM Schedule related FX conversions.

Member Function Documentation

◆ portfolioId()

const string & portfolioId ( const string & tradeId) const

Return the portfolio ID for the given tradeId

Warning
Throws an error if the tradeId is not in the container. Can check before adding using has.

◆ counterpartyId()

const string & counterpartyId ( const string & tradeId) const

Return the counterparty ID for the given tradeId

Warning
Throws an error if the tradeId is not in the container. Can check before adding using has.

◆ getAttributes()

const QuantLib::ext::shared_ptr< TradeAttributes > & getAttributes ( const string & tradeId) const

Get the additional attributes for a given tradeId.

Warning
This method throws if there are no additional attributes for the given tradeId so use hasAttributes method before the call if in doubt

◆ setAttributes()

void setAttributes ( const string & tradeId,
const QuantLib::ext::shared_ptr< TradeAttributes > & attributes )
protected

Set the additional attributes for a given tradeId. If attributes already exists for tradeId, they are overwritten.

◆ add() [1/2]

void add ( const string & tradeId,
const string & portfolioId,
const string & counterpartyId )
protected

Add a tradeId with associated portfolioId and counterpartyId to the container

Warning
Throws an error if the tradeId is already in the container. Can check before adding using has.

◆ add() [2/2]

void add ( const string & tradeId)
protected

Add a tradeId to the container

Remarks
The tradeId is given the default portfolio ID and counterparty ID
Warning
Throws an error if the tradeId is already in the container. Can check before adding using has.

Member Data Documentation

◆ nettingSetDetails_

map<string, NettingSetDetails> nettingSetDetails_
protected

Map from trade ID to portfolio IDs (the netting set ID is the portfolio ID, but there are other netting set details used to define netting set uniqueness)

◆ tradeAttributes_

map<string, QuantLib::ext::shared_ptr<TradeAttributes> > tradeAttributes_
protected

Map from trade id to additional attributes for that trade id. This container should be empty for most trade IDs and contain exceptional elements that are required during CRIF generation for certain trades.