Logo
Reference manual - version ored_version
PortfolioFieldGetter Class Reference

#include <ored/portfolio/additionalfieldgetter.hpp>

Inheritance diagram for PortfolioFieldGetter:

Public Member Functions

 PortfolioFieldGetter (const QuantLib::ext::shared_ptr< ore::data::Portfolio > &portfolio, const std::set< std::string > &baseFieldNames={}, bool addExtraFields=true)
void add (const QuantLib::ext::shared_ptr< ore::data::Portfolio > &portfolio, bool addExtraFields=true)
void removeFieldName (const std::string &fieldName)
std::set< std::string > fieldNames () const override
 Returns the set of additional fields considered relevant by this class.
std::map< std::string, std::string > fields (const std::string &tradeId) const override
 Returns the map of additional fields for the given trade ID tradeId.
std::string field (const std::string &tradeId, const std::string &fieldName) const
 Get additional field for the given trade if it exists.
std::string npvCurrency (const std::string &tradeId) const override
 Returns the npv currency for a given trade ID tradeId.

Detailed Description

Concrete implementation of AdditionalFieldGetter that gets the additional fields for each trade in a given portfolio.

Constructor & Destructor Documentation

◆ PortfolioFieldGetter()

PortfolioFieldGetter ( const QuantLib::ext::shared_ptr< ore::data::Portfolio > & portfolio,
const std::set< std::string > & baseFieldNames = {},
bool addExtraFields = true )

Constructor that takes a portfolio and optionally a set of base additional fields

Remarks
The baseFieldNames are field names that will always be in the set returned by fieldNames regardless of whether they are found in any trade in the portfolio.
If addExtraFields is set to true (the default) this will scan all trades and add any addtionalField that appears

Member Function Documentation

◆ fieldNames()

std::set< std::string > fieldNames ( ) const
overridevirtual

Returns the set of additional fields considered relevant by this class.

Implements AdditionalFieldGetter.

◆ fields()

std::map< std::string, std::string > fields ( const std::string & tradeId) const
overridevirtual

Returns the map of additional fields for the given trade ID tradeId.

Implements AdditionalFieldGetter.

◆ npvCurrency()

std::string npvCurrency ( const std::string & tradeId) const
overridevirtual

Returns the npv currency for a given trade ID tradeId.

Implements AdditionalFieldGetter.