Logo
Reference manual - version orea_version
ValuationEngine Class Reference

Valuation Engine. More...

#include <orea/engine/valuationengine.hpp>

Inheritance diagram for ValuationEngine:

Classes

struct  Errors

Public Types

enum class  ErrorPolicy { RemoveAll , RemoveSample }

Public Member Functions

 ValuationEngine (const QuantLib::Date &today, const QuantLib::ext::shared_ptr< ore::data::DateGrid > &dg, const QuantLib::ext::shared_ptr< analytics::SimMarket > &simMarket, const set< std::pair< std::string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > &modelBuilders=set< std::pair< std::string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > >(), const bool recalibrate=true)
 Constructor.
void buildCube (const QuantLib::ext::shared_ptr< data::Portfolio > &portfolio, QuantLib::ext::shared_ptr< analytics::NPVCube > outputCube, std::vector< QuantLib::ext::shared_ptr< ValuationCalculator > > calculators, const ErrorPolicy=ErrorPolicy::RemoveAll, bool mporStickyDate=true, QuantLib::ext::shared_ptr< analytics::NPVCube > outputCubeNettingSet=nullptr, QuantLib::ext::shared_ptr< analytics::NPVCube > outputCptyCube=nullptr, std::vector< QuantLib::ext::shared_ptr< CounterpartyCalculator > > cptyCalculators={}, bool dryRun=false, Errors *errors=nullptr)
 Build NPV cube.

Detailed Description

Valuation Engine.

The valuation engine's purpose is to generate an NPV cube. Its buildCube loops over samples->dates->trades and prices the portfolio under all samples and dates.

The number of dates is defined by the DateGrid passed to the constructor. The number of trades is defined by the size of the portfolio passed to buildCube(). The number of samples is defined by the NPVCube that is passed to buildCube(), this can be dynamic.

In addition to storing the resulting NPVs it can be given any number of calculators that can store additional values in the cube.

Constructor & Destructor Documentation

◆ ValuationEngine()

ValuationEngine ( const QuantLib::Date & today,
const QuantLib::ext::shared_ptr< ore::data::DateGrid > & dg,
const QuantLib::ext::shared_ptr< analytics::SimMarket > & simMarket,
const set< std::pair< std::string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > > & modelBuilders = set< std::pair< std::string, QuantLib::ext::shared_ptr< QuantExt::ModelBuilder > > >(),
const bool recalibrate = true )

Constructor.

Parameters
todayValuation date
dgSimulation date grid
simMarketSimulated market object
modelBuildersmodel builders to be updated
recalibratewhether recalibrate() or newCalcWithoutCalibration() is called on model builders

Member Function Documentation

◆ buildCube()

void buildCube ( const QuantLib::ext::shared_ptr< data::Portfolio > & portfolio,
QuantLib::ext::shared_ptr< analytics::NPVCube > outputCube,
std::vector< QuantLib::ext::shared_ptr< ValuationCalculator > > calculators,
const ErrorPolicy = ErrorPolicy::RemoveAll,
bool mporStickyDate = true,
QuantLib::ext::shared_ptr< analytics::NPVCube > outputCubeNettingSet = nullptr,
QuantLib::ext::shared_ptr< analytics::NPVCube > outputCptyCube = nullptr,
std::vector< QuantLib::ext::shared_ptr< CounterpartyCalculator > > cptyCalculators = {},
bool dryRun = false,
Errors * errors = nullptr )

Build NPV cube.

Parameters
portfolioPortfolio to be priced
outputCubeObject for storing the results at trade level (e.g. NPVs, close-out NPVs, flows)
calculatorsCalculators to use
mporStickyDateUse sticky date in MPOR evaluation?
outputCubeNettingSetOutput cube for netting set-level results
outputCptyCubeOutput cube for storing counterparty-level survival probabilities
cptyCalculatorsCalculators for filling counterparty-level results
dryRunLimit samples to one and fill the rest of the cube with random values
errorserrors