Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
ore::analytics Namespace Reference

Namespaces

namespace  detail
 

Classes

class  AbstractAnalyticBuilder
 TradeBuilder base class. More...
 
class  AggregationScenarioData
 Container for storing simulated market data. More...
 
class  AMCValuationEngine
 AMC Valuation Engine. More...
 
class  Analytic
 
class  AnalyticBuilder
 Template AnalyticBuilder class. More...
 
class  AnalyticFactory
 AnalyticFactory. More...
 
class  AnalyticsManager
 
class  BacktestPNLCalculator
 
class  BucketMapping
 
class  BufferedSensitivityStream
 
class  CashflowCalculator
 CashflowCalculator. More...
 
class  CleanUpLogSingleton
 
class  CleanUpThreadGlobalSingletons
 
class  CleanUpThreadLocalSingletons
 
class  ClonedScenarioGenerator
 
class  CloneScenarioFactory
 Factory class for cloning scenario objects. More...
 
class  CollateralAccount
 Collateral Account. More...
 
class  CollateralExposureHelper
 Collateral Exposure Helper. More...
 
class  CompositeScenarioFilter
 Filter for combining the above. More...
 
class  ConstantDepthCalculator
 
class  CounterpartyCalculator
 CounterpartyCalculator interface. More...
 
class  CovarianceCalculator
 
class  CreditMigrationCalculator
 Credit Migration Calculator. More...
 
class  CreditMigrationHelper
 
class  CreditSimulationParameters
 Credit simulation description. More...
 
class  Crif
 
class  CrifConfiguration
 
class  CrifLoader
 
struct  CrifRecord
 
struct  crifRecordIsSimmParameter
 
class  CrossAssetModelScenarioGenerator
 Scenario Generator using cross asset model paths. More...
 
class  CsvBufferCrifLoader
 
class  CsvFileCrifLoader
 
class  CSVScenarioGenerator
 Class for generating scenarios from a csv file assumed to be in a format compatible with ScenarioWriter. More...
 
class  CubeCsvReader
 Read an NPV cube from a human readable text file. More...
 
class  CubeInterpretation
 Allow for interpretation of how data is stored within cube and AggregationScenarioData. More...
 
class  CubeWriter
 Write an NPV cube to a human readable text file. More...
 
class  CVASpreadSensitivityCalculator
 CVA Spread Sensitivity Calculator. More...
 
class  DecomposedSensitivityStream
 Class that wraps a sensitivity stream and decompose default, equity and commodity risk records given weights. More...
 
class  DeltaScenario
 Delta Scenario class. More...
 
class  DeltaScenarioFactory
 Factory class for cloning scenario objects. More...
 
class  DepthCalculator
 
class  DummyMarket
 
class  DynamicCreditXvaCalculator
 XVA Calculator base with dynamic credit. More...
 
class  DynamicInitialMarginCalculator
 Dynamic Initial Margin Calculator base class. More...
 
class  ExposureAllocator
 Exposure allocator base class. More...
 
class  ExposureCalculator
 XVA Calculator base class. More...
 
class  FilteredSensitivityStream
 Class that wraps a sensitivity stream and filters out negligible records. More...
 
class  FixingManager
 Pseudo Fixings Manager. More...
 
class  FlatDynamicInitialMarginCalculator
 Dynamic Initial Margin Calculator using flat extrapolation of t0 IM. More...
 
class  HistoricalPnlGenerator
 
class  HistoricalScenarioFileReader
 Class for reading historical scenarios from a csv file. More...
 
class  HistoricalScenarioGenerator
 Historical Scenario Generator. More...
 
class  HistoricalScenarioGeneratorRandom
 Historical scenario generator generating random scenarios, for testing purposes. More...
 
class  HistoricalScenarioGeneratorTransform
 Historical scenario generator transform. More...
 
class  HistoricalScenarioGeneratorWithFilteredDates
 
class  HistoricalScenarioLoader
 Class for loading historical scenarios. More...
 
class  HistoricalScenarioReader
 Base Class for reading historical scenarios. More...
 
class  HistoricalSensiPnlCalculator
 
class  HistoricalSimulationVarAnalytic
 
class  HistoricalSimulationVarAnalyticImpl
 
class  HistoricalSimulationVarCalculator
 
class  HistoricalSimulationVarReport
 HistoricalSimulation VaR Calculator. More...
 
class  IMScheduleAnalytic
 
class  IMScheduleAnalyticImpl
 
class  IMScheduleCalculator
 
struct  IMScheduleResult
 
class  IMScheduleResults
 
class  InMemoryAggregationScenarioData
 A concrete in memory implementation of AggregationScenarioData. More...
 
class  InMemoryCube1
 InMemoryCube of fixed depth 1. More...
 
class  InMemoryCubeBase
 InMemoryCube stores the cube in memory using nested STL vectors. More...
 
class  InMemoryCubeN
 InMemoryCube of variable depth. More...
 
class  InputParameters
 Base class for input data, also exposed via SWIG. More...
 
class  JaggedCube
 JaggedCube stores the cube in memory using a vector of trade specific blocks. More...
 
class  JointNPVCube
 
class  JointNPVSensiCube
 
class  LgmScenarioGenerator
 Scenario Generator using LGM model paths. More...
 
class  MarketCalibrationReport
 
class  MarketCalibrationReportBase
 
class  MarketDataAnalytic
 
class  MarketDataAnalyticImpl
 
class  MarketDataCsvLoader
 
class  MarketDataCsvLoaderImpl
 
class  MarketDataInMemoryLoader
 
class  MarketDataInMemoryLoaderImpl
 
class  MarketDataLoader
 
class  MarketDataLoaderImpl
 
class  MarketRiskBacktest
 
class  MarketRiskConfiguration
 
class  MarketRiskGroup
 
class  MarketRiskGroupBase
 
class  MarketRiskGroupBaseContainer
 
class  MarketRiskGroupContainer
 
class  MarketRiskReport
 
class  MPORCalculator
 MPORCalculator. More...
 
class  MultiStateNPVCalculator
 MultiStateNPVCalculator. More...
 
class  MultiThreadedValuationEngine
 
class  NettedExposureCalculator
 XVA Calculator base class. More...
 
class  NoneExposureAllocator
 
class  NPVCalculator
 NPVCalculator. More...
 
class  NPVCalculatorFXT0
 NPVCalculatorFXT0. More...
 
class  NPVCube
 NPV Cube class stores both future and current NPV values. More...
 
struct  NPVCubeWithMetaData
 
struct  NpvRecord
 
class  NPVSensiCube
 NPVSensiCube class stores NPVs resulting from risk factor shifts on an as of date. More...
 
class  ObservationMode
 The Global Observation setting. More...
 
class  OREApp
 Orchestrates the processes covered by ORE, data loading, analytics and reporting. More...
 
class  OREAppInputParameters
 
class  OutputParameters
 Traditional ORE input via ore.xml and various files, output into files. More...
 
class  Parameters
 Provides the input data and references to input files used in OREApp. More...
 
class  ParametricVarAnalytic
 
class  ParametricVarAnalyticImpl
 
class  ParametricVarCalculator
 
class  ParametricVarReport
 Parametric VaR Calculator. More...
 
class  ParConversionAnalytic
 
class  ParConversionAnalyticImpl
 
class  ParSensitivityAnalysis
 Par Sensitivity Analysis. More...
 
class  ParSensitivityConverter
 ParSensitivityConverter class. More...
 
class  ParSensitivityCubeStream
 
class  ParSensitivityInstrumentBuilder
 
class  ParStressConversionAnalytic
 
class  ParStressConversionAnalyticImpl
 
class  ParStressScenarioConverter
 Convert all par shifts in a single stress test scenario to zero shifts. More...
 
class  ParStressTestConverter
 
class  PnlAnalytic
 
class  PnlAnalyticImpl
 
class  PNLCalculator
 
class  PnlExplainAnalytic
 
class  PnlExplainAnalyticImpl
 
class  PnlExplainReport
 
class  PostProcess
 Exposure Aggregation and XVA Calculation. More...
 
class  PricingAnalytic
 
class  PricingAnalyticImpl
 
class  RegressionDynamicInitialMarginCalculator
 Dynamic Initial Margin Calculator using polynomial regression. More...
 
class  RelativeFairValueGrossExposureAllocator
 
class  RelativeFairValueNetExposureAllocator
 
class  RelativeXvaExposureAllocator
 
class  ReportWriter
 Write ORE outputs to reports. More...
 
class  ReturnConfiguration
 Return type for historical scenario generation (absolute, relative, log) More...
 
class  RiskFactorKey
 Data types stored in the scenario class. More...
 
class  RiskFactorScenarioFilter
 Filter that will only allow specified keys. More...
 
class  RiskFactorTypeScenarioFilter
 Filter that will only allow specified RiskFactorKey::KeyTypes. More...
 
class  RiskFilter
 Risk Filter. More...
 
class  Scenario
 Scenario Base Class. More...
 
class  ScenarioAnalytic
 
class  ScenarioAnalyticImpl
 
class  ScenarioFactory
 Scenario factory base class. More...
 
class  ScenarioFilter
 A scenario filter can exclude certain key from updating the scenario. More...
 
class  ScenarioGenerator
 Scenario generator base class. More...
 
class  ScenarioGeneratorBuilder
 Build a ScenarioGenerator. More...
 
class  ScenarioGeneratorData
 Scenario Generator description. More...
 
class  ScenarioGeneratorTransform
 
class  ScenarioPathGenerator
 Scenario generator that generates an entire path. More...
 
class  ScenarioShiftCalculator
 
class  ScenarioSimMarket
 Simulation Market updated with discrete scenarios. More...
 
class  ScenarioSimMarketParameters
 ScenarioSimMarket description. More...
 
class  ScenarioStatisticsAnalytic
 
class  ScenarioStatisticsAnalyticImpl
 
class  ScenarioWriter
 Class for writing scenarios to file. More...
 
class  SensiCube
 SensiCube stores only npvs not equal to the base npvs. More...
 
class  SensitivityAggregator
 
class  SensitivityAnalysis
 Sensitivity Analysis. More...
 
class  SensitivityBufferStream
 
class  SensitivityCube
 SensitivityCube is a wrapper for an npvCube that gives easier access to the underlying cube elements. More...
 
class  SensitivityCubeStream
 
class  SensitivityFileStream
 
class  SensitivityInMemoryStream
 Class for streaming SensitivityRecords from csv file. More...
 
class  SensitivityInputStream
 Class for streaming SensitivityRecords from csv file. More...
 
struct  SensitivityRecord
 
class  SensitivityReportStream
 Class for streaming SensitivityRecords from csv file. More...
 
class  SensitivityRunner
 
class  SensitivityScenarioData
 Description of sensitivity shift scenarios. More...
 
class  SensitivityScenarioGenerator
 Sensitivity Scenario Generator. More...
 
class  SensitivityStream
 Base Class for streaming SensitivityRecords. More...
 
class  ShiftScenarioGenerator
 Shift Scenario Generator. More...
 
class  SimmAnalytic
 
class  SimmAnalyticImpl
 
class  SimMarket
 Simulation Market. More...
 
class  SimmBasicNameMapper
 
class  SimmBucketMapper
 
class  SimmBucketMapperBase
 
class  SimmCalculator
 A class to calculate SIMM given a set of aggregated CRIF results for one or more portfolios. More...
 
class  SimmCalibration
 
class  SimmCalibrationData
 
class  SimmConcentration
 
class  SimmConcentration_ISDA_V1_3
 
class  SimmConcentration_ISDA_V1_3_38
 Class giving the SIMM concentration thresholds for v1.3.38. More...
 
class  SimmConcentration_ISDA_V2_0
 
class  SimmConcentration_ISDA_V2_1
 
class  SimmConcentration_ISDA_V2_2
 
class  SimmConcentration_ISDA_V2_3
 
class  SimmConcentration_ISDA_V2_3_8
 
class  SimmConcentration_ISDA_V2_5
 
class  SimmConcentration_ISDA_V2_5A
 
class  SimmConcentration_ISDA_V2_6
 
class  SimmConcentrationBase
 
class  SimmConcentrationCalibration
 Class giving the ISDA SIMM concentration thresholds as defined by a SIMM calibration. More...
 
class  SimmConfiguration
 Abstract base class defining the interface for a SIMM configuration. More...
 
class  SimmConfiguration_ISDA_V1_0
 
class  SimmConfiguration_ISDA_V1_3
 
class  SimmConfiguration_ISDA_V1_3_38
 Class giving the SIMM configuration for v1.3.38. More...
 
class  SimmConfiguration_ISDA_V2_0
 
class  SimmConfiguration_ISDA_V2_1
 
class  SimmConfiguration_ISDA_V2_2
 
class  SimmConfiguration_ISDA_V2_3
 
class  SimmConfiguration_ISDA_V2_3_8
 
class  SimmConfiguration_ISDA_V2_5
 
class  SimmConfiguration_ISDA_V2_5A
 
class  SimmConfiguration_ISDA_V2_6
 
class  SimmConfigurationBase
 
class  SimmConfigurationCalibration
 
class  SimmNameMapper
 
class  SimmResults
 
class  SimpleScenario
 
class  SimpleScenarioFactory
 Factory class for building simple scenario objects. More...
 
class  SparseNpvCube
 
class  StaticCreditXvaCalculator
 XVA Calculator base with static credit. More...
 
class  StaticScenarioGenerator
 
class  StressScenarioGenerator
 Stress Scenario Generator. More...
 
class  StressTest
 Stress Test Analysis. More...
 
class  StressTestAnalytic
 
class  StressTestAnalyticImpl
 
class  StressTestScenarioData
 Description of sensitivity shift scenarios. More...
 
class  StringStreamCrifLoader
 
class  StructuredAnalyticsErrorMessage
 
class  StructuredAnalyticsWarningMessage
 
class  StructuredFixingWarningMessage
 Utility class for Structured Fixing warnings. More...
 
class  SurvivalProbabilityCalculator
 SurvivalProbabilityCalculator. More...
 
class  TradeBlock
 
class  TradeGroup
 
class  TradeGroupBase
 
class  TradeGroupBaseContainer
 
class  TradeGroupContainer
 
class  ValuationCalculator
 ValuationCalculator interface. More...
 
class  ValuationEngine
 Valuation Engine. More...
 
class  ValueAdjustmentCalculator
 XVA Calculator base class. More...
 
class  VarAnalytic
 
class  VarAnalyticImpl
 
class  VarCalculator
 VaR Calculator. More...
 
class  VarReport
 
class  XvaAnalytic
 
class  XvaAnalyticImpl
 
class  XvaEngineCG
 
class  XvaRunner
 
class  XvaSensitivityAnalytic
 
class  XvaSensitivityAnalyticImpl
 
class  XvaStressAnalytic
 
class  XvaStressAnalyticImpl
 
class  ZeroSensitivityLoader
 
class  ZeroToParCube
 ZeroToParCube class. More...
 
class  ZeroToParShiftAnalytic
 
class  ZeroToParShiftAnalyticImpl
 
class  ZeroToParShiftConverter
 

Typedefs

typedef std::map< QuantLib::Date, std::set< std::string > > QuoteMap
 
typedef std::map< std::string, RequiredFixings::FixingDatesFixingMap
 
typedef std::map< Currency, Matrix, CurrencyComparatorresult_type_matrix
 
typedef std::map< Currency, std::vector< Real >, CurrencyComparatorresult_type_vector
 
typedef std::map< Currency, Real, CurrencyComparatorresult_type_scalar
 
using ProductClass = CrifRecord::ProductClass
 
using RiskClass = SimmConfiguration::RiskClass
 
typedef SimmConfiguration::MarginType MarginType
 
typedef SimmConfiguration::SimmSide SimmSide
 
typedef IMScheduleCalculator::IMScheduleTradeData IMScheduleTradeData
 
using SinglePrecisionInMemoryCube = InMemoryCube1< float >
 InMemoryCube of depth 1 with single precision floating point numbers. More...
 
using DoublePrecisionInMemoryCube = InMemoryCube1< double >
 InMemoryCube of depth 1 with double precision floating point numbers. More...
 
using SinglePrecisionInMemoryCubeN = InMemoryCubeN< float >
 InMemoryCube of depth N with single precision floating point numbers. More...
 
using DoublePrecisionInMemoryCubeN = InMemoryCubeN< double >
 InMemoryCube of depth N with double precision floating point numbers. More...
 
using SinglePrecisionJaggedCube = JaggedCube< float >
 Jagged cube with single precision floating point numbers. More...
 
using DoublePrecisionJaggedCube = JaggedCube< double >
 Jagged cube with double precision floating point numbers. More...
 
using SinglePrecisionSensiCube = SensiCube< float >
 Sensi cube with single precision floating point numbers. More...
 
using DoublePrecisionSensiCube = SensiCube< double >
 Sensi cube with double precision floating point numbers. More...
 
using SinglePrecisionSparseNpvCube = SparseNpvCube< float >
 
using RealPrecisionSparseNpvCube = SparseNpvCube< Real >
 
using TradePnlStore = HistoricalPnlGenerator::TradePnlStore
 
using TradePnLStore = std::vector< std::vector< QuantLib::Real > >
 
typedef std::pair< RiskFactorKey, RiskFactorKeyCrossPair
 
template<typename T >
using bm = boost::bimap< T, boost::bimaps::set_of< string, string_cmp > >
 
using crossPair = SensitivityCube::crossPair
 
using RFType = RiskFactorKey::KeyType
 
using ShiftData = SensitivityScenarioData::ShiftData
 
using RiskType = CrifRecord::RiskType
 
typedef SimmConfiguration::Regulation Regulation
 
using RC = SimmConfiguration::RiskClass
 
using RT = CrifRecord::RiskType
 
using IRFXConcentrationThresholds = SimmCalibration::RiskClassData::IRFXConcentrationThresholds
 

Enumerations

enum class  AggregationScenarioDataType : unsigned int {
  IndexFixing = 0 , FXSpot = 1 , Numeraire = 2 , CreditState = 3 ,
  SurvivalWeight = 4 , RecoveryRate = 5 , Generic = 6
}
 
enum class  ShiftScheme { Forward , Backward , Central }
 
enum class  ShiftType { Absolute , Relative }
 
enum  IMScheduleLabel {
  Credit2 , Credit5 , Credit100 , Commodity ,
  Equity , FX , Rates2 , Rates5 ,
  Rates100 , Other
}
 
enum class  SimmVersion {
  V1_0 , V1_1 , V1_2 , V1_3 ,
  V1_3_38 , V2_0 , V2_1 , V2_2 ,
  V2_3 , V2_3_8 , V2_5 , V2_5A ,
  V2_6
}
 Ordered SIMM versions. More...
 

Functions

CollateralExposureHelper::CalculationType parseCollateralCalculationType (const string &s)
 Convert text representation to CollateralExposureHelper::CalculationType. More...
 
std::ostream & operator<< (std::ostream &out, CollateralExposureHelper::CalculationType t)
 
CreditMigrationHelper::CreditMode parseCreditMode (const std::string &s)
 
CreditMigrationHelper::LoanExposureMode parseLoanExposureMode (const std::string &s)
 
CreditMigrationHelper::Evaluation parseEvaluation (const std::string &s)
 
bool lessThan (const Array &a, const Array &b)
 
ExposureAllocator::AllocationMethod parseAllocationMethod (const string &s)
 Convert text representation to ExposureAllocator::AllocationMethod. More...
 
std::ostream & operator<< (std::ostream &out, ExposureAllocator::AllocationMethod m)
 Convert ExposureAllocator::AllocationMethod to text representation. More...
 
QuantLib::ext::shared_ptr< LoaderimplyBondSpreads (const Date &asof, const QuantLib::ext::shared_ptr< ore::analytics::InputParameters > &params, const QuantLib::ext::shared_ptr< TodaysMarketParameters > &todaysMarketParams, const QuantLib::ext::shared_ptr< Loader > &loader, const QuantLib::ext::shared_ptr< CurveConfigurations > &curveConfigs, const std::string &excludeRegex)
 
QuantLib::ext::shared_ptr< ore::data::LoaderimplyBondSpreads (const Date &asof, const QuantLib::ext::shared_ptr< InputParameters > &params, const QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > &todaysMarketParams, const QuantLib::ext::shared_ptr< ore::data::Loader > &loader, const QuantLib::ext::shared_ptr< ore::data::CurveConfigurations > &curveConfigs, const std::string &excludeRegex)
 
std::map< RiskFactorKey, std::string > getScenarioDescriptions (QuantLib::ext::shared_ptr< ScenarioGenerator > scenGen)
 
std::map< std::string, Size > checkReportNames (const ore::analytics::Analytic::analytic_reports &rpts)
 
bool endsWith (const std::string &name, const std::string &suffix)
 
QuantLib::ext::shared_ptr< AnalyticsManagerparseAnalytics (const std::string &s, const QuantLib::ext::shared_ptr< InputParameters > &inputs, const QuantLib::ext::shared_ptr< MarketDataLoader > &marketDataLoader)
 
void initBuilders (const bool registerOREAnalytics)
 
vector< string > getFileNames (const string &fileString, const std::filesystem::path &path)
 
void additional_fx_fixings (const string &fixingId, const RequiredFixings::FixingDates &fixingDates, FixingMap &relevantFixings)
 
void additional_commodity_fixings (const string &fixingId, const RequiredFixings::FixingDates &fixingDates, FixingMap &fixings, map< pair< string, Date >, set< Date > > &commodityMap)
 
void additional_equity_fixings (map< string, RequiredFixings::FixingDates > &fixings, const TodaysMarketParameters &mktParams, const QuantLib::ext::shared_ptr< ReferenceDataManager > refData, const QuantLib::ext::shared_ptr< CurveConfigurations > &curveConfigs)
 
void addNettingSetExposure (ore::data::Report &report, QuantLib::ext::shared_ptr< PostProcess > postProcess, const string &nettingSetId)
 
template<class T >
void addMapResults (boost::any resultMap, const std::string &tradeId, const std::string &resultName, Report &report)
 
Real aggregateTradeFlow (const std::string &tradeId, const Date &d0, const Date &d1, const ext::shared_ptr< InMemoryReport > &cashFlowReport, const ext::shared_ptr< ore::data::Market > &market, const std::string &baseCurrency)
 
NPVCubeWithMetaData loadCube (const std::string &filename, const bool doublePrecision)
 
void saveCube (const std::string &filename, const NPVCubeWithMetaData &cube, const bool doublePrecision)
 
QuantLib::ext::shared_ptr< AggregationScenarioDataloadAggregationScenarioData (const std::string &filename)
 
void saveAggregationScenarioData (const std::string &filename, const AggregationScenarioData &cube)
 
std::ostream & operator<< (std::ostream &out, const SensitivityCube::crossPair &cp)
 
std::ostream & operator<< (std::ostream &out, const ext::shared_ptr< MarketRiskGroupBase > &riskGroup)
 
std::ostream & operator<< (std::ostream &out, const ext::shared_ptr< TradeGroupBase > &tradeGroup)
 
std::ostream & operator<< (std::ostream &out, const QuantLib::ext::shared_ptr< MarketRiskGroupBase > &riskGroup)
 
std::ostream & operator<< (std::ostream &out, const QuantLib::ext::shared_ptr< TradeGroupBase > &tradeGroup)
 
ostream & operator<< (std::ostream &out, const NpvRecord &nr)
 Enable writing of a NpvRecord. More...
 
ParametricVarCalculator::ParametricVarParams::Method parseParametricVarMethod (const string &s)
 
ostream & operator<< (ostream &out, const ParametricVarCalculator::ParametricVarParams::Method &method)
 
void writeParConversionMatrix (const ore::analytics::ParSensitivityAnalysis::ParContainer &parSensitivities, ore::data::Report &reportOut)
 Write par instrument sensitivity report. More...
 
Real impliedQuote (const QuantLib::ext::shared_ptr< Instrument > &i)
 
Volatility impliedVolatility (const QuantLib::CapFloor &cap, Real targetValue, const Handle< YieldTermStructure > &d, Volatility guess, VolatilityType type, Real displacement)
 
Volatility impliedVolatility (const QuantLib::YoYInflationCapFloor &cap, Real targetValue, const Handle< YieldTermStructure > &d, Volatility guess, VolatilityType type, Real displacement, const Handle< YoYInflationIndex > &index)
 
bool riskFactorKeysAreSimilar (const ore::analytics::RiskFactorKey &x, const ore::analytics::RiskFactorKey &y)
 true if key type and name are equal, do not care about the index though More...
 
double impliedVolatility (const RiskFactorKey &key, const ParSensitivityInstrumentBuilder::Instruments &instruments)
 
Real impliedQuote (const QuantLib::ext::shared_ptr< QuantLib::Instrument > &i)
 Computes the implied quote. More...
 
double impliedVolatility (const QuantLib::CapFloor &cap, double targetValue, const QuantLib::Handle< QuantLib::YieldTermStructure > &d, double guess, QuantLib::VolatilityType type, double displacement)
 
double impliedVolatility (const QuantLib::YoYInflationCapFloor &cap, double targetValue, const QuantLib::Handle< QuantLib::YieldTermStructure > &d, double guess, QuantLib::VolatilityType type, double displacement, const QuantLib::Handle< QuantLib::YoYInflationIndex > &index={})
 
std::set< RiskFactorKey::KeyTypedisabledParRates (bool irCurveParRates, bool irCapFloorParRates, bool creditParRates)
 
bool checkCurveShiftData (const std::string &name, const StressTestScenarioData::CurveShiftData &stressShiftData, const std::map< std::string, QuantLib::ext::shared_ptr< SensitivityScenarioData::CurveShiftData > > &sensiData)
 Checks the the tenors for curves in a stresstest scenario are alligned with par sensitivity config. More...
 
bool checkCapFloorShiftData (const std::string &name, const StressTestScenarioData::CapFloorVolShiftData &stressShiftData, const std::map< std::string, QuantLib::ext::shared_ptr< SensitivityScenarioData::CapFloorVolShiftData > > &sensiData)
 Checks the the strikes and expiries of cap floors in stresstest scenario are alligned with par sensitivity config. More...
 
void populateResults (QuantLib::ext::shared_ptr< MarketRiskGroup > mrg, PnlExplainReport::PnlExplainResults &result, QuantLib::Real deltaPnl, QuantLib::Real gammaPnl, QuantLib::Real pnl)
 
ostream & operator<< (ostream &out, const MarketRiskConfiguration::RiskClass &rc)
 
ostream & operator<< (ostream &out, const MarketRiskConfiguration::RiskType &mt)
 
MarketRiskConfiguration::RiskClass parseVarRiskClass (const string &rc)
 
MarketRiskConfiguration::RiskType parseVarMarginType (const string &mt)
 
MarketRiskConfiguration::RiskType parseVarRiskType (const std::string &rt)
 
Real getShiftSize (const RiskFactorKey &key, const SensitivityScenarioData &sensiParams, const QuantLib::ext::shared_ptr< ScenarioSimMarket > &simMarket, const string &marketConfiguration)
 
std::ostream & operator<< (std::ostream &out, const SensitivityRecord &sr)
 Enable writing of a SensitivityRecord. More...
 
std::ostream & operator<< (std::ostream &out, const AggregationScenarioDataType &t)
 
std::ostream & operator<< (std::ostream &out, const ReturnConfiguration::ReturnType t)
 
QuantLib::ext::shared_ptr< HistoricalScenarioGeneratorbuildHistoricalScenarioGenerator (const QuantLib::ext::shared_ptr< HistoricalScenarioReader > &hsr, const QuantLib::ext::shared_ptr< ore::data::AdjustmentFactors > &adjFactors, const TimePeriod &period, Calendar calendar, Size mporDays, const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > &simParams, const QuantLib::ext::shared_ptr< TodaysMarketParameters > &marketParams, const bool overlapping)
 
QuantLib::ext::shared_ptr< HistoricalScenarioGeneratorbuildHistoricalScenarioGenerator (const QuantLib::ext::shared_ptr< HistoricalScenarioReader > &hsr, const QuantLib::ext::shared_ptr< ore::data::AdjustmentFactors > &adjFactors, const std::set< QuantLib::Date > &dates, const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > &simParams, const QuantLib::ext::shared_ptr< TodaysMarketParameters > &marketParams)
 
std::size_t hash_value (const RiskFactorKey &k)
 
std::ostream & operator<< (std::ostream &out, const RiskFactorKey::KeyType &type)
 
std::ostream & operator<< (std::ostream &out, const RiskFactorKey &key)
 
RiskFactorKey::KeyType parseRiskFactorKeyType (const string &str)
 
RiskFactorKey parseRiskFactorKey (const string &str)
 
ShiftScheme parseShiftScheme (const std::string &s)
 
std::ostream & operator<< (std::ostream &out, const ShiftScheme &shiftScheme)
 
ShiftType parseShiftType (const std::string &s)
 
std::ostream & operator<< (std::ostream &out, const ShiftType &shiftType)
 
bool operator< (const RiskFactorKey &lhs, const RiskFactorKey &rhs)
 
bool operator== (const RiskFactorKey &lhs, const RiskFactorKey &rhs)
 
bool operator> (const RiskFactorKey &lhs, const RiskFactorKey &rhs)
 
bool operator<= (const RiskFactorKey &lhs, const RiskFactorKey &rhs)
 
bool operator>= (const RiskFactorKey &lhs, const RiskFactorKey &rhs)
 
bool operator!= (const RiskFactorKey &lhs, const RiskFactorKey &rhs)
 
RiskFactorKey::KeyType yieldCurveRiskFactor (const ore::data::YieldCurveType y)
 Map a yield curve type to a risk factor key type. More...
 
ore::data::YieldCurveType riskFactorYieldCurve (const RiskFactorKey::KeyType rf)
 
Real getDifferenceScenario (const RiskFactorKey::KeyType keyType, const Real v1, const Real v2)
 
Real addDifferenceToScenario (const RiskFactorKey::KeyType keyType, const Real v, const Real d)
 
QuantLib::ext::shared_ptr< ScenariogetDifferenceScenario (const QuantLib::ext::shared_ptr< Scenario > &s1, const QuantLib::ext::shared_ptr< Scenario > &s2, const Date &targetScenarioAsOf, const Real targetScenarioNumeraire)
 
QuantLib::ext::shared_ptr< ScenarioaddDifferenceToScenario (const QuantLib::ext::shared_ptr< Scenario > &s, const QuantLib::ext::shared_ptr< Scenario > &d, const Date &targetScenarioAsOf, const Real targetScenarioNumeraire)
 
QuantLib::ext::shared_ptr< ScenariorecastScenario (const QuantLib::ext::shared_ptr< Scenario > &scenario, const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > &oldCoordinates, const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > &newCoordinates)
 
QuantLib::ext::shared_ptr< ScenariorecastScenario (const QuantLib::ext::shared_ptr< Scenario > &scenario, const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > &oldCoordinates, const std::set< std::tuple< RiskFactorKey::KeyType, std::string, std::vector< std::vector< Real > > > > &newCoordinates)
 
std::set< std::string > getShiftSpecKeys (const SensitivityScenarioData &d)
 
bool close (const Real &t_1, const Real &t_2)
 
bool vectorEqual (const vector< Real > &v_1, const vector< Real > &v_2)
 
ostream & operator<< (ostream &out, const ShiftScenarioGenerator::ScenarioDescription &scenarioDescription)
 
pair< RiskFactorKey, string > deconstructFactor (const string &factor)
 
string reconstructFactor (const RiskFactorKey &key, const std::string &desc)
 Reconstruct the string description from a risk factor key and its index description desc. More...
 
QuantLib::ext::shared_ptr< RiskFactorKeyparseRiskFactorKey (const std::string &str, std::vector< std::string > &addTokens)
 risk factor key parser that takes into account additional tokens occurring in sensitivity risk factor keys More...
 
bool operator< (const ShiftScenarioGenerator::ScenarioDescription &lhs, const ShiftScenarioGenerator::ScenarioDescription &rhs)
 
bool operator== (const ShiftScenarioGenerator::ScenarioDescription &lhs, const ShiftScenarioGenerator::ScenarioDescription &rhs)
 
void curveShiftDataToXml (ore::data::XMLDocument &doc, XMLNode *node, const std::map< std::string, StressTestScenarioData::CurveShiftData > &data, const std::string &identifier, const std::string &nodeName, const std::string &parentNodeName=std::string())
 
void volShiftDataToXml (ore::data::XMLDocument &doc, XMLNode *node, const std::map< std::string, StressTestScenarioData::VolShiftData > &data, const std::string &identifier, const std::string &nodeName, const std::string &parentNodeName)
 
void spotShiftDataToXml (ore::data::XMLDocument &doc, XMLNode *node, const std::map< std::string, StressTestScenarioData::SpotShiftData > &data, const std::string &identifier, const std::string &nodeName)
 
string periodToLabels2 (const QuantLib::Period &p)
 
ostream & operator<< (ostream &out, const CrifRecord::RiskType &rt)
 
ostream & operator<< (ostream &out, const CrifRecord::ProductClass &pc)
 
CrifRecord::RiskType parseRiskType (const string &rt)
 
CrifRecord::ProductClass parseProductClass (const string &pc)
 
std::ostream & operator<< (std::ostream &out, const CrifRecord::CurvatureScenario &scenario)
 
CrifRecord::CurvatureScenario parseFrtbCurvatureScenario (const std::string &scenario)
 
ostream & operator<< (std::ostream &out, const CrifRecord &cr)
 Enable writing of a CrifRecord. More...
 
bool operator< (const SimmBucketMapper::FailedMapping &a, const SimmBucketMapper::FailedMapping &b)
 
bool operator< (const BucketMapping &a, const BucketMapping &b)
 
ostream & operator<< (ostream &out, const SimmConfiguration::SimmSide &s)
 
ostream & operator<< (ostream &out, const SimmConfiguration::RiskClass &rc)
 
ostream & operator<< (ostream &out, const SimmConfiguration::MarginType &mt)
 
ostream & operator<< (ostream &out, const SimmConfiguration::IMModel &model)
 
ostream & operator<< (ostream &out, const SimmConfiguration::Regulation &regulation)
 
SimmConfiguration::SimmSide parseSimmSide (const string &side)
 
SimmConfiguration::RiskClass parseSimmRiskClass (const string &rc)
 
SimmConfiguration::MarginType parseSimmMarginType (const string &mt)
 
SimmConfiguration::IMModel parseIMModel (const string &model)
 
SimmConfiguration::Regulation parseRegulation (const string &regulation)
 
string combineRegulations (const string &regs1, const string &regs2)
 
set< string > parseRegulationString (const std::string &regsString, const std::set< std::string > &valueIfEmpty={"Unspecified"})
 Reads a string containing regulations applicable for a given CRIF record. More...
 
string sortRegulationString (const string &regsString)
 
string removeRegulations (const std::string &regsString, const std::vector< std::string > &regsToRemove)
 Removes a given vector of regulations from a string of regulations and returns a string with the regulations removed. More...
 
string filterRegulations (const string &regsString, const vector< string > &regsToFilter)
 
SimmConfiguration::Regulation getWinningRegulation (const std::vector< std::string > &winningRegulations)
 From a vector of regulations, determine the winning regulation based on order of priority. More...
 
ostream & operator<< (std::ostream &out, const SimmResults::Key &resultsKey)
 Enable writing of Key. More...
 
std::vector< std::string > loadFactorList (const std::string &inputFileName, const char delim)
 
std::vector< std::vector< double > > loadScenarios (const std::string &inputFileName, const char delim)
 
Matrix loadCovarianceMatrix (const std::string &inputFileName, const char delim)
 
SimmVersion parseSimmVersion (const string &version)
 
QuantLib::ext::shared_ptr< SimmConfigurationbuildSimmConfiguration (const string &simmVersion, const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper, const QuantLib::ext::shared_ptr< SimmCalibrationData > &simmCalibrationData, const Size &mporDays)
 
std::string escapeCommaSeparatedList (const std::string &str, const char &csvQuoteChar)
 
QuantLib::ext::shared_ptr< SimmConfigurationbuildSimmConfiguration (const std::string &simmVersion, const QuantLib::ext::shared_ptr< SimmBucketMapper > &simmBucketMapper, const QuantLib::ext::shared_ptr< SimmCalibrationData > &simmCalibrationData=nullptr, const QuantExt::Size &mporDays=10)
 
Date nextValidFixingDate (Date d, const QuantLib::ext::shared_ptr< Index > &index, Size gap=7)
 

Variables

const bm< MarketRiskConfiguration::RiskClassriskClassMap
 
const bm< MarketRiskConfiguration::RiskTyperiskTypeMap
 
auto isSimmParameter = [](const ore::analytics::CrifRecord& x) { return x.isSimmParameter(); }
 
auto isNotSimmParameter = std::not_fn(isSimmParameter)
 
const bm< CrifRecord::ProductClassproductClassMap
 
const map< RiskType, RiskTypenonVolRiskTypeMap
 
const bm< SimmConfiguration::MarginTypemarginTypeMap
 
const bm< SimmConfiguration::IMModelimModelMap
 
const bm< SimmConfiguration::RegulationregulationsMap
 

Detailed Description

Analytics namespace

Typedef Documentation

◆ QuoteMap

typedef std::map<QuantLib::Date, std::set<std::string> > QuoteMap

Definition at line 32 of file marketdataloader.hpp.

◆ FixingMap

typedef std::map<std::string, RequiredFixings::FixingDates> FixingMap

Definition at line 33 of file marketdataloader.hpp.

◆ result_type_matrix

typedef std::map<Currency, Matrix, CurrencyComparator> result_type_matrix

Definition at line 76 of file reportwriter.cpp.

◆ result_type_vector

typedef std::map<Currency, std::vector<Real>, CurrencyComparator> result_type_vector

Definition at line 77 of file reportwriter.cpp.

◆ result_type_scalar

typedef std::map<Currency, Real, CurrencyComparator> result_type_scalar

Definition at line 78 of file reportwriter.cpp.

◆ ProductClass

Definition at line 1565 of file reportwriter.cpp.

◆ RiskClass

Definition at line 1566 of file reportwriter.cpp.

◆ MarginType

Definition at line 1567 of file reportwriter.cpp.

◆ SimmSide

Definition at line 1568 of file reportwriter.cpp.

◆ IMScheduleTradeData

Definition at line 2209 of file reportwriter.cpp.

◆ SinglePrecisionInMemoryCube

InMemoryCube of depth 1 with single precision floating point numbers.

Definition at line 184 of file inmemorycube.hpp.

◆ DoublePrecisionInMemoryCube

InMemoryCube of depth 1 with double precision floating point numbers.

Definition at line 187 of file inmemorycube.hpp.

◆ SinglePrecisionInMemoryCubeN

InMemoryCube of depth N with single precision floating point numbers.

Definition at line 190 of file inmemorycube.hpp.

◆ DoublePrecisionInMemoryCubeN

InMemoryCube of depth N with double precision floating point numbers.

Definition at line 193 of file inmemorycube.hpp.

◆ SinglePrecisionJaggedCube

Jagged cube with single precision floating point numbers.

Definition at line 269 of file jaggedcube.hpp.

◆ DoublePrecisionJaggedCube

Jagged cube with double precision floating point numbers.

Definition at line 272 of file jaggedcube.hpp.

◆ SinglePrecisionSensiCube

Sensi cube with single precision floating point numbers.

Definition at line 137 of file sensicube.hpp.

◆ DoublePrecisionSensiCube

Sensi cube with double precision floating point numbers.

Definition at line 140 of file sensicube.hpp.

◆ SinglePrecisionSparseNpvCube

Definition at line 65 of file sparsenpvcube.hpp.

◆ RealPrecisionSparseNpvCube

Definition at line 66 of file sparsenpvcube.hpp.

◆ TradePnlStore

Definition at line 169 of file historicalpnlgenerator.cpp.

◆ TradePnLStore

using TradePnLStore = std::vector<std::vector<QuantLib::Real> >

Definition at line 38 of file marketriskreport.hpp.

◆ CrossPair

typedef std::pair<RiskFactorKey, RiskFactorKey> CrossPair

Definition at line 49 of file parametricvar.hpp.

◆ bm

using bm = boost::bimap<T, boost::bimaps::set_of<string, string_cmp> >

Definition at line 42 of file riskfilter.cpp.

◆ crossPair

Definition at line 31 of file sensitivitycubestream.cpp.

◆ RFType

Definition at line 41 of file scenarioshiftcalculator.cpp.

◆ ShiftData

Definition at line 42 of file scenarioshiftcalculator.cpp.

◆ RiskType

Definition at line 92 of file crifloader.cpp.

◆ Regulation

Definition at line 62 of file simmcalculator.cpp.

◆ RC

Definition at line 55 of file simmcalibration.cpp.

◆ RT

Definition at line 56 of file simmcalibration.cpp.

◆ IRFXConcentrationThresholds

Definition at line 37 of file simmconcentration.cpp.

Enumeration Type Documentation

◆ AggregationScenarioDataType

enum class AggregationScenarioDataType : unsigned int
strong
Enumerator
IndexFixing 
FXSpot 
Numeraire 
CreditState 
SurvivalWeight 
RecoveryRate 
Generic 

Definition at line 42 of file aggregationscenariodata.hpp.

◆ ShiftScheme

enum class ShiftScheme
strong
Enumerator
Forward 
Backward 
Central 

Definition at line 189 of file scenario.hpp.

◆ ShiftType

enum class ShiftType
strong
Enumerator
Absolute 
Relative 

Definition at line 190 of file scenario.hpp.

◆ IMScheduleLabel

Enumerator
Credit2 
Credit5 
Credit100 
Commodity 
Equity 
FX 
Rates2 
Rates5 
Rates100 
Other 

Definition at line 34 of file imscheduleresults.hpp.

◆ SimmVersion

enum class SimmVersion
strong

Function Documentation

◆ parseCollateralCalculationType()

CollateralExposureHelper::CalculationType parseCollateralCalculationType ( const string &  s)

Convert text representation to CollateralExposureHelper::CalculationType.

Definition at line 31 of file collatexposurehelper.cpp.

31 {
32 static map<string, CollateralExposureHelper::CalculationType> m = {
33 {"Symmetric", CollateralExposureHelper::Symmetric},
34 {"AsymmetricCVA", CollateralExposureHelper::AsymmetricCVA},
35 {"AsymmetricDVA", CollateralExposureHelper::AsymmetricDVA},
36 {"NoLag", CollateralExposureHelper::NoLag}
37 };
38 auto it = m.find(s);
39 if (it != m.end()) {
40 return it->second;
41 } else {
42 QL_FAIL("Collateral Calculation Type \"" << s << "\" not recognized");
43 }
44}

◆ operator<<() [1/29]

std::ostream & operator<< ( std::ostream &  out,
CollateralExposureHelper::CalculationType  t 
)

Definition at line 46 of file collatexposurehelper.cpp.

46 {
47 if (t == CollateralExposureHelper::Symmetric)
48 out << "Symmetric";
49 else if (t == CollateralExposureHelper::AsymmetricCVA)
50 out << "AsymmetricCVA";
51 else if (t == CollateralExposureHelper::AsymmetricDVA)
52 out << "AsymmetricDVA";
53 else if (t == CollateralExposureHelper::NoLag)
54 out << "NoLag";
55 else
56 QL_FAIL("Collateral calculation type not covered");
57 return out;
58}

◆ parseCreditMode()

CreditMigrationHelper::CreditMode parseCreditMode ( const std::string &  s)

Definition at line 634 of file creditmigrationhelper.cpp.

634 {
635 static map<string, CreditMigrationHelper::CreditMode> m = {
636 {"Migration", CreditMigrationHelper::CreditMode::Migration},
637 {"Default", CreditMigrationHelper::CreditMode::Default}};
638
639 auto it = m.find(s);
640 if (it != m.end()) {
641 return it->second;
642 } else {
643 QL_FAIL("Credit Mode \"" << s << "\" not recognized");
644 }
645}

◆ parseLoanExposureMode()

CreditMigrationHelper::LoanExposureMode parseLoanExposureMode ( const std::string &  s)

Definition at line 647 of file creditmigrationhelper.cpp.

647 {
648 static map<string, CreditMigrationHelper::LoanExposureMode> m = {
649 {"Notional", CreditMigrationHelper::LoanExposureMode::Notional},
650 {"Value", CreditMigrationHelper::LoanExposureMode::Value}};
651
652 auto it = m.find(s);
653 if (it != m.end()) {
654 return it->second;
655 } else {
656 QL_FAIL("Loan EAD \"" << s << "\" not recognized");
657 }
658}

◆ parseEvaluation()

CreditMigrationHelper::Evaluation parseEvaluation ( const std::string &  s)

Definition at line 660 of file creditmigrationhelper.cpp.

660 {
661 static map<string, CreditMigrationHelper::Evaluation> m = {
662 {"Analytic", CreditMigrationHelper::Evaluation::Analytic},
663 {"TerminalSimulation", CreditMigrationHelper::Evaluation::TerminalSimulation}};
664
665 auto it = m.find(s);
666 if (it != m.end()) {
667 return it->second;
668 } else {
669 QL_FAIL("Evaluation \"" << s << "\" not recognized");
670 }
671}

◆ lessThan()

bool lessThan ( const Array &  a,
const Array &  b 
)

Definition at line 99 of file dimregressioncalculator.hpp.

99 {
100 QL_REQUIRE(a.size() > 0, "array a is empty");
101 QL_REQUIRE(b.size() > 0, "array a is empty");
102 return a[0] < b[0];
103}

◆ parseAllocationMethod()

ExposureAllocator::AllocationMethod parseAllocationMethod ( const string &  s)

Convert text representation to ExposureAllocator::AllocationMethod.

Definition at line 199 of file exposureallocator.cpp.

199 {
200 static map<string, ExposureAllocator::AllocationMethod> m = {
201 {"None", ExposureAllocator::AllocationMethod::None},
202 {"Marginal", ExposureAllocator::AllocationMethod::Marginal},
203 {"RelativeFairValueGross", ExposureAllocator::AllocationMethod::RelativeFairValueGross},
204 {"RelativeFairValueNet", ExposureAllocator::AllocationMethod::RelativeFairValueNet},
205 {"RelativeXVA", ExposureAllocator::AllocationMethod::RelativeXVA},
206 };
207
208 auto it = m.find(s);
209 if (it != m.end()) {
210 return it->second;
211 } else {
212 QL_FAIL("AllocationMethod \"" << s << "\" not recognized");
213 }
214}
+ Here is the caller graph for this function:

◆ operator<<() [2/29]

std::ostream & operator<< ( std::ostream &  out,
ExposureAllocator::AllocationMethod  m 
)

Convert ExposureAllocator::AllocationMethod to text representation.

Definition at line 216 of file exposureallocator.cpp.

216 {
217 if (m == ExposureAllocator::AllocationMethod::None)
218 out << "None";
219 else if (m == ExposureAllocator::AllocationMethod::Marginal)
220 out << "Marginal";
221 else if (m == ExposureAllocator::AllocationMethod::RelativeFairValueGross)
222 out << "RelativeFairValueGross";
223 else if (m == ExposureAllocator::AllocationMethod::RelativeFairValueNet)
224 out << "RelativeFairValueNet";
225 else if (m == ExposureAllocator::AllocationMethod::RelativeXVA)
226 out << "RelativeXVA";
227 else
228 QL_FAIL("Allocation method not covered");
229 return out;
230}

◆ implyBondSpreads() [1/2]

QuantLib::ext::shared_ptr< Loader > implyBondSpreads ( const Date &  asof,
const QuantLib::ext::shared_ptr< ore::analytics::InputParameters > &  params,
const QuantLib::ext::shared_ptr< TodaysMarketParameters > &  todaysMarketParams,
const QuantLib::ext::shared_ptr< Loader > &  loader,
const QuantLib::ext::shared_ptr< CurveConfigurations > &  curveConfigs,
const std::string &  excludeRegex 
)

Definition at line 273 of file analytic.cpp.

278 {
279
280 auto securities = BondSpreadImply::requiredSecurities(asof, todaysMarketParams, curveConfigs, *loader,
281 true, excludeRegex);
282
283 if (!securities.empty()) {
284 // always continue on error and always use lazy market building
285 QuantLib::ext::shared_ptr<Market> market =
286 QuantLib::ext::make_shared<TodaysMarket>(asof, todaysMarketParams, loader, curveConfigs, true, true, true,
287 params->refDataManager(), false, *params->iborFallbackConfig());
288 return BondSpreadImply::implyBondSpreads(securities, params->refDataManager(), market, params->pricingEngine(),
289 Market::defaultConfiguration, *params->iborFallbackConfig());
290 } else {
291 // no bonds that require a spread imply => return null ptr
292 return QuantLib::ext::shared_ptr<Loader>();
293 }
294}
static QuantLib::ext::shared_ptr< Loader > implyBondSpreads(const std::map< std::string, QuantLib::ext::shared_ptr< Security > > &securities, const QuantLib::ext::shared_ptr< ReferenceDataManager > &referenceDataManager, const QuantLib::ext::shared_ptr< Market > &market, const QuantLib::ext::shared_ptr< EngineData > &engineData, const std::string &configuration, const IborFallbackConfig &iborFallbackConfig)
static std::map< std::string, QuantLib::ext::shared_ptr< Security > > requiredSecurities(const Date &asof, const QuantLib::ext::shared_ptr< TodaysMarketParameters > &params, const QuantLib::ext::shared_ptr< CurveConfigurations > &curveConfigs, const Loader &loader, const bool continueOnError=false, const std::string &excludeRegex=std::string())
static const string defaultConfiguration
Date asof(14, Jun, 2018)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ implyBondSpreads() [2/2]

QuantLib::ext::shared_ptr< ore::data::Loader > implyBondSpreads ( const Date &  asof,
const QuantLib::ext::shared_ptr< InputParameters > &  params,
const QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > &  todaysMarketParams,
const QuantLib::ext::shared_ptr< ore::data::Loader > &  loader,
const QuantLib::ext::shared_ptr< ore::data::CurveConfigurations > &  curveConfigs,
const std::string &  excludeRegex 
)

◆ getScenarioDescriptions()

std::map< RiskFactorKey, std::string > getScenarioDescriptions ( QuantLib::ext::shared_ptr< ScenarioGenerator scenGen)

Definition at line 35 of file parconversionanalytic.cpp.

35 {
36 std::map<RiskFactorKey, std::string> descriptions;
37 auto sensiScenGen = QuantLib::ext::dynamic_pointer_cast<SensitivityScenarioGenerator>(scenGen);
38 if (sensiScenGen) {
39 for (const auto& desc : sensiScenGen->scenarioDescriptions()) {
40 descriptions[desc.key1()] = desc.indexDesc1();
41 }
42 }
43 return descriptions;
44}
+ Here is the caller graph for this function:

◆ checkReportNames()

std::map< std::string, Size > checkReportNames ( const ore::analytics::Analytic::analytic_reports rpts)

Definition at line 221 of file analyticsmanager.cpp.

221 {
222 std::map<std::string, Size> m;
223 for (const auto& rep : rpts) {
224 for (auto b : rep.second) {
225 string reportName = b.first;
226 auto it = m.find(reportName);
227 if (it == m.end())
228 m[reportName] = 1;
229 else
230 m[reportName] ++;
231 }
232 }
233 for (auto r : m) {
234 LOG("report name " << r.first << " occurs " << r.second << " times");
235 }
236 return m;
237}
#define LOG(text)
+ Here is the caller graph for this function:

◆ endsWith()

bool endsWith ( const std::string &  name,
const std::string &  suffix 
)

Definition at line 239 of file analyticsmanager.cpp.

239 {
240 if (suffix.size() > name.size())
241 return false;
242 else
243 return std::equal(suffix.rbegin(), suffix.rend(), name.rbegin());
244}
string name
+ Here is the caller graph for this function:

◆ parseAnalytics()

QuantLib::ext::shared_ptr< AnalyticsManager > parseAnalytics ( const std::string &  s,
const QuantLib::ext::shared_ptr< InputParameters > &  inputs,
const QuantLib::ext::shared_ptr< MarketDataLoader > &  marketDataLoader 
)

◆ initBuilders()

void initBuilders ( const bool  registerOREAnalytics)

Definition at line 48 of file initbuilders.cpp.

48 {
49
50 static boost::shared_mutex mutex;
51 boost::unique_lock<boost::shared_mutex> lock(mutex);
52
54
55 if (registerOREAnalytics) {
56 ORE_REGISTER_ANALYTIC_BUILDER("MARKETDATA", {}, MarketDataAnalytic, false)
57 ORE_REGISTER_ANALYTIC_BUILDER("HISTSIM_VAR", {}, HistoricalSimulationVarAnalytic, false);
58 ORE_REGISTER_ANALYTIC_BUILDER("IM_SCHEDULE", {}, IMScheduleAnalytic, false);
59 ORE_REGISTER_ANALYTIC_BUILDER("PARAMETRIC_VAR", {}, ParametricVarAnalytic, false);
60 ORE_REGISTER_ANALYTIC_BUILDER("PARCONVERSION", {}, ParConversionAnalytic, false);
61 ORE_REGISTER_ANALYTIC_BUILDER("PNL", {}, PnlAnalytic, false);
62 ORE_REGISTER_ANALYTIC_BUILDER("PNL_EXPLAIN", {}, PnlExplainAnalytic, false);
63 ORE_REGISTER_ANALYTIC_BUILDER("PRICING", pricingAnalyticSubAnalytics, PricingAnalytic, false);
64 ORE_REGISTER_ANALYTIC_BUILDER("SCENARIO", {}, ScenarioAnalytic, false);
65 ORE_REGISTER_ANALYTIC_BUILDER("SCENARIO_STATISTICS", {}, ScenarioStatisticsAnalytic, false);
66 ORE_REGISTER_ANALYTIC_BUILDER("SIMM", {}, SimmAnalytic, false);
67 ORE_REGISTER_ANALYTIC_BUILDER("XVA", xvaAnalyticSubAnalytics, XvaAnalytic, false);
68 ORE_REGISTER_ANALYTIC_BUILDER("STRESS", {}, StressTestAnalytic, false);
69 ORE_REGISTER_ANALYTIC_BUILDER("PARSTRESSCONVERSION", {}, ParStressConversionAnalytic, false);
70 ORE_REGISTER_ANALYTIC_BUILDER("ZEROTOPARSHIFT", {}, ZeroToParShiftAnalytic, false);
71 ORE_REGISTER_ANALYTIC_BUILDER("XVA_STRESS", {}, XvaStressAnalytic, false);
72 ORE_REGISTER_ANALYTIC_BUILDER("XVA_SENSITIVITY", {}, XvaSensitivityAnalytic, false);
73 }
74}
#define ORE_REGISTER_ANALYTIC_BUILDER(NAME, SUBANALYTICS, CLASS, OVERWRITE)
void dataBuilders()
+ Here is the call graph for this function:

◆ getFileNames()

std::vector< std::string > getFileNames ( const string &  fileString,
const std::filesystem::path &  path 
)

Definition at line 37 of file inputparameters.cpp.

37 {
38 vector<string> fileNames;
39 boost::split(fileNames, fileString, boost::is_any_of(",;"), boost::token_compress_on);
40 for (auto it = fileNames.begin(); it < fileNames.end(); it++) {
41 boost::trim(*it);
42 *it = (path / *it).generic_string();
43 }
44 return fileNames;
45}
+ Here is the caller graph for this function:

◆ additional_fx_fixings()

void additional_fx_fixings ( const string &  fixingId,
const RequiredFixings::FixingDates fixingDates,
FixingMap relevantFixings 
)

Definition at line 34 of file marketdataloader.cpp.

35 {
36 std::vector<std::string> tokens;
37 boost::split(tokens, fixingId, boost::is_any_of("-"));
38 QL_REQUIRE(tokens.size() == 4, "MarketDataLoader::additional_fx_fixings: Invalid fixing id, "
39 << "must be of form FX-TYPE-CCY1-CCY, e.g FX-ECB-EUR-GBP");
40
41 // add fixings on inverted ccy pair
42 relevantFixings[tokens[0] + "-" + tokens[1] + "-" + tokens[3] + "-" + tokens[2]].addDates(fixingDates, false);
43
44 vector<string> baseCcys = {"USD", "EUR"};
45
46 for (auto ccy : baseCcys) {
47
48 string fixingType = tokens[0] + "-" + tokens[1] + "-";
49 if (tokens[2] != ccy) {
50 string fix = fixingType + ccy + "-" + tokens[2];
51 relevantFixings[fix].addDates(fixingDates, false);
52
53 if (tokens[3] != ccy) {
54 fix = fixingType + tokens[2] + "-" + ccy;
55 relevantFixings[fix].addDates(fixingDates, false);
56 }
57 }
58
59 if (tokens[3] != ccy) {
60 string fix = fixingType + ccy + "-" + tokens[3];
61 relevantFixings[fix].addDates(fixingDates, false);
62
63 if (tokens[2] != ccy) {
64 fix = fixingType + tokens[3] + "-" + ccy;
65 relevantFixings[fix].addDates(fixingDates, false);
66 }
67 }
68 }
69}
+ Here is the caller graph for this function:

◆ additional_commodity_fixings()

void additional_commodity_fixings ( const string &  fixingId,
const RequiredFixings::FixingDates fixingDates,
FixingMap fixings,
map< pair< string, Date >, set< Date > > &  commodityMap 
)

Definition at line 72 of file marketdataloader.cpp.

73 {
74
75 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
76
77 auto ind = parseCommodityIndex(fixingId);
78 string commName = ind->underlyingName();
79
80 QuantLib::ext::shared_ptr<CommodityFutureConvention> cfc;
81 if (conventions->has(commName)) {
82 cfc = QuantLib::ext::dynamic_pointer_cast<CommodityFutureConvention>(conventions->get(commName));
83 }
84
85 if (cfc) {
86 // Add historical fixings for daily and monthly expiring contracts
87 // TODO: potentially need to add for OffPeakPowerIndex commodities too.
88 if (cfc->contractFrequency() == Daily) {
89 for (const auto& [fd, _]: fixingDates) {
90 // Add 1 week lookback for each date for daily expiry
91 set<Date> dates;
92 Date wLookback = fd - Period(1, Weeks);
93 do {
94 dates.insert(wLookback++);
95 } while (wLookback <= fd);
96
97 TLOG("Adding (date, id) = (" << io::iso_date(fd) << "," << fixingId << ")");
98 // Add to the fixings so a fixing is requested for all dates, and also to the commodityMap
99 // so we can map a fixing to the correct date required
100 fixings[fixingId].addDates(dates, false);
101 commodityMap[pair(fixingId, fd)].insert(dates.begin(), dates.end());
102 }
103 } else {
104 // for monthly expiries add fixings for the last 45 days
105 for (const auto& [fd,_] : fixingDates) {
106 set<Date> dates;
107 Date wLookback = fd - Period(45, Days);
108 do {
109 dates.insert(wLookback++);
110 } while (wLookback <= fd);
111
112 TLOG("Adding (date, id) = (" << io::iso_date(fd) << "," << fixingId << ")");
113 // Add to the fixings so a fixing is requested for all dates, and also to the commodityMap
114 // so we can map a fixing to the correct date required
115 fixings[fixingId].addDates(dates, false);
116 commodityMap[pair(fixingId, fd)].insert(dates.begin(), dates.end());
117 }
118 }
119 }
120}
#define TLOG(text)
QuantLib::ext::shared_ptr< QuantExt::CommodityIndex > parseCommodityIndex(const string &name, bool hasPrefix, const Handle< PriceTermStructure > &ts, const Calendar &cal, const bool enforceFutureIndex)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ additional_equity_fixings()

void additional_equity_fixings ( map< string, RequiredFixings::FixingDates > &  fixings,
const TodaysMarketParameters mktParams,
const QuantLib::ext::shared_ptr< ReferenceDataManager refData,
const QuantLib::ext::shared_ptr< CurveConfigurations > &  curveConfigs 
)

Definition at line 123 of file marketdataloader.cpp.

125 {
126 std::string configuration = Market::defaultConfiguration;
127 Date asof = Settings::instance().evaluationDate();
128 QuantLib::ext::shared_ptr<CurrencyHedgedEquityIndexReferenceDatum> currencyHedgedIndexData;
129 if (mktParams.hasMarketObject(MarketObject::EquityCurve)) {
130 for (const auto& [equityName, _] : mktParams.mapping(MarketObject::EquityCurve, configuration)) {
131 try {
132 auto indexDecomposition = loadCurrencyHedgedIndexDecomposition(equityName, refData, curveConfigs);
133 if (indexDecomposition) {
134 indexDecomposition->addAdditionalFixingsForEquityIndexDecomposition(asof, fixings);
135 }
136 } catch (const std::exception& e) {
137 ALOG("adding additional equity fixing failed, " << e.what());
138 }
139 }
140 }
141}
const map< string, string > & mapping(const MarketObject o, const string &configuration) const
bool hasMarketObject(const MarketObject &o) const
#define ALOG(text)
QuantLib::ext::shared_ptr< CurrencyHedgedEquityIndexDecomposition > loadCurrencyHedgedIndexDecomposition(const std::string &name, const QuantLib::ext::shared_ptr< ReferenceDataManager > &refDataMgr, const QuantLib::ext::shared_ptr< CurveConfigurations > &curveConfigs)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addNettingSetExposure()

void addNettingSetExposure ( ore::data::Report report,
QuantLib::ext::shared_ptr< PostProcess postProcess,
const string &  nettingSetId 
)

Definition at line 869 of file reportwriter.cpp.

870 {
871 const vector<Date> dates = postProcess->cube()->dates();
872 Date today = Settings::instance().evaluationDate();
873 DayCounter dc = ActualActual(ActualActual::ISDA);
874 const vector<Real>& epe = postProcess->netEPE(nettingSetId);
875 const vector<Real>& ene = postProcess->netENE(nettingSetId);
876 const vector<Real>& ee_b = postProcess->netEE_B(nettingSetId);
877 const vector<Real>& eee_b = postProcess->netEEE_B(nettingSetId);
878 const vector<Real>& pfe = postProcess->netPFE(nettingSetId);
879 const vector<Real>& ecb = postProcess->expectedCollateral(nettingSetId);
880
881 report.next()
882 .add(nettingSetId)
883 .add(today)
884 .add(0.0)
885 .add(epe[0])
886 .add(ene[0])
887 .add(pfe[0])
888 .add(ecb[0])
889 .add(ee_b[0])
890 .add(eee_b[0]);
891 for (Size j = 0; j < dates.size(); ++j) {
892 Real time = dc.yearFraction(today, dates[j]);
893 report.next()
894 .add(nettingSetId)
895 .add(dates[j])
896 .add(time)
897 .add(epe[j + 1])
898 .add(ene[j + 1])
899 .add(pfe[j + 1])
900 .add(ecb[j + 1])
901 .add(ee_b[j + 1])
902 .add(eee_b[j + 1]);
903 }
904}
virtual Report & add(const ReportType &rt)=0
virtual Report & next()=0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addMapResults()

void addMapResults ( boost::any  resultMap,
const std::string &  tradeId,
const std::string &  resultName,
Report report 
)

Definition at line 1253 of file reportwriter.cpp.

1253 {
1254 T map = boost::any_cast<T>(resultMap);
1255 for (auto it : map) {
1256 std::string name = resultName + "_" + it.first.code();
1257 boost::any tmp = it.second;
1258 auto p = parseBoostAny(tmp);
1259 report.next().add(tradeId).add(name).add(p.first).add(p.second);
1260 }
1261}
pair< string, string > parseBoostAny(const boost::any &anyType, Size precision)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ aggregateTradeFlow()

Real aggregateTradeFlow ( const std::string &  tradeId,
const Date &  d0,
const Date &  d1,
const ext::shared_ptr< InMemoryReport > &  cashFlowReport,
const ext::shared_ptr< ore::data::Market > &  market,
const std::string &  baseCurrency 
)

Definition at line 2400 of file reportwriter.cpp.

2403 {
2404 Size tradeIdColumn = 0;
2405 Size dateColumn = 4;
2406 Size amountColumn = 6;
2407 Size ccyColumn = 7;
2408 QL_REQUIRE(cashFlowReport->header(tradeIdColumn) == "TradeId", "incorrect trade id column " << tradeIdColumn);
2409 QL_REQUIRE(cashFlowReport->header(amountColumn) == "Amount", "incorrect trade id column " << amountColumn);
2410 QL_REQUIRE(cashFlowReport->header(ccyColumn) == "Currency", "incorrect trade id column " << ccyColumn);
2411 QL_REQUIRE(cashFlowReport->header(dateColumn) == "PayDate", "incorrect trade id column " << dateColumn);
2412
2413 Real flow = 0.0;
2414 for (Size i = 0; i < cashFlowReport->rows(); ++i) {
2415 string id = boost::get<string>(cashFlowReport->data(tradeIdColumn).at(i));
2416 if (id != tradeId)
2417 continue;
2418 Date date = boost::get<Date>(cashFlowReport->data(dateColumn).at(i));
2419 if (date <= d0 || date > d1)
2420 continue;
2421 string ccy = boost::get<string>(cashFlowReport->data(ccyColumn).at(i));
2422 Real amount = boost::get<Real>(cashFlowReport->data(amountColumn).at(i));
2423 Real fx = 1.0;
2424 if (ccy != baseCurrency)
2425 fx = market->fxRate(ccy + baseCurrency)->value();
2426 flow += fx * amount;
2427 }
2428
2429 return flow;
2430}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadCube()

NPVCubeWithMetaData loadCube ( const std::string &  filename,
const bool  doublePrecision 
)

Definition at line 63 of file cube_io.cpp.

63 {
64
66
67 // open file
68
69 bool gzip = use_compression(filename);
70 std::ifstream in1(filename, gzip ? (std::ios::binary | std::ios::in) : std::ios::in);
71 boost::iostreams::filtering_stream<boost::iostreams::input> in;
72#ifdef ORE_USE_ZLIB
73 if (gzip)
74 in.push(boost::iostreams::gzip_decompressor());
75#endif
76 in.push(in1);
77
78 // read meta data
79
80 std::string line;
81
82 std::getline(in, line);
83 QuantLib::Date asof = ore::data::parseDate(getMetaData(line, "asof"));
84 std::getline(in, line);
85 Size numIds = ore::data::parseInteger(getMetaData(line, "numIds"));
86 std::getline(in, line);
87 Size numDates = ore::data::parseInteger(getMetaData(line, "numDates"));
88 std::getline(in, line);
89 Size samples = ore::data::parseInteger(getMetaData(line, "samples"));
90 std::getline(in, line);
91 Size depth = ore::data::parseInteger(getMetaData(line, "depth"));
92
93 std::getline(in, line);
94 getMetaData(line, "dates");
95 std::vector<QuantLib::Date> dates;
96 for (Size i = 0; i < numDates; ++i) {
97 std::getline(in, line);
98 dates.push_back(ore::data::parseDate(line.substr(2)));
99 }
100
101 std::getline(in, line);
102 getMetaData(line, "ids");
103 std::set<std::string> ids;
104 for (Size i = 0; i < numIds; ++i) {
105 std::getline(in, line);
106 ids.insert(line.substr(2));
107 }
108
109 std::getline(in, line);
110 if (std::string md = getMetaData(line, "scenGenDta", false); !md.empty()) {
111 result.scenarioGeneratorData = QuantLib::ext::make_shared<ScenarioGeneratorData>();
112 result.scenarioGeneratorData->fromXMLString(md);
113 std::getline(in, line);
114 DLOG("overwrite scenario generator data with meta data from cube: " << md);
115 }
116
117 if (std::string md = getMetaData(line, "storeFlows", false); !md.empty()) {
118 result.storeFlows = parseBool(md);
119 std::getline(in, line);
120 DLOG("overwrite storeFlows with meta data from cube: " << md);
121 }
122
123 if (std::string md = getMetaData(line, "storeCrSt", false); !md.empty()) {
125 std::getline(in, line);
126 DLOG("overwrite storeCreditStateNPVs with meta data from cube: " << md);
127 }
128
129 QuantLib::ext::shared_ptr<NPVCube> cube;
130 if (doublePrecision && depth <= 1) {
131 cube = QuantLib::ext::make_shared<DoublePrecisionInMemoryCube>(asof, ids, dates, samples, 0.0);
132 } else if (doublePrecision && depth > 1) {
133 cube = QuantLib::ext::make_shared<DoublePrecisionInMemoryCubeN>(asof, ids, dates, samples, depth, 0.0);
134 } else if (!doublePrecision && depth <= 1) {
135 cube = QuantLib::ext::make_shared<SinglePrecisionInMemoryCube>(asof, ids, dates, samples, 0.0f);
136 } else if (!doublePrecision && depth > 1) {
137 cube = QuantLib::ext::make_shared<SinglePrecisionInMemoryCubeN>(asof, ids, dates, samples, depth, 0.0f);
138 }
139 result.cube = cube;
140
141 vector<string> tokens;
142 Size nData = 0;
143 while (!in.eof()) {
144 std::getline(in, line);
145 if (line.empty())
146 continue;
147 boost::split(tokens, line, [](char c) { return c == ','; });
148 QL_REQUIRE(tokens.size() == 5, "loadCube(): invalid data line '" << line << "', expected 5 tokens");
149 Size id = ore::data::parseInteger(tokens[0]);
150 Size date = ore::data::parseInteger(tokens[1]);
151 Size sample = ore::data::parseInteger(tokens[2]);
152 Size depth = ore::data::parseInteger(tokens[3]);
153 double value = ore::data::parseReal(tokens[4]);
154 if (date == 0)
155 cube->setT0(value, id, depth);
156 else
157 cube->set(value, id, date - 1, sample, depth);
158 ++nData;
159 }
160
161 LOG("loaded cube from " << filename << ": asof = " << asof << ", dim = " << numIds << " x " << numDates << " x "
162 << samples << " x " << depth << ", " << nData << " data lines read.");
163
164 return result;
165}
SafeStack< ValueType > value
Date parseDate(const string &s)
bool parseBool(const string &s)
Real parseReal(const string &s)
Integer parseInteger(const string &s)
#define DLOG(text)
QuantLib::ext::shared_ptr< NPVCube > cube
Definition: cube_io.hpp:39
QuantLib::ext::shared_ptr< ScenarioGeneratorData > scenarioGeneratorData
Definition: cube_io.hpp:41
boost::optional< Size > storeCreditStateNPVs
Definition: cube_io.hpp:43
boost::optional< bool > storeFlows
Definition: cube_io.hpp:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveCube()

void saveCube ( const std::string &  filename,
const NPVCubeWithMetaData cube,
const bool  doublePrecision 
)

Definition at line 167 of file cube_io.cpp.

167 {
168
169 // open file
170
171 bool gzip = use_compression(filename);
172 std::ofstream out1(filename, gzip ? (std::ios::binary | std::ios::out) : std::ios::out);
173 boost::iostreams::filtering_stream<boost::iostreams::output> out;
174#ifdef ORE_USE_ZLIB
175 if (gzip)
176 out.push(boost::iostreams::gzip_compressor(/*boost::iostreams::gzip_params(9)*/));
177#endif
178 out.push(out1);
179
180 // write meta data (tag width is hardcoded and used in getMetaData())
181
182 out << "# asof : " << ore::data::to_string(cube.cube->asof()) << "\n";
183 out << "# numIds : " << std::to_string(cube.cube->numIds()) << "\n";
184 out << "# numDates : " << std::to_string(cube.cube->numDates()) << "\n";
185 out << "# samples : " << ore::data::to_string(cube.cube->samples()) << "\n";
186 out << "# depth : " << ore::data::to_string(cube.cube->depth()) << "\n";
187 out << "# dates : \n";
188 for (auto const& d : cube.cube->dates())
189 out << "# " << ore::data::to_string(d) << "\n";
190
191 out << "# ids : \n";
192 std::map<Size, std::string> ids;
193 for (auto const& d : cube.cube->idsAndIndexes()) {
194 ids[d.second] = d.first;
195 }
196 for (auto const& d : ids) {
197 out << "# " << d.second << "\n";
198 }
199
200 if (cube.scenarioGeneratorData) {
201 std::string scenGenDataXml =
202 std::regex_replace(cube.scenarioGeneratorData->toXMLString(), std::regex("\\r\\n|\\r|\\n|\\t"), "");
203 out << "# scenGenDta : " << scenGenDataXml << "\n";
204 }
205 if (cube.storeFlows) {
206 out << "# storeFlows : " << std::boolalpha << *cube.storeFlows << "\n";
207 }
208 if (cube.storeCreditStateNPVs) {
209 out << "# storeCrSt : " << *cube.storeCreditStateNPVs << "\n";
210 }
211
212 // set precision
213
214 out << std::setprecision(doublePrecision ? std::numeric_limits<double>::max_digits10
215 : std::numeric_limits<float>::max_digits10);
216
217 // write cube data
218
219 out << "#id,date,sample,depth,value\n";
220 for (Size i = 0; i < cube.cube->numIds(); ++i) {
221 out << i << ",0,0,0," << cube.cube->getT0(i) << "\n";
222 for (Size j = 0; j < cube.cube->numDates(); ++j) {
223 for (Size k = 0; k < cube.cube->samples(); ++k) {
224 for (Size d = 0; d < cube.cube->depth(); ++d) {
225 double value = cube.cube->get(i, j, k, d);
226 if (value != 0.0)
227 out << i << "," << (j + 1) << "," << k << "," << d << "," << value << "\n";
228 }
229 }
230 }
231 }
232}
std::string to_string(const LocationInfo &l)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadAggregationScenarioData()

QuantLib::ext::shared_ptr< AggregationScenarioData > loadAggregationScenarioData ( const std::string &  filename)

Definition at line 234 of file cube_io.cpp.

234 {
235
236 // open file
237
238 bool gzip = use_compression(filename);
239 std::ifstream in1(filename, gzip ? (std::ios::binary | std::ios::in) : std::ios::in);
240 boost::iostreams::filtering_stream<boost::iostreams::input> in;
241#ifdef ORE_USE_ZLIB
242 if (gzip)
243 in.push(boost::iostreams::gzip_decompressor());
244#endif
245 in.push(in1);
246
247 // read meta data
248
249 std::string line;
250
251 std::getline(in, line);
252 Size dimDates = ore::data::parseInteger(getMetaData(line, "dimDates"));
253 std::getline(in, line);
254 Size dimSamples = ore::data::parseInteger(getMetaData(line, "dimSamples"));
255
256 vector<string> tokens;
257
258 std::getline(in, line);
259 Size numKeys = ore::data::parseInteger(getMetaData(line, "keys"));
260 std::vector<std::pair<AggregationScenarioDataType, std::string>> keys;
261 for (Size i = 0; i < numKeys; ++i) {
262 std::getline(in, line);
263 boost::split(tokens, line.substr(2), [](char c) { return c == ','; });
264 QL_REQUIRE(tokens.size() == 2,
265 "loadAggregationScenarioData(): invalid data line '" << line << "', expected 2 tokens");
266 keys.push_back(std::make_pair(AggregationScenarioDataType(ore::data::parseInteger(tokens[0])), tokens[1]));
267 }
268
269 std::getline(in, line); // header line for data
270
271 QuantLib::ext::shared_ptr<InMemoryAggregationScenarioData> result =
272 QuantLib::ext::make_shared<InMemoryAggregationScenarioData>(dimDates, dimSamples);
273
274 std::getline(in, line); // header line for data
275
276 Size nData = 0;
277 while (!in.eof()) {
278 std::getline(in, line);
279 if (line.empty())
280 continue;
281 boost::split(tokens, line, [](char c) { return c == ','; });
282 QL_REQUIRE(tokens.size() == 4,
283 "loadAggregationScenarioData(): invalid data line '" << line << "', expected 4 tokens");
284 Size date = ore::data::parseInteger(tokens[0]);
285 Size sample = ore::data::parseInteger(tokens[1]);
286 Size key = ore::data::parseInteger(tokens[2]);
287 double value = ore::data::parseReal(tokens[3]);
288 QL_REQUIRE(key < keys.size(), "loadAggregationScenarioData(): invalid data line '" << line << "', key (" << key
289 << ") is out of range 0..."
290 << (keys.size() - 1));
291 result->set(date - 1, sample, value, keys[key].first, keys[key].second);
292 ++nData;
293 }
294
295 LOG("loaded aggregation scenario data from " << filename << ": dimDates = " << dimDates
296 << ", dimSamples = " << dimSamples << ", keys = " << keys.size()
297 << ", " << nData << " data lines read.");
298
299 return result;
300}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAggregationScenarioData()

void saveAggregationScenarioData ( const std::string &  filename,
const AggregationScenarioData cube 
)

Definition at line 302 of file cube_io.cpp.

302 {
303
304 // open file
305
306 bool gzip = use_compression(filename);
307 std::ofstream out1(filename, gzip ? (std::ios::binary | std::ios::out) : std::ios::out);
308 boost::iostreams::filtering_stream<boost::iostreams::output> out;
309#ifdef ORE_USE_ZLIB
310 if (gzip)
311 out.push(boost::iostreams::gzip_compressor(/*boost::iostreams::gzip_params(9)*/));
312#endif
313 out.push(out1);
314
315 // write meta data (tag width is hardcoded and used in getMetaData())
316
317 out << "# dimDates : " << std::to_string(cube.dimDates()) << "\n";
318 out << "# dimSamples : " << std::to_string(cube.dimSamples()) << "\n";
319
320 auto keys = cube.keys();
321
322 out << "# keys : " << std::to_string(keys.size()) << "\n";
323 for (auto const& k : keys) {
324 out << "# " << (unsigned int)k.first << "," << k.second << "\n";
325 }
326
327 // set precision
328
329 out << std::setprecision(std::numeric_limits<double>::max_digits10);
330
331 // write data
332
333 out << "#date,sample,key,value\n";
334 for (Size i = 0; i < cube.dimDates(); ++i) {
335 for (Size j = 0; j < cube.dimSamples(); ++j) {
336 for (Size k = 0; k < keys.size(); ++k) {
337 out << (i + 1) << "," << j << "," << k << "," << cube.get(i, j, keys[k].first, keys[k].second) << "\n";
338 }
339 }
340 }
341}
virtual Real get(Size dateIndex, Size sampleIndex, const AggregationScenarioDataType &type, const string &qualifier="") const =0
Get a value from the cube.
virtual Size dimDates() const =0
Return the length of each dimension.
virtual Size dimSamples() const =0
virtual std::vector< std::pair< AggregationScenarioDataType, std::string > > keys() const =0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [3/29]

std::ostream & operator<< ( std::ostream &  out,
const SensitivityCube::crossPair cp 
)

Definition at line 55 of file sensitivitycube.cpp.

55 {
56 return out << cp.first << "-" << cp.second;
57}

◆ operator<<() [4/29]

std::ostream & operator<< ( std::ostream &  out,
const ext::shared_ptr< MarketRiskGroupBase > &  riskGroup 
)

Definition at line 38 of file marketriskreport.cpp.

38 {
39 return out << riskGroup->to_string();
40}

◆ operator<<() [5/29]

std::ostream & operator<< ( std::ostream &  out,
const ext::shared_ptr< TradeGroupBase > &  tradeGroup 
)

Definition at line 42 of file marketriskreport.cpp.

42 {
43 return out << tradeGroup->to_string();
44}

◆ operator<<() [6/29]

std::ostream & operator<< ( std::ostream &  out,
const QuantLib::ext::shared_ptr< MarketRiskGroupBase > &  riskGroup 
)

◆ operator<<() [7/29]

std::ostream & operator<< ( std::ostream &  out,
const QuantLib::ext::shared_ptr< TradeGroupBase > &  tradeGroup 
)

◆ operator<<() [8/29]

std::ostream & operator<< ( ostream &  out,
const NpvRecord nr 
)

Enable writing of a NpvRecord.

Definition at line 28 of file npvrecord.cpp.

28 {
29 return out << "[" <<
30 nr.tradeId << ", " <<
31 nr.portfolioId << ", " <<
32 nr.valuationDate << ", " <<
33 nr.baseCurrency << ", " <<
34 nr.baseAmount <<
35 "]";
36}
QuantLib::Date valuationDate
Definition: npvrecord.hpp:46
QuantLib::Real baseAmount
Definition: npvrecord.hpp:45

◆ parseParametricVarMethod()

ParametricVarCalculator::ParametricVarParams::Method parseParametricVarMethod ( const string &  s)

Definition at line 45 of file parametricvar.cpp.

45 {
46 static map<string, ParametricVarCalculator::ParametricVarParams::Method> m = {
47 {"Delta", ParametricVarCalculator::ParametricVarParams::Method::Delta},
48 {"DeltaGammaNormal", ParametricVarCalculator::ParametricVarParams::Method::DeltaGammaNormal},
49 {"MonteCarlo", ParametricVarCalculator::ParametricVarParams::Method::MonteCarlo},
50 {"Cornish-Fisher", ParametricVarCalculator::ParametricVarParams::Method::CornishFisher},
51 {"Saddlepoint", ParametricVarCalculator::ParametricVarParams::Method::Saddlepoint}
52 };
53
54 auto it = m.find(s);
55 if (it != m.end())
56 return it->second;
57 else
58 QL_FAIL("ParametricVarParams Method \"" << s << "\" not recognized");
59}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [9/29]

std::ostream & operator<< ( ostream &  out,
const ParametricVarCalculator::ParametricVarParams::Method method 
)

Definition at line 61 of file parametricvar.cpp.

61 {
62 switch (method) {
63 case ParametricVarCalculator::ParametricVarParams::Method::Delta:
64 return out << "Delta";
65 case ParametricVarCalculator::ParametricVarParams::Method::DeltaGammaNormal:
66 return out << "DeltaGammaNormal";
67 case ParametricVarCalculator::ParametricVarParams::Method::MonteCarlo:
68 return out << "MonteCarlo";
69 case ParametricVarCalculator::ParametricVarParams::Method::CornishFisher:
70 return out << "Cornish-Fisher";
71 case ParametricVarCalculator::ParametricVarParams::Method::Saddlepoint:
72 return out << "Saddlepoint";
73 default:
74 QL_FAIL("Invalid ParametricVarCalculator::ParametricVarParams::Method");
75 }
76}
+ Here is the call graph for this function:

◆ writeParConversionMatrix()

void writeParConversionMatrix ( const ParSensitivityAnalysis::ParContainer parSensitivities,
Report report 
)

Write par instrument sensitivity report.

Definition at line 835 of file parsensitivityanalysis.cpp.

835 {
836
837 // Report headers
838 report.addColumn("ParFactor", string());
839 report.addColumn("RawFactor", string());
840 report.addColumn("ParSensitivity", double(), 12);
841
842 // Report body
843 for (const auto& parSensitivity : parSensitivities) {
844 RiskFactorKey parKey = parSensitivity.first.first;
845 RiskFactorKey rawKey = parSensitivity.first.second;
846 Real sensi = parSensitivity.second;
847
848 report.next();
849 report.add(to_string(parKey));
850 report.add(to_string(rawKey));
851 report.add(sensi);
852 }
853
854 report.end();
855}
Data types stored in the scenario class.
Definition: scenario.hpp:48
virtual void end()=0
virtual Report & addColumn(const string &name, const ReportType &, Size precision=0)=0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ impliedQuote() [1/2]

Real impliedQuote ( const QuantLib::ext::shared_ptr< Instrument > &  i)

Definition at line 240 of file parsensitivityutilities.cpp.

240 {
241 if (QuantLib::ext::dynamic_pointer_cast<VanillaSwap>(i))
242 return QuantLib::ext::dynamic_pointer_cast<VanillaSwap>(i)->fairRate();
243 if (QuantLib::ext::dynamic_pointer_cast<Deposit>(i))
244 return QuantLib::ext::dynamic_pointer_cast<Deposit>(i)->fairRate();
245 if (QuantLib::ext::dynamic_pointer_cast<QuantLib::ForwardRateAgreement>(i))
246 return QuantLib::ext::dynamic_pointer_cast<QuantLib::ForwardRateAgreement>(i)->forwardRate();
247 if (QuantLib::ext::dynamic_pointer_cast<OvernightIndexedSwap>(i))
248 return QuantLib::ext::dynamic_pointer_cast<OvernightIndexedSwap>(i)->fairRate();
249 if (QuantLib::ext::dynamic_pointer_cast<CrossCcyBasisMtMResetSwap>(i))
250 return QuantLib::ext::dynamic_pointer_cast<CrossCcyBasisMtMResetSwap>(i)->fairSpread();
251 if (QuantLib::ext::dynamic_pointer_cast<CrossCcyBasisSwap>(i))
252 return QuantLib::ext::dynamic_pointer_cast<CrossCcyBasisSwap>(i)->fairPaySpread();
253 if (QuantLib::ext::dynamic_pointer_cast<FxForward>(i))
254 return QuantLib::ext::dynamic_pointer_cast<FxForward>(i)->fairForwardRate().rate();
255 if (QuantLib::ext::dynamic_pointer_cast<QuantExt::CreditDefaultSwap>(i))
256 return QuantLib::ext::dynamic_pointer_cast<QuantExt::CreditDefaultSwap>(i)->fairSpreadClean();
257 if (QuantLib::ext::dynamic_pointer_cast<ZeroCouponInflationSwap>(i))
258 return QuantLib::ext::dynamic_pointer_cast<ZeroCouponInflationSwap>(i)->fairRate();
259 if (QuantLib::ext::dynamic_pointer_cast<YearOnYearInflationSwap>(i))
260 return QuantLib::ext::dynamic_pointer_cast<YearOnYearInflationSwap>(i)->fairRate();
261 if (QuantLib::ext::dynamic_pointer_cast<TenorBasisSwap>(i)) {
262 if (QuantLib::ext::dynamic_pointer_cast<TenorBasisSwap>(i)->spreadOnRec())
263 return QuantLib::ext::dynamic_pointer_cast<TenorBasisSwap>(i)->fairRecLegSpread();
264 else
265 return QuantLib::ext::dynamic_pointer_cast<TenorBasisSwap>(i)->fairPayLegSpread();
266 }
267 if (QuantLib::ext::dynamic_pointer_cast<FixedBMASwap>(i))
268 return QuantLib::ext::dynamic_pointer_cast<FixedBMASwap>(i)->fairRate();
269 if (QuantLib::ext::dynamic_pointer_cast<SubPeriodsSwap>(i))
270 return QuantLib::ext::dynamic_pointer_cast<SubPeriodsSwap>(i)->fairRate();
271 QL_FAIL("SensitivityAnalysis: impliedQuote: unknown instrument (is null = " << std::boolalpha << (i == nullptr)
272 << ")");
273}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ impliedVolatility() [1/5]

Volatility impliedVolatility ( const QuantLib::CapFloor &  cap,
Real  targetValue,
const Handle< YieldTermStructure > &  d,
Volatility  guess,
VolatilityType  type,
Real  displacement 
)

Definition at line 275 of file parsensitivityutilities.cpp.

276 {
277 return impliedVolatilityWrapper(cap, targetValue, d, guess, type, displacement, Handle<Index>());
278}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ impliedVolatility() [2/5]

Volatility impliedVolatility ( const QuantLib::YoYInflationCapFloor &  cap,
Real  targetValue,
const Handle< YieldTermStructure > &  d,
Volatility  guess,
VolatilityType  type,
Real  displacement,
const Handle< YoYInflationIndex > &  index 
)

Definition at line 280 of file parsensitivityutilities.cpp.

282 {
283 return impliedVolatilityWrapper(cap, targetValue, d, guess, type, displacement, index);
284}
+ Here is the call graph for this function:

◆ riskFactorKeysAreSimilar()

bool riskFactorKeysAreSimilar ( const ore::analytics::RiskFactorKey x,
const ore::analytics::RiskFactorKey y 
)

true if key type and name are equal, do not care about the index though

Definition at line 286 of file parsensitivityutilities.cpp.

286 {
287 return x.keytype == y.keytype && x.name == y.name;
288}
KeyType keytype
Key type.
Definition: scenario.hpp:89
std::string name
Key name.
Definition: scenario.hpp:94
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ impliedVolatility() [3/5]

double impliedVolatility ( const RiskFactorKey key,
const ParSensitivityInstrumentBuilder::Instruments instruments 
)

Definition at line 290 of file parsensitivityutilities.cpp.

290 {
291 if (key.keytype == RiskFactorKey::KeyType::OptionletVolatility) {
292 QL_REQUIRE(instruments.parCaps_.count(key) == 1, "Can not convert capFloor par shifts to zero Vols");
293 QL_REQUIRE(instruments.parCapsYts_.count(key) > 0,
294 "getTodaysAndTargetQuotes: no cap yts found for key " << key);
295 QL_REQUIRE(instruments.parCapsVts_.count(key) > 0,
296 "getTodaysAndTargetQuotes: no cap vts found for key " << key);
297 const auto cap = instruments.parCaps_.at(key);
298 Real price = cap->NPV();
299 Volatility parVol = impliedVolatility(*cap, price, instruments.parCapsYts_.at(key), 0.01,
300 instruments.parCapsVts_.at(key)->volatilityType(),
301 instruments.parCapsVts_.at(key)->displacement());
302 return parVol;
303 } else if (key.keytype == RiskFactorKey::KeyType::YoYInflationCapFloorVolatility) {
304 QL_REQUIRE(instruments.parYoYCaps_.count(key) == 1, "Can not convert capFloor par shifts to zero Vols");
305 QL_REQUIRE(instruments.parYoYCapsYts_.count(key) > 0,
306 "getTodaysAndTargetQuotes: no cap yts found for key " << key);
307 QL_REQUIRE(instruments.parYoYCapsVts_.count(key) > 0,
308 "getTodaysAndTargetQuotes: no cap vts found for key " << key);
309 QL_REQUIRE(instruments.parYoYCapsIndex_.count(key) > 0,
310 "getTodaysAndTargetQuotes: no cap index found for key " << key);
311 const auto& cap = instruments.parYoYCaps_.at(key);
312 Real price = cap->NPV();
313 Volatility parVol = impliedVolatility(
314 *cap, price, instruments.parYoYCapsYts_.at(key), 0.01, instruments.parYoYCapsVts_.at(key)->volatilityType(),
315 instruments.parYoYCapsVts_.at(key)->displacement(), instruments.parYoYCapsIndex_.at(key));
316 return parVol;
317 } else {
318 QL_FAIL("impliedCapVolatility: Unsupported risk factor key "
319 << key.keytype << ". Support OptionletVolatility and YoYInflationCapFloorVolatility");
320 }
321}
Volatility impliedVolatility(const QuantLib::CapFloor &cap, Real targetValue, const Handle< YieldTermStructure > &d, Volatility guess, VolatilityType type, Real displacement)
std::map< ore::analytics::RiskFactorKey, QuantLib::Handle< QuantExt::YoYOptionletVolatilitySurface > > parYoYCapsVts_
std::map< ore::analytics::RiskFactorKey, QuantLib::Handle< QuantLib::YieldTermStructure > > parYoYCapsYts_
par helpers: YoY cap / floors
std::map< ore::analytics::RiskFactorKey, QuantLib::Handle< QuantLib::YieldTermStructure > > parCapsYts_
std::map< ore::analytics::RiskFactorKey, QuantLib::ext::shared_ptr< QuantLib::CapFloor > > parCaps_
par helpers: IR cap / floors
std::map< ore::analytics::RiskFactorKey, QuantLib::Handle< QuantLib::OptionletVolatilityStructure > > parCapsVts_
std::map< ore::analytics::RiskFactorKey, QuantLib::ext::shared_ptr< QuantLib::YoYInflationCapFloor > > parYoYCaps_
std::map< ore::analytics::RiskFactorKey, QuantLib::Handle< QuantLib::YoYInflationIndex > > parYoYCapsIndex_
+ Here is the call graph for this function:

◆ impliedQuote() [2/2]

Real impliedQuote ( const QuantLib::ext::shared_ptr< QuantLib::Instrument > &  i)

Computes the implied quote.

◆ impliedVolatility() [4/5]

double impliedVolatility ( const QuantLib::CapFloor &  cap,
double  targetValue,
const QuantLib::Handle< QuantLib::YieldTermStructure > &  d,
double  guess,
QuantLib::VolatilityType  type,
double  displacement 
)

◆ impliedVolatility() [5/5]

double impliedVolatility ( const QuantLib::YoYInflationCapFloor &  cap,
double  targetValue,
const QuantLib::Handle< QuantLib::YieldTermStructure > &  d,
double  guess,
QuantLib::VolatilityType  type,
double  displacement,
const QuantLib::Handle< QuantLib::YoYInflationIndex > &  index = {} 
)

◆ disabledParRates()

std::set< RiskFactorKey::KeyType > disabledParRates ( bool  irCurveParRates,
bool  irCapFloorParRates,
bool  creditParRates 
)

Definition at line 139 of file parstressscenarioconverter.cpp.

139 {
140 set<RiskFactorKey::KeyType> disabledParRates;
141 if (!irCurveParRates) {
142 disabledParRates.insert(RiskFactorKey::KeyType::DiscountCurve);
143 disabledParRates.insert(RiskFactorKey::KeyType::YieldCurve);
144 disabledParRates.insert(RiskFactorKey::KeyType::IndexCurve);
145 }
146 if (!irCapFloorParRates) {
147 disabledParRates.insert(RiskFactorKey::KeyType::OptionletVolatility);
148 }
149 if (!creditParRates) {
150 disabledParRates.insert(RiskFactorKey::KeyType::SurvivalProbability);
151 }
152 return disabledParRates;
153}
std::set< RiskFactorKey::KeyType > disabledParRates(bool irCurveParRates, bool irCapFloorParRates, bool creditParRates)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCurveShiftData()

bool checkCurveShiftData ( const std::string &  name,
const StressTestScenarioData::CurveShiftData stressShiftData,
const std::map< std::string, QuantLib::ext::shared_ptr< SensitivityScenarioData::CurveShiftData > > &  sensiData 
)

Checks the the tenors for curves in a stresstest scenario are alligned with par sensitivity config.

Definition at line 156 of file parstressscenarioconverter.cpp.

157 {
158 auto it = sensiData.find(name);
159 if (it == sensiData.end()) {
161 "StressScenario", name, "Par Shift to zero conversion",
162 "no par sensitivity scenario found. Please add par sensi config").log();
163 return false;
164 }
165 auto parShiftData = ext::dynamic_pointer_cast<SensitivityScenarioData::CurveShiftParData>(it->second);
166 if (parShiftData == nullptr) {
167 StructuredConfigurationWarningMessage("StressScenario", name, "Par Shift to zero conversion",
168 "no par sensitivity scenario found. Please add par sensi config")
169 .log();
170 return false;
171 }
172 const size_t nParShifts = parShiftData->shiftTenors.size();
173 const size_t nStressShifts = stressShiftData.shiftTenors.size();
174 if (nParShifts != nStressShifts) {
175 StructuredConfigurationWarningMessage(
176 "StressScenario", name, "Par Shift to zero conversion",
177 "mismatch between tenors, we have " + to_string(nParShifts) + " parInstruments defined but " +
178 to_string(nStressShifts) +
179 " shifts in the scenario. Please align pillars of stress test and par sensi config")
180 .log();
181 return false;
182 }
183 for (size_t i = 0; i < nParShifts; ++i){
184 if (parShiftData->shiftTenors[i] != stressShiftData.shiftTenors[i]){
185 StructuredConfigurationWarningMessage("StressScenario", name, "Par Shift to zero conversion",
186 "tenors are not aligned, " + to_string(i) + " par Pillar is " +
187 to_string(parShiftData->shiftTenors[i]) +
188 " vs stress shift piller " +
189 to_string(stressShiftData.shiftTenors[i]) +
190 ". Please align pillars of stress test and par sensi config")
191 .log();
192 return false;
193 }
194 }
195 return true;
196}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCapFloorShiftData()

bool checkCapFloorShiftData ( const std::string &  name,
const StressTestScenarioData::CapFloorVolShiftData stressShiftData,
const std::map< std::string, QuantLib::ext::shared_ptr< SensitivityScenarioData::CapFloorVolShiftData > > &  sensiData 
)

Checks the the strikes and expiries of cap floors in stresstest scenario are alligned with par sensitivity config.

Definition at line 200 of file parstressscenarioconverter.cpp.

201 {
202
203 auto it = sensiData.find(name);
204 if (it == sensiData.end()) {
206 "StressScenario", name, "Par Shift to zero conversion",
207 "no par cap floor sensitivity scenario found. Please add par sensi config")
208 .log();
209 return false;
210 }
211 auto parShiftData = ext::dynamic_pointer_cast<SensitivityScenarioData::CapFloorVolShiftParData>(it->second);
212 if (parShiftData == nullptr) {
214 "StressScenario", name, "Par Shift to zero conversion",
215 "no par cap floor sensitivity scenario found. Please add par sensi config")
216 .log();
217 return false;
218 }
219 const size_t nParShifts = parShiftData->shiftExpiries.size();
220 const size_t nStressShifts = stressShiftData.shiftExpiries.size();
221 if (nParShifts != nStressShifts) {
222 StructuredConfigurationWarningMessage(
223 "StressScenario", name, "Par Shift to zero conversion",
224 "mismatch between capFloor expiries, we have " + to_string(nParShifts) + " parInstruments defined but " +
225 to_string(nStressShifts) +
226 " shifts in the scenario. Please align pillars of stress test and par sensi config")
227 .log();
228 return false;
229 }
230 for (size_t i = 0; i < nParShifts; ++i) {
231 if (parShiftData->shiftExpiries[i] != stressShiftData.shiftExpiries[i]) {
232 StructuredConfigurationWarningMessage(
233 "StressScenario", name, "Par Shift to zero conversion",
234 "CapFloor expiries are not aligned, " + to_string(i) + " CapFloor Pillar is " +
235 to_string(parShiftData->shiftExpiries[i]) + " vs stress shift piller " +
236 to_string(stressShiftData.shiftExpiries[i]) +
237 ". Please align pillars of stress test and par sensi config")
238 .log();
239 return false;
240 }
241 }
242 if(!stressShiftData.shiftStrikes.empty()){
243 const size_t nParStrikes = parShiftData->shiftStrikes.size();
244 const size_t nSressStrikes = stressShiftData.shiftStrikes.size();
245
246 if (nParStrikes != nSressStrikes) {
247 StructuredConfigurationWarningMessage(
248 "StressScenario", name, "Par Shift to zero conversion",
249 "mismatch between capFloor strikes, we have " + to_string(nParStrikes) + " par strikes defined but " +
250 to_string(nSressStrikes) +
251 " strikes in the scenario. Please align strikes of stress test and par sensi config")
252 .log();
253 return false;
254 }
255 for (size_t i = 0; i < nParStrikes; ++i) {
256 if (parShiftData->shiftStrikes[i] != stressShiftData.shiftStrikes[i]) {
257 StructuredConfigurationWarningMessage(
258 "StressScenario", name, "Par Shift to zero conversion",
259 "CapFloor expiries are not aligned, " + to_string(i) + " CapFloor strike is " +
260 to_string(parShiftData->shiftStrikes[i]) + " vs stress shift strike " +
261 to_string(stressShiftData.shiftStrikes[i]) +
262 ". Please align strikes of stress test and par sensi config")
263 .log();
264 return false;
265 }
266 }
267 }
268 return true;
269}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateResults()

void populateResults ( QuantLib::ext::shared_ptr< MarketRiskGroup mrg,
PnlExplainReport::PnlExplainResults result,
QuantLib::Real  deltaPnl,
QuantLib::Real  gammaPnl,
QuantLib::Real  pnl 
)

Definition at line 26 of file pnlexplainreport.cpp.

27 {
28 if (mrg->riskClass() == MarketRiskConfiguration::RiskClass::All) {
29 if (mrg->riskType() == MarketRiskConfiguration::RiskType::DeltaGamma) {
30 result.delta = deltaPnl;
31 result.gamma = gammaPnl;
32 } else if (mrg->riskType() == MarketRiskConfiguration::RiskType::Vega)
33 result.vega = pnl;
34 else if (mrg->riskType() == MarketRiskConfiguration::RiskType::All)
35 result.pnl = pnl;
36 }
37 if (mrg->riskClass() == MarketRiskConfiguration::RiskClass::InterestRate) {
38 if (mrg->riskType() == MarketRiskConfiguration::RiskType::DeltaGamma) {
39 result.irDelta = deltaPnl;
40 result.irGamma = gammaPnl;
41 } else if (mrg->riskType() == MarketRiskConfiguration::RiskType::Vega)
42 result.irVega = pnl;
43 }
44 if (mrg->riskClass() == MarketRiskConfiguration::RiskClass::Equity) {
45 if (mrg->riskType() == MarketRiskConfiguration::RiskType::DeltaGamma) {
46 result.eqDelta = deltaPnl;
47 result.eqGamma = gammaPnl;
48 } else if (mrg->riskType() == MarketRiskConfiguration::RiskType::Vega)
49 result.eqVega = pnl;
50 }
51 if (mrg->riskClass() == MarketRiskConfiguration::RiskClass::FX) {
52 if (mrg->riskType() == MarketRiskConfiguration::RiskType::DeltaGamma) {
53 result.fxDelta = deltaPnl;
54 result.fxGamma = gammaPnl;
55 } else if (mrg->riskType() == MarketRiskConfiguration::RiskType::Vega)
56 result.fxVega = pnl;
57 }
58 if (mrg->riskClass() == MarketRiskConfiguration::RiskClass::Inflation) {
59 if (mrg->riskType() == MarketRiskConfiguration::RiskType::DeltaGamma) {
60 result.infDelta = deltaPnl;
61 result.infGamma = gammaPnl;
62 } else if (mrg->riskType() == MarketRiskConfiguration::RiskType::Vega)
63 result.infVega = pnl;
64 }
65 if (mrg->riskClass() == MarketRiskConfiguration::RiskClass::Credit) {
66 if (mrg->riskType() == MarketRiskConfiguration::RiskType::DeltaGamma) {
67 result.creditDelta = deltaPnl;
68 result.creditGamma = gammaPnl;
69 } else if (mrg->riskType() == MarketRiskConfiguration::RiskType::Vega)
70 result.creditVega = pnl;
71 }
72 if (mrg->riskClass() == MarketRiskConfiguration::RiskClass::Commodity) {
73 if (mrg->riskType() == MarketRiskConfiguration::RiskType::DeltaGamma) {
74 result.comDelta = deltaPnl;
75 result.comGamma = gammaPnl;
76 } else if (mrg->riskType() == MarketRiskConfiguration::RiskType::Vega)
77 result.comVega = pnl;
78 }
79}
+ Here is the caller graph for this function:

◆ operator<<() [10/29]

std::ostream & operator<< ( ostream &  out,
const MarketRiskConfiguration::RiskClass rc 
)

Definition at line 58 of file riskfilter.cpp.

58 {
59 QL_REQUIRE(riskClassMap.left.count(rc) > 0,
60 "Risk class (" << static_cast<int>(rc) << ") not a valid MarketRiskConfiguration::RiskClass");
61 return out << riskClassMap.left.at(rc);
62}
const bm< MarketRiskConfiguration::RiskClass > riskClassMap
Definition: riskfilter.cpp:45

◆ operator<<() [11/29]

std::ostream & operator<< ( ostream &  out,
const MarketRiskConfiguration::RiskType mt 
)

Definition at line 64 of file riskfilter.cpp.

64 {
65 QL_REQUIRE(riskTypeMap.left.count(mt) > 0,
66 "Risk type (" << static_cast<int>(mt) << ") not a valid MarketRiskConfiguration::RiskType");
67 return out << riskTypeMap.left.at(mt);
68}
const bm< MarketRiskConfiguration::RiskType > riskTypeMap
Definition: riskfilter.cpp:53

◆ parseVarRiskClass()

MarketRiskConfiguration::RiskClass parseVarRiskClass ( const string &  rc)

Definition at line 70 of file riskfilter.cpp.

70 {
71 QL_REQUIRE(riskClassMap.right.count(rc) > 0,
72 "Risk class string " << rc << " does not correspond to a valid MarketRiskConfiguration::RiskClass");
73 return riskClassMap.right.at(rc);
74}

◆ parseVarMarginType()

MarketRiskConfiguration::RiskType parseVarMarginType ( const string &  mt)

Definition at line 76 of file riskfilter.cpp.

76 {
77 QL_REQUIRE(riskTypeMap.right.count(mt) > 0,
78 "Risk type string " << mt << " does not correspond to a valid MarketRiskConfiguration::RiskType");
79 return riskTypeMap.right.at(mt);
80}

◆ parseVarRiskType()

MarketRiskConfiguration::RiskType parseVarRiskType ( const std::string &  rt)

◆ getShiftSize()

Real getShiftSize ( const RiskFactorKey key,
const SensitivityScenarioData sensiParams,
const QuantLib::ext::shared_ptr< ScenarioSimMarket > &  simMarket,
const std::string &  marketConfiguration = "" 
)

Returns the absolute shift size corresponding to a particular risk factor key given sensitivity parameters sensiParams and a simulation market simMarket

Definition at line 278 of file sensitivityanalysis.cpp.

279 {
280
281 Date asof = simMarket->asofDate();
282 RiskFactorKey::KeyType keytype = key.keytype;
283 string keylabel = key.name;
284 Real shiftSize = 0.0;
285 Real shiftMult = 1.0;
286 switch (keytype) {
287 case RiskFactorKey::KeyType::FXSpot: {
288 auto itr = sensiParams.fxShiftData().find(keylabel);
289 QL_REQUIRE(itr != sensiParams.fxShiftData().end(), "shiftData not found for " << keylabel);
290 shiftSize = itr->second.shiftSize;
291 if (itr->second.shiftType == ShiftType::Relative) {
292 shiftMult = simMarket->fxRate(keylabel, marketConfiguration)->value();
293 }
294 } break;
295 case RiskFactorKey::KeyType::EquitySpot: {
296 auto itr = sensiParams.equityShiftData().find(keylabel);
297 QL_REQUIRE(itr != sensiParams.equityShiftData().end(), "shiftData not found for " << keylabel);
298 shiftSize = itr->second.shiftSize;
299 if (itr->second.shiftType == ShiftType::Relative) {
300 shiftMult = simMarket->equitySpot(keylabel, marketConfiguration)->value();
301 }
302 } break;
303 case RiskFactorKey::KeyType::DiscountCurve: {
304 string ccy = keylabel;
305 auto itr = sensiParams.discountCurveShiftData().find(ccy);
306 QL_REQUIRE(itr != sensiParams.discountCurveShiftData().end(), "shiftData not found for " << ccy);
307 shiftSize = itr->second->shiftSize;
308 if (itr->second->shiftType == ShiftType::Relative) {
309 Size keyIdx = key.index;
310 Period p = itr->second->shiftTenors[keyIdx];
311 Handle<YieldTermStructure> yts = simMarket->discountCurve(ccy, marketConfiguration);
312 Time t = yts->dayCounter().yearFraction(asof, asof + p);
313 Real zeroRate = yts->zeroRate(t, Continuous);
314 shiftMult = zeroRate;
315 }
316 } break;
317 case RiskFactorKey::KeyType::IndexCurve: {
318 string idx = keylabel;
319 auto itr = sensiParams.indexCurveShiftData().find(idx);
320 QL_REQUIRE(itr != sensiParams.indexCurveShiftData().end(), "shiftData not found for " << idx);
321 shiftSize = itr->second->shiftSize;
322 if (itr->second->shiftType == ShiftType::Relative) {
323 Size keyIdx = key.index;
324 Period p = itr->second->shiftTenors[keyIdx];
325 Handle<YieldTermStructure> yts = simMarket->iborIndex(idx, marketConfiguration)->forwardingTermStructure();
326 Time t = yts->dayCounter().yearFraction(asof, asof + p);
327 Real zeroRate = yts->zeroRate(t, Continuous);
328 shiftMult = zeroRate;
329 }
330 } break;
331 case RiskFactorKey::KeyType::YieldCurve: {
332 string yc = keylabel;
333 auto itr = sensiParams.yieldCurveShiftData().find(yc);
334 QL_REQUIRE(itr != sensiParams.yieldCurveShiftData().end(), "shiftData not found for " << yc);
335 shiftSize = itr->second->shiftSize;
336 if (itr->second->shiftType == ShiftType::Relative) {
337 Size keyIdx = key.index;
338 Period p = itr->second->shiftTenors[keyIdx];
339 Handle<YieldTermStructure> yts = simMarket->yieldCurve(yc, marketConfiguration);
340 Time t = yts->dayCounter().yearFraction(asof, asof + p);
341 Real zeroRate = yts->zeroRate(t, Continuous);
342 shiftMult = zeroRate;
343 }
344 } break;
345 case RiskFactorKey::KeyType::DividendYield: {
346 string eq = keylabel;
347 auto itr = sensiParams.dividendYieldShiftData().find(eq);
348 QL_REQUIRE(itr != sensiParams.dividendYieldShiftData().end(), "shiftData not found for " << eq);
349 shiftSize = itr->second->shiftSize;
350
351 if (itr->second->shiftType == ShiftType::Relative) {
352 Size keyIdx = key.index;
353 Period p = itr->second->shiftTenors[keyIdx];
354 Handle<YieldTermStructure> ts = simMarket->equityDividendCurve(eq, marketConfiguration);
355 Time t = ts->dayCounter().yearFraction(asof, asof + p);
356 Real zeroRate = ts->zeroRate(t, Continuous);
357 shiftMult = zeroRate;
358 }
359 } break;
360 case RiskFactorKey::KeyType::FXVolatility: {
361 string pair = keylabel;
362 auto itr = sensiParams.fxVolShiftData().find(pair);
363 QL_REQUIRE(itr != sensiParams.fxVolShiftData().end(), "shiftData not found for " << pair);
364 shiftSize = itr->second.shiftSize;
365 if (itr->second.shiftType == ShiftType::Relative) {
366 vector<Real> strikes = sensiParams.fxVolShiftData().at(pair).shiftStrikes;
367 QL_REQUIRE(strikes.size() == 1 && close_enough(strikes[0], 0), "Only ATM FX vols supported");
368 Real atmFwd = 0.0; // hardcoded, since only ATM supported
369 Size keyIdx = key.index;
370 Period p = itr->second.shiftExpiries[keyIdx];
371 Handle<BlackVolTermStructure> vts = simMarket->fxVol(pair, marketConfiguration);
372 Time t = vts->dayCounter().yearFraction(asof, asof + p);
373 Real atmVol = vts->blackVol(t, atmFwd);
374 shiftMult = atmVol;
375 }
376 } break;
377 case RiskFactorKey::KeyType::EquityVolatility: {
378 string pair = keylabel;
379 auto itr = sensiParams.equityVolShiftData().find(pair);
380 QL_REQUIRE(itr != sensiParams.equityVolShiftData().end(), "shiftData not found for " << pair);
381 shiftSize = itr->second.shiftSize;
382 if (itr->second.shiftType == ShiftType::Relative) {
383 Size keyIdx = key.index;
384 Period p = itr->second.shiftExpiries[keyIdx];
385 Handle<BlackVolTermStructure> vts = simMarket->equityVol(pair, marketConfiguration);
386 Time t = vts->dayCounter().yearFraction(asof, asof + p);
387 Real atmVol = vts->blackVol(t, Null<Real>());
388 shiftMult = atmVol;
389 }
390 } break;
391 case RiskFactorKey::KeyType::SwaptionVolatility: {
392 auto itr = sensiParams.swaptionVolShiftData().find(keylabel);
393 QL_REQUIRE(itr != sensiParams.swaptionVolShiftData().end(), "shiftData not found for " << keylabel);
394 shiftSize = itr->second.shiftSize;
395 if (itr->second.shiftType == ShiftType::Relative) {
396 vector<Real> strikes = itr->second.shiftStrikes;
397 vector<Period> tenors = itr->second.shiftTerms;
398 vector<Period> expiries = itr->second.shiftExpiries;
399 Size keyIdx = key.index;
400 Size expIdx = keyIdx / (tenors.size() * strikes.size());
401 Period p_exp = expiries[expIdx];
402 Size tenIdx = keyIdx % tenors.size();
403 Period p_ten = tenors[tenIdx];
404 Real strike = Null<Real>(); // for cubes this will be ATM
405 Handle<SwaptionVolatilityStructure> vts = simMarket->swaptionVol(keylabel, marketConfiguration);
406 Real vol = vts->volatility(p_exp, p_ten, strike);
407 shiftMult = vol;
408 }
409 } break;
410 case RiskFactorKey::KeyType::YieldVolatility: {
411 string securityId = keylabel;
412 auto itr = sensiParams.yieldVolShiftData().find(securityId);
413 QL_REQUIRE(itr != sensiParams.yieldVolShiftData().end(), "shiftData not found for " << securityId);
414 shiftSize = itr->second.shiftSize;
415 if (itr->second.shiftType == ShiftType::Relative) {
416 vector<Real> strikes = itr->second.shiftStrikes;
417 QL_REQUIRE(strikes.size() == 1 && close_enough(strikes[0], 0.0),
418 "shift strikes should be {0.0} for yield volatilities");
419 vector<Period> tenors = itr->second.shiftTerms;
420 vector<Period> expiries = itr->second.shiftExpiries;
421 Size keyIdx = key.index;
422 Size expIdx = keyIdx / (tenors.size() * strikes.size());
423 Period p_exp = expiries[expIdx];
424 Size tenIdx = keyIdx % tenors.size();
425 Period p_ten = tenors[tenIdx];
426 Real strike = Null<Real>(); // for cubes this will be ATM
427 Handle<SwaptionVolatilityStructure> vts = simMarket->yieldVol(securityId, marketConfiguration);
428 Real vol = vts->volatility(p_exp, p_ten, strike);
429 shiftMult = vol;
430 }
431 } break;
432 case RiskFactorKey::KeyType::OptionletVolatility: {
433 string ccy = keylabel;
434 auto itr = sensiParams.capFloorVolShiftData().find(ccy);
435 QL_REQUIRE(itr != sensiParams.capFloorVolShiftData().end(), "shiftData not found for " << ccy);
436 shiftSize = itr->second->shiftSize;
437 if (itr->second->shiftType == ShiftType::Relative) {
438 vector<Real> strikes = itr->second->shiftStrikes;
439 vector<Period> expiries = itr->second->shiftExpiries;
440 QL_REQUIRE(strikes.size() > 0, "Only strike capfloor vols supported");
441 shiftMult = simMarket->baseScenario()->get(
442 RiskFactorKey(RiskFactorKey::KeyType::OptionletVolatility, ccy, key.index));
443 }
444 } break;
445 case RiskFactorKey::KeyType::CDSVolatility: {
446 string name = keylabel;
447 auto itr = sensiParams.cdsVolShiftData().find(name);
448 QL_REQUIRE(itr != sensiParams.cdsVolShiftData().end(), "shiftData not found for " << name);
449 shiftSize = itr->second.shiftSize;
450 if (itr->second.shiftType == ShiftType::Relative) {
451 vector<Period> expiries = itr->second.shiftExpiries;
452 Size keyIdx = key.index;
453 Size expIdx = keyIdx;
454 Period p_exp = expiries[expIdx];
455 Handle<CreditVolCurve> vts = simMarket->cdsVol(name, marketConfiguration);
456 // hardcoded 5y term
457 Real atmVol = vts->volatility(asof + p_exp, 5.0, Null<Real>(), vts->type());
458 shiftMult = atmVol;
459 }
460 } break;
461 case RiskFactorKey::KeyType::SurvivalProbability: {
462 string name = keylabel;
463 auto itr = sensiParams.creditCurveShiftData().find(name);
464 QL_REQUIRE(itr != sensiParams.creditCurveShiftData().end(), "shiftData not found for " << name);
465 shiftSize = itr->second->shiftSize;
466 if (itr->second->shiftType == ShiftType::Relative) {
467 Size keyIdx = key.index;
468 Period p = itr->second->shiftTenors[keyIdx];
469 Handle<DefaultProbabilityTermStructure> ts = simMarket->defaultCurve(name, marketConfiguration)->curve();
470 Time t = ts->dayCounter().yearFraction(asof, asof + p);
471 Real prob = ts->survivalProbability(t);
472 shiftMult = -std::log(prob) / t;
473 }
474 } break;
475 case RiskFactorKey::KeyType::BaseCorrelation: {
476 string name = keylabel;
477 auto itr = sensiParams.baseCorrelationShiftData().find(name);
478 QL_REQUIRE(itr != sensiParams.baseCorrelationShiftData().end(), "shiftData not found for " << name);
479 shiftSize = itr->second.shiftSize;
480 if (itr->second.shiftType == ShiftType::Relative) {
481 vector<Real> lossLevels = itr->second.shiftLossLevels;
482 vector<Period> terms = itr->second.shiftTerms;
483 Size keyIdx = key.index;
484 Size lossLevelIdx = keyIdx / terms.size();
485 Real lossLevel = lossLevels[lossLevelIdx];
486 Size termIdx = keyIdx % terms.size();
487 Period term = terms[termIdx];
488 Handle<QuantExt::BaseCorrelationTermStructure> ts = simMarket->baseCorrelation(name, marketConfiguration);
489 Real bc = ts->correlation(asof + term, lossLevel, true); // extrapolate
490 shiftMult = bc;
491 }
492 } break;
493 case RiskFactorKey::KeyType::ZeroInflationCurve: {
494 string idx = keylabel;
495 auto itr = sensiParams.zeroInflationCurveShiftData().find(idx);
496 QL_REQUIRE(itr != sensiParams.zeroInflationCurveShiftData().end(), "shiftData not found for " << idx);
497 shiftSize = itr->second->shiftSize;
498 if (itr->second->shiftType == ShiftType::Relative) {
499 Size keyIdx = key.index;
500 Period p = itr->second->shiftTenors[keyIdx];
501 Handle<ZeroInflationTermStructure> yts =
502 simMarket->zeroInflationIndex(idx, marketConfiguration)->zeroInflationTermStructure();
503 Time t = yts->dayCounter().yearFraction(asof, asof + p);
504 Real zeroRate = yts->zeroRate(t);
505 shiftMult = zeroRate;
506 }
507 } break;
508 case RiskFactorKey::KeyType::YoYInflationCurve: {
509 string idx = keylabel;
510 auto itr = sensiParams.yoyInflationCurveShiftData().find(idx);
511 QL_REQUIRE(itr != sensiParams.yoyInflationCurveShiftData().end(), "shiftData not found for " << idx);
512 shiftSize = itr->second->shiftSize;
513 if (itr->second->shiftType == ShiftType::Relative) {
514 Size keyIdx = key.index;
515 Period p = sensiParams.yoyInflationCurveShiftData().at(idx)->shiftTenors[keyIdx];
516 Handle<YoYInflationTermStructure> yts =
517 simMarket->yoyInflationIndex(idx, marketConfiguration)->yoyInflationTermStructure();
518 Time t = yts->dayCounter().yearFraction(asof, asof + p);
519 Real yoyRate = yts->yoyRate(t);
520 shiftMult = yoyRate;
521 }
522 } break;
523 case RiskFactorKey::KeyType::YoYInflationCapFloorVolatility: {
524 string name = keylabel;
525 auto itr = sensiParams.yoyInflationCapFloorVolShiftData().find(name);
526 QL_REQUIRE(itr != sensiParams.yoyInflationCapFloorVolShiftData().end(), "shiftData not found for " << name);
527 shiftSize = itr->second->shiftSize;
528 if (itr->second->shiftType == ShiftType::Relative) {
529 vector<Real> strikes = itr->second->shiftStrikes;
530 vector<Period> expiries = itr->second->shiftExpiries;
531 QL_REQUIRE(strikes.size() > 0, "Only strike yoy inflation capfloor vols supported");
532 Size keyIdx = key.index;
533 Size expIdx = keyIdx / strikes.size();
534 Period p_exp = expiries[expIdx];
535 Size strIdx = keyIdx % strikes.size();
536 Real strike = strikes[strIdx];
537 Handle<QuantExt::YoYOptionletVolatilitySurface> vts = simMarket->yoyCapFloorVol(name, marketConfiguration);
538 Real vol = vts->volatility(p_exp, strike, vts->observationLag());
539 shiftMult = vol;
540 }
541 } break;
542 case RiskFactorKey::KeyType::ZeroInflationCapFloorVolatility: {
543 string name = keylabel;
544 auto itr = sensiParams.zeroInflationCapFloorVolShiftData().find(name);
545 QL_REQUIRE(itr != sensiParams.zeroInflationCapFloorVolShiftData().end(), "shiftData not found for " << name);
546 shiftSize = itr->second->shiftSize;
547 if (itr->second->shiftType == ShiftType::Relative) {
548 vector<Real> strikes = itr->second->shiftStrikes;
549 vector<Period> expiries = itr->second->shiftExpiries;
550 QL_REQUIRE(strikes.size() > 0, "Only strike zc inflation capfloor vols supported");
551 Size keyIdx = key.index;
552 Size expIdx = keyIdx / strikes.size();
553 Period p_exp = expiries[expIdx];
554 Size strIdx = keyIdx % strikes.size();
555 Real strike = strikes[strIdx];
556 Handle<CPIVolatilitySurface> vts =
557 simMarket->cpiInflationCapFloorVolatilitySurface(name, marketConfiguration);
558 Real vol = vts->volatility(p_exp, strike, vts->observationLag());
559 shiftMult = vol;
560 }
561 } break;
562 case RiskFactorKey::KeyType::CommodityCurve: {
563 auto it = sensiParams.commodityCurveShiftData().find(keylabel);
564 QL_REQUIRE(it != sensiParams.commodityCurveShiftData().end(), "shiftData not found for " << keylabel);
565 shiftSize = it->second->shiftSize;
566 if (it->second->shiftType == ShiftType::Relative) {
567 Period p = it->second->shiftTenors[key.index];
568 Handle<PriceTermStructure> priceCurve = simMarket->commodityPriceCurve(keylabel, marketConfiguration);
569 Time t = priceCurve->dayCounter().yearFraction(asof, asof + p);
570 shiftMult = priceCurve->price(t);
571 }
572 } break;
573 case RiskFactorKey::KeyType::CommodityVolatility: {
574 auto it = sensiParams.commodityVolShiftData().find(keylabel);
575 QL_REQUIRE(it != sensiParams.commodityVolShiftData().end(), "shiftData not found for " << keylabel);
576
577 shiftSize = it->second.shiftSize;
578 if (it->second.shiftType == ShiftType::Relative) {
579 Size moneynessIndex = key.index / it->second.shiftExpiries.size();
580 Size expiryIndex = key.index % it->second.shiftExpiries.size();
581 Real moneyness = it->second.shiftStrikes[moneynessIndex];
582 Period expiry = it->second.shiftExpiries[expiryIndex];
583 Real spotValue = simMarket->commodityPriceCurve(keylabel, marketConfiguration)->price(0);
584 Handle<BlackVolTermStructure> vts = simMarket->commodityVolatility(keylabel, marketConfiguration);
585 Time t = vts->dayCounter().yearFraction(asof, asof + expiry);
586 Real vol = vts->blackVol(t, moneyness * spotValue);
587 shiftMult = vol;
588 }
589 } break;
590 case RiskFactorKey::KeyType::SecuritySpread: {
591 auto itr = sensiParams.securityShiftData().find(keylabel);
592 QL_REQUIRE(itr != sensiParams.securityShiftData().end(), "shiftData not found for " << keylabel);
593 shiftSize = itr->second.shiftSize;
594 if (itr->second.shiftType == ShiftType::Relative) {
595 shiftMult = 1.0;
596 try {
597 shiftMult = simMarket->securitySpread(keylabel, marketConfiguration)->value();
598 } catch (...) {
599 // if there is no spread given for a security, we return 1.0, this is not relevant anyway,
600 // because there will be no scenario generated for this risk factor
601 }
602 }
603 } break;
604 default:
605 // KeyType::CPIIndex does not get shifted
606 QL_FAIL("KeyType not supported yet - " << keytype);
607 }
608 Real realShift = shiftSize * shiftMult;
609 return realShift;
610}
KeyType
Risk Factor types.
Definition: scenario.hpp:51
const map< string, QuantLib::ext::shared_ptr< CapFloorVolShiftData > > & yoyInflationCapFloorVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & indexCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CapFloorVolShiftData > > & capFloorVolShiftData() const
const map< string, SpotShiftData > & securityShiftData() const
const map< string, VolShiftData > & equityVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & discountCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & dividendYieldShiftData() const
const map< string, VolShiftData > & fxVolShiftData() const
const map< string, GenericYieldVolShiftData > & yieldVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & zeroInflationCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & creditCurveShiftData() const
const map< string, SpotShiftData > & fxShiftData() const
const map< string, GenericYieldVolShiftData > & swaptionVolShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & yoyInflationCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CapFloorVolShiftData > > & zeroInflationCapFloorVolShiftData() const
const map< string, BaseCorrelationShiftData > & baseCorrelationShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & yieldCurveShiftData() const
const map< string, QuantLib::ext::shared_ptr< CurveShiftData > > & commodityCurveShiftData() const
const map< string, VolShiftData > & commodityVolShiftData() const
const map< string, CdsVolShiftData > & cdsVolShiftData() const
const map< string, SpotShiftData > & equityShiftData() const
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
vector< Real > strikes
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [12/29]

std::ostream & operator<< ( ostream &  out,
const SensitivityRecord sr 
)

Enable writing of a SensitivityRecord.

Definition at line 65 of file sensitivityrecord.cpp.

65 {
66 return out << "[" << sr.tradeId << ", " << std::boolalpha << sr.isPar << ", " << sr.key_1 << ", " << sr.desc_1
67 << ", " << fixed << setprecision(6) << sr.shift_1 << ", " << sr.key_2 << ", " << sr.desc_2 << ", "
68 << fixed << setprecision(6) << sr.shift_2 << ", " << sr.currency << ", " << fixed << setprecision(2)
69 << sr.baseNpv << ", " << fixed << setprecision(2) << sr.delta << ", " << fixed << setprecision(2)
70 << sr.gamma << "]";
71}

◆ operator<<() [13/29]

std::ostream & operator<< ( std::ostream &  out,
const AggregationScenarioDataType t 
)

Definition at line 156 of file aggregationscenariodata.hpp.

156 {
157 switch (t) {
158 case AggregationScenarioDataType::IndexFixing:
159 return out << "IndexFixing";
160 case AggregationScenarioDataType::FXSpot:
161 return out << "FXSpot";
162 case AggregationScenarioDataType::Numeraire:
163 return out << "Numeraire";
164 case AggregationScenarioDataType::CreditState:
165 return out << "CreditState";
166 case AggregationScenarioDataType::SurvivalWeight:
167 return out << "SurvivalWeight";
168 case AggregationScenarioDataType::RecoveryRate:
169 return out << "RecoveryRate";
170 case AggregationScenarioDataType::Generic:
171 return out << "Generic";
172 default:
173 return out << "Unknown aggregation scenario data type";
174 }
175}

◆ operator<<() [14/29]

std::ostream & operator<< ( std::ostream &  out,
const ReturnConfiguration::ReturnType  t 
)

Definition at line 145 of file historicalscenariogenerator.cpp.

145 {
146 switch (t) {
147 case ReturnConfiguration::ReturnType::Absolute:
148 return out << "Absolute";
149 case ReturnConfiguration::ReturnType::Relative:
150 return out << "Relative";
151 case ReturnConfiguration::ReturnType::Log:
152 return out << "Log";
153 default:
154 return out << "Unknown ReturnType (" << static_cast<int>(t) << ")";
155 }
156}

◆ buildHistoricalScenarioGenerator() [1/2]

QuantLib::ext::shared_ptr< HistoricalScenarioGenerator > buildHistoricalScenarioGenerator ( const QuantLib::ext::shared_ptr< HistoricalScenarioReader > &  hsr,
const QuantLib::ext::shared_ptr< ore::data::AdjustmentFactors > &  adjFactors,
const TimePeriod period,
Calendar  calendar,
Size  mporDays,
const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > &  simParams,
const QuantLib::ext::shared_ptr< TodaysMarketParameters > &  marketParams,
const bool  overlapping 
)

Definition at line 505 of file historicalscenariogenerator.cpp.

510 {
511
512 hsr->load(simParams, marketParams);
513
514 auto scenarioFactory = QuantLib::ext::make_shared<SimpleScenarioFactory>(true);
515
516 QuantLib::ext::shared_ptr<HistoricalScenarioLoader> scenarioLoader = QuantLib::ext::make_shared<HistoricalScenarioLoader>(
517 hsr, period.startDates().front(), period.endDates().front(), calendar);
518
519 // Create the historical scenario generator
520 return QuantLib::ext::make_shared<HistoricalScenarioGenerator>(scenarioLoader, scenarioFactory, calendar, adjFactors,
521 mporDays, overlapping, ReturnConfiguration(), "hs_");
522}
Return type for historical scenario generation (absolute, relative, log)
const std::vector< Date > & endDates() const
const std::vector< Date > & startDates() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHistoricalScenarioGenerator() [2/2]

QuantLib::ext::shared_ptr< HistoricalScenarioGenerator > buildHistoricalScenarioGenerator ( const QuantLib::ext::shared_ptr< HistoricalScenarioReader > &  hsr,
const QuantLib::ext::shared_ptr< ore::data::AdjustmentFactors > &  adjFactors,
const std::set< QuantLib::Date > &  dates,
const QuantLib::ext::shared_ptr< ScenarioSimMarketParameters > &  simParams,
const QuantLib::ext::shared_ptr< TodaysMarketParameters > &  marketParams 
)

Definition at line 524 of file historicalscenariogenerator.cpp.

528 {
529
530 hsr->load(simParams, marketParams);
531
532 auto scenarioFactory = QuantLib::ext::make_shared<SimpleScenarioFactory>();
533
534 QuantLib::ext::shared_ptr<HistoricalScenarioLoader> scenarioLoader =
535 QuantLib::ext::make_shared<HistoricalScenarioLoader>(
536 hsr, dates);
537
538 // Create the historical scenario generator
539 return QuantLib::ext::make_shared<HistoricalScenarioGenerator>(scenarioLoader, scenarioFactory,
540 adjFactors, ReturnConfiguration(), "hs_");
541}

◆ hash_value()

std::size_t hash_value ( const RiskFactorKey k)

Definition at line 30 of file scenario.cpp.

30 {
31 std::size_t seed = 0;
32 boost::hash_combine(seed, k.keytype);
33 boost::hash_combine(seed, k.name);
34 boost::hash_combine(seed, k.index);
35 return seed;
36}

◆ operator<<() [15/29]

std::ostream & operator<< ( std::ostream &  out,
const RiskFactorKey::KeyType type 
)

Definition at line 45 of file scenario.cpp.

45 {
46 switch (type) {
47 case RiskFactorKey::KeyType::DiscountCurve:
48 return out << "DiscountCurve";
49 case RiskFactorKey::KeyType::YieldCurve:
50 return out << "YieldCurve";
51 case RiskFactorKey::KeyType::IndexCurve:
52 return out << "IndexCurve";
53 case RiskFactorKey::KeyType::SwaptionVolatility:
54 return out << "SwaptionVolatility";
55 case RiskFactorKey::KeyType::YieldVolatility:
56 return out << "YieldVolatility";
57 case RiskFactorKey::KeyType::OptionletVolatility:
58 return out << "OptionletVolatility";
59 case RiskFactorKey::KeyType::FXSpot:
60 return out << "FXSpot";
61 case RiskFactorKey::KeyType::FXVolatility:
62 return out << "FXVolatility";
63 case RiskFactorKey::KeyType::EquitySpot:
64 return out << "EquitySpot";
65 case RiskFactorKey::KeyType::EquityVolatility:
66 return out << "EquityVolatility";
67 case RiskFactorKey::KeyType::DividendYield:
68 return out << "DividendYield";
69 case RiskFactorKey::KeyType::SurvivalProbability:
70 return out << "SurvivalProbability";
71 case RiskFactorKey::KeyType::SurvivalWeight:
72 return out << "SurvivalWeight";
73 case RiskFactorKey::KeyType::RecoveryRate:
74 return out << "RecoveryRate";
75 case RiskFactorKey::KeyType::CreditState:
76 return out << "CrState";
77 case RiskFactorKey::KeyType::CDSVolatility:
78 return out << "CDSVolatility";
79 case RiskFactorKey::KeyType::BaseCorrelation:
80 return out << "BaseCorrelation";
81 case RiskFactorKey::KeyType::CPIIndex:
82 return out << "CPIIndex";
83 case RiskFactorKey::KeyType::ZeroInflationCurve:
84 return out << "ZeroInflationCurve";
85 case RiskFactorKey::KeyType::YoYInflationCurve:
86 return out << "YoYInflationCurve";
87 case RiskFactorKey::KeyType::YoYInflationCapFloorVolatility:
88 return out << "YoYInflationCapFloorVolatility";
89 case RiskFactorKey::KeyType::ZeroInflationCapFloorVolatility:
90 return out << "ZeroInflationCapFloorVolatility";
91 case RiskFactorKey::KeyType::CommodityCurve:
92 return out << "CommodityCurve";
93 case RiskFactorKey::KeyType::CommodityVolatility:
94 return out << "CommodityVolatility";
95 case RiskFactorKey::KeyType::SecuritySpread:
96 return out << "SecuritySpread";
97 case RiskFactorKey::KeyType::Correlation:
98 return out << "Correlation";
99 case RiskFactorKey::KeyType::CPR:
100 return out << "CPR";
101 default:
102 return out << "?";
103 }
104}

◆ operator<<() [16/29]

std::ostream & operator<< ( std::ostream &  out,
const RiskFactorKey key 
)

Definition at line 106 of file scenario.cpp.

106 {
107 // If empty key just return empty string (not "?//0")
108 if (key == RiskFactorKey()) {
109 return out << "";
110 }
111
112 string keyStr = key.name;
113 size_t index = 0;
114 while (true) {
115 /* Locate the substring to replace. */
116 index = keyStr.find("/", index);
117 if (index == std::string::npos)
118 break;
119
120 keyStr.replace(index, 1, "\\/");
121 index += 2;
122 }
123
124 // If not empty key
125 return out << key.keytype << "/" << keyStr << "/" << key.index;
126}

◆ parseRiskFactorKeyType()

RiskFactorKey::KeyType parseRiskFactorKeyType ( const string &  str)

Definition at line 128 of file scenario.cpp.

128 {
129 if (str == "DiscountCurve")
130 return RiskFactorKey::KeyType::DiscountCurve;
131 else if (str == "YieldCurve")
132 return RiskFactorKey::KeyType::YieldCurve;
133 else if (str == "IndexCurve")
134 return RiskFactorKey::KeyType::IndexCurve;
135 else if (str == "SwaptionVolatility")
136 return RiskFactorKey::KeyType::SwaptionVolatility;
137 else if (str == "YieldVolatility")
138 return RiskFactorKey::KeyType::YieldVolatility;
139 else if (str == "OptionletVolatility")
140 return RiskFactorKey::KeyType::OptionletVolatility;
141 else if (str == "FXSpot")
142 return RiskFactorKey::KeyType::FXSpot;
143 else if (str == "FXVolatility")
144 return RiskFactorKey::KeyType::FXVolatility;
145 else if (str == "EquitySpot")
146 return RiskFactorKey::KeyType::EquitySpot;
147 else if (str == "EquityVolatility")
148 return RiskFactorKey::KeyType::EquityVolatility;
149 else if (str == "DividendYield")
150 return RiskFactorKey::KeyType::DividendYield;
151 else if (str == "SurvivalProbability")
152 return RiskFactorKey::KeyType::SurvivalProbability;
153 else if (str == "RecoveryRate")
154 return RiskFactorKey::KeyType::RecoveryRate;
155 else if (str == "CDSVolatility")
156 return RiskFactorKey::KeyType::CDSVolatility;
157 else if (str == "BaseCorrelation")
158 return RiskFactorKey::KeyType::BaseCorrelation;
159 else if (str == "CPIIndex")
160 return RiskFactorKey::KeyType::CPIIndex;
161 else if (str == "ZeroInflationCurve")
162 return RiskFactorKey::KeyType::ZeroInflationCurve;
163 else if (str == "YoYInflationCurve")
164 return RiskFactorKey::KeyType::YoYInflationCurve;
165 else if (str == "YoYInflationCapFloorVolatility")
166 return RiskFactorKey::KeyType::YoYInflationCapFloorVolatility;
167 else if (str == "ZeroInflationCapFloorVolatility")
168 return RiskFactorKey::KeyType::ZeroInflationCapFloorVolatility;
169 else if (str == "CommodityCurve")
170 return RiskFactorKey::KeyType::CommodityCurve;
171 else if (str == "CommodityVolatility")
172 return RiskFactorKey::KeyType::CommodityVolatility;
173 else if (str == "SecuritySpread")
174 return RiskFactorKey::KeyType::SecuritySpread;
175 else if (str == "Correlation")
176 return RiskFactorKey::KeyType::Correlation;
177 else if (str == "CPR")
178 return RiskFactorKey::KeyType::CPR;
179
180 QL_FAIL("RiskFactorKey " << str << " does not exist.");
181}
+ Here is the caller graph for this function:

◆ parseRiskFactorKey() [1/2]

RiskFactorKey parseRiskFactorKey ( const string &  str)

Definition at line 183 of file scenario.cpp.

183 {
184 boost::escaped_list_separator<char> sep('\\', '/', '\"');
185 boost::tokenizer<boost::escaped_list_separator<char> > tokenSplit(str, sep);
186 vector<string> tokens(tokenSplit.begin(), tokenSplit.end());
187
188 QL_REQUIRE(tokens.size() == 3, "Could not parse key " << str);
189 RiskFactorKey rfk(parseRiskFactorKeyType(tokens[0]), tokens[1], parseInteger(tokens[2]));
190 return rfk;
191}
RiskFactorKey::KeyType parseRiskFactorKeyType(const string &str)
Definition: scenario.cpp:128
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseShiftScheme()

ShiftScheme parseShiftScheme ( const std::string &  s)

Definition at line 193 of file scenario.cpp.

193 {
194 static map<string, ShiftScheme> m = {{"Forward", ShiftScheme::Forward},
195 {"Backward", ShiftScheme::Backward},
196 {"Central", ShiftScheme::Central}};
197 auto it = m.find(s);
198 if (it != m.end()) {
199 return it->second;
200 } else {
201 QL_FAIL("Cannot convert shift scheme \"" << s << "\" to ShiftScheme");
202 }
203}
+ Here is the caller graph for this function:

◆ operator<<() [17/29]

std::ostream & operator<< ( std::ostream &  out,
const ShiftScheme shiftScheme 
)

Definition at line 205 of file scenario.cpp.

205 {
206 if (shiftScheme == ShiftScheme::Forward)
207 return out << "Forward";
208 else if (shiftScheme == ShiftScheme::Backward)
209 return out << "Backward";
210 else if (shiftScheme == ShiftScheme::Central)
211 return out << "Central";
212 else
213 QL_FAIL("Invalid ShiftScheme " << static_cast<int>(shiftScheme));
214}

◆ parseShiftType()

ShiftType parseShiftType ( const std::string &  s)

Definition at line 216 of file scenario.cpp.

216 {
217 static map<string, ShiftType> m = {
218 {"Absolute", ShiftType::Absolute},
219 {"Relative", ShiftType::Relative}};
220 auto it = m.find(s);
221 if (it != m.end()) {
222 return it->second;
223 } else {
224 QL_FAIL("Cannot convert shift type \"" << s << "\" to ShiftType");
225 }
226}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [18/29]

std::ostream & operator<< ( std::ostream &  out,
const ShiftType shiftType 
)

Definition at line 228 of file scenario.cpp.

228 {
229 if (shiftType == ShiftType::Absolute)
230 return out << "Absolute";
231 else if (shiftType == ShiftType::Relative)
232 return out << "Relative";
233 else
234 QL_FAIL("Invalid ShiftType " << shiftType);
235}

◆ operator<() [1/4]

bool operator< ( const RiskFactorKey lhs,
const RiskFactorKey rhs 
)

Definition at line 109 of file scenario.hpp.

109 {
110 return std::tie(lhs.keytype, lhs.name, lhs.index) < std::tie(rhs.keytype, rhs.name, rhs.index);
111}

◆ operator==() [1/2]

bool operator== ( const RiskFactorKey lhs,
const RiskFactorKey rhs 
)

Definition at line 113 of file scenario.hpp.

113 {
114 return lhs.keytype == rhs.keytype && lhs.name == rhs.name && lhs.index == rhs.index;
115}

◆ operator>()

bool operator> ( const RiskFactorKey lhs,
const RiskFactorKey rhs 
)

Definition at line 117 of file scenario.hpp.

117{ return rhs < lhs; }

◆ operator<=()

bool operator<= ( const RiskFactorKey lhs,
const RiskFactorKey rhs 
)

Definition at line 118 of file scenario.hpp.

118{ return !(lhs > rhs); }

◆ operator>=()

bool operator>= ( const RiskFactorKey lhs,
const RiskFactorKey rhs 
)

Definition at line 119 of file scenario.hpp.

119{ return !(lhs < rhs); }

◆ operator!=()

bool operator!= ( const RiskFactorKey lhs,
const RiskFactorKey rhs 
)

Definition at line 120 of file scenario.hpp.

120{ return !(lhs == rhs); }

◆ yieldCurveRiskFactor()

RiskFactorKey::KeyType yieldCurveRiskFactor ( const ore::data::YieldCurveType  y)

Map a yield curve type to a risk factor key type.

Definition at line 151 of file scenariosimmarket.cpp.

151 {
152
153 if (y == ore::data::YieldCurveType::Discount) {
154 return RiskFactorKey::KeyType::DiscountCurve;
155 } else if (y == ore::data::YieldCurveType::Yield) {
156 return RiskFactorKey::KeyType::YieldCurve;
157 } else if (y == ore::data::YieldCurveType::EquityDividend) {
158 return RiskFactorKey::KeyType::DividendYield;
159 } else {
160 QL_FAIL("yieldCurveType not supported");
161 }
162}

◆ riskFactorYieldCurve()

ore::data::YieldCurveType riskFactorYieldCurve ( const RiskFactorKey::KeyType  rf)

Definition at line 164 of file scenariosimmarket.cpp.

164 {
165
166 if (rf == RiskFactorKey::KeyType::DiscountCurve) {
167 return ore::data::YieldCurveType::Discount;
168 } else if (rf == RiskFactorKey::KeyType::YieldCurve) {
169 return ore::data::YieldCurveType::Yield;
170 } else if (rf == RiskFactorKey::KeyType::DividendYield) {
171 return ore::data::YieldCurveType::EquityDividend;
172 } else {
173 QL_FAIL("RiskFactorKey::KeyType not supported");
174 }
175}
+ Here is the caller graph for this function:

◆ getDifferenceScenario() [1/2]

Real getDifferenceScenario ( const RiskFactorKey::KeyType  keyType,
const Real  v1,
const Real  v2 
)

Definition at line 28 of file scenarioutilities.cpp.

28 {
29 switch (keyType) {
30 case RiskFactorKey::KeyType::SwaptionVolatility:
31 case RiskFactorKey::KeyType::YieldVolatility:
32 case RiskFactorKey::KeyType::OptionletVolatility:
33 case RiskFactorKey::KeyType::FXVolatility:
34 case RiskFactorKey::KeyType::EquityVolatility:
35 case RiskFactorKey::KeyType::CDSVolatility:
36 case RiskFactorKey::KeyType::BaseCorrelation:
37 case RiskFactorKey::KeyType::ZeroInflationCurve:
38 case RiskFactorKey::KeyType::YoYInflationCurve:
39 case RiskFactorKey::KeyType::ZeroInflationCapFloorVolatility:
40 case RiskFactorKey::KeyType::YoYInflationCapFloorVolatility:
41 case RiskFactorKey::KeyType::CommodityCurve:
42 case RiskFactorKey::KeyType::CommodityVolatility:
43 case RiskFactorKey::KeyType::SecuritySpread:
44 case RiskFactorKey::KeyType::Correlation:
45 case RiskFactorKey::KeyType::CPR:
46 return v2 - v1;
47
48 case RiskFactorKey::KeyType::DiscountCurve:
49 case RiskFactorKey::KeyType::YieldCurve:
50 case RiskFactorKey::KeyType::IndexCurve:
51 case RiskFactorKey::KeyType::FXSpot:
52 case RiskFactorKey::KeyType::EquitySpot:
53 case RiskFactorKey::KeyType::DividendYield:
54 case RiskFactorKey::KeyType::SurvivalProbability:
55 case RiskFactorKey::KeyType::RecoveryRate:
56 case RiskFactorKey::KeyType::CPIIndex:
57 return v2 / v1;
58
59 case RiskFactorKey::KeyType::None:
60 case RiskFactorKey::KeyType::SurvivalWeight:
61 case RiskFactorKey::KeyType::CreditState:
62 default:
63 QL_FAIL("getDifferenceScenario(): key type "
64 << keyType << " not expected, and not covered. This is an internal error, contact dev.");
65 };
66}
+ Here is the caller graph for this function:

◆ addDifferenceToScenario() [1/2]

Real addDifferenceToScenario ( const RiskFactorKey::KeyType  keyType,
const Real  v,
const Real  d 
)

Definition at line 68 of file scenarioutilities.cpp.

68 {
69 switch (keyType) {
70 case RiskFactorKey::KeyType::SwaptionVolatility:
71 case RiskFactorKey::KeyType::YieldVolatility:
72 case RiskFactorKey::KeyType::OptionletVolatility:
73 case RiskFactorKey::KeyType::FXVolatility:
74 case RiskFactorKey::KeyType::EquityVolatility:
75 case RiskFactorKey::KeyType::CDSVolatility:
76 case RiskFactorKey::KeyType::BaseCorrelation:
77 case RiskFactorKey::KeyType::ZeroInflationCurve:
78 case RiskFactorKey::KeyType::YoYInflationCurve:
79 case RiskFactorKey::KeyType::ZeroInflationCapFloorVolatility:
80 case RiskFactorKey::KeyType::YoYInflationCapFloorVolatility:
81 case RiskFactorKey::KeyType::CommodityCurve:
82 case RiskFactorKey::KeyType::CommodityVolatility:
83 case RiskFactorKey::KeyType::SecuritySpread:
84 case RiskFactorKey::KeyType::Correlation:
85 case RiskFactorKey::KeyType::CPR:
86 return v + d;
87
88 case RiskFactorKey::KeyType::DiscountCurve:
89 case RiskFactorKey::KeyType::YieldCurve:
90 case RiskFactorKey::KeyType::IndexCurve:
91 case RiskFactorKey::KeyType::FXSpot:
92 case RiskFactorKey::KeyType::EquitySpot:
93 case RiskFactorKey::KeyType::DividendYield:
94 case RiskFactorKey::KeyType::SurvivalProbability:
95 case RiskFactorKey::KeyType::RecoveryRate:
96 case RiskFactorKey::KeyType::CPIIndex:
97 return v * d;
98
99 case RiskFactorKey::KeyType::None:
100 case RiskFactorKey::KeyType::SurvivalWeight:
101 case RiskFactorKey::KeyType::CreditState:
102 default:
103 QL_FAIL("addDifferenceToScenario(): key type "
104 << keyType << " not expected, and not covered. This is an internal error, contact dev.");
105 };
106}
+ Here is the caller graph for this function:

◆ getDifferenceScenario() [2/2]

QuantLib::ext::shared_ptr< Scenario > getDifferenceScenario ( const QuantLib::ext::shared_ptr< Scenario > &  s1,
const QuantLib::ext::shared_ptr< Scenario > &  s2,
const Date &  targetScenarioAsOf,
const Real  targetScenarioNumeraire 
)

Definition at line 108 of file scenarioutilities.cpp.

111 {
112
113 QL_REQUIRE(s1->isAbsolute() && s2->isAbsolute(), "getDifferenceScenario(): both scenarios must be absolute ("
114 << std::boolalpha << s1->isAbsolute() << ", "
115 << s2->isAbsolute());
116
117 QL_REQUIRE(s1->keysHash() == s2->keysHash(),
118 "getDifferenceScenario(): both scenarios must have identical key sets");
119
120 Date asof = targetScenarioAsOf;
121 if (asof == Date() && s1->asof() == s2->asof())
122 asof = s1->asof();
123
124 QL_REQUIRE(asof != Date(), "getDifferenceScenario(): either both scenarios have to have the same asof date ("
125 << s1->asof() << ", " << s2->asof()
126 << ") or the target scenario asof date must be given.");
127
128 auto result = s1->clone();
129 result->setAsof(asof);
130 result->label("differenceScenario(" + s1->label() + "," + s2->label() + ")");
131 result->setNumeraire(targetScenarioNumeraire);
132 result->setAbsolute(false);
133
134 for (auto const& k : s1->keys()) {
135 result->add(k, getDifferenceScenario(k.keytype, s1->get(k), s2->get(k)));
136 }
137
138 return result;
139}
Real getDifferenceScenario(const RiskFactorKey::KeyType keyType, const Real v1, const Real v2)
+ Here is the call graph for this function:

◆ addDifferenceToScenario() [2/2]

QuantLib::ext::shared_ptr< Scenario > addDifferenceToScenario ( const QuantLib::ext::shared_ptr< Scenario > &  s,
const QuantLib::ext::shared_ptr< Scenario > &  d,
const Date &  targetScenarioAsOf,
const Real  targetScenarioNumeraire 
)

Definition at line 141 of file scenarioutilities.cpp.

144 {
145
146 QL_REQUIRE(!d->isAbsolute(), "addDifferenceToScenario(): second argument must be difference scenario");
147 QL_REQUIRE(s->keysHash() == d->keysHash(),
148 "addDifferenceToScenario(): both scenarios must have identical key sets.");
149
150 Date asof = targetScenarioAsOf;
151 if (asof == Date() && s->asof() == d->asof())
152 asof = s->asof();
153
154 QL_REQUIRE(asof != Date(), "addDifferenceToScenario(): either both scenarios have to have the same asof date ("
155 << s->asof() << ", " << d->asof()
156 << ") or the target scenario asof date must be given.");
157
158 auto result = s->clone();
159 result->setAsof(asof);
160 result->label("sumScenario(" + s->label() + "," + d->label() + ")");
161 result->setNumeraire(targetScenarioNumeraire);
162 result->setAbsolute(s->isAbsolute());
163
164 for (auto const& k : s->keys()) {
165 result->add(k, addDifferenceToScenario(k.keytype, s->get(k), d->get(k)));
166 }
167
168 return result;
169}
Real addDifferenceToScenario(const RiskFactorKey::KeyType keyType, const Real v, const Real d)
+ Here is the call graph for this function:

◆ recastScenario() [1/2]

QuantLib::ext::shared_ptr< Scenario > recastScenario ( const QuantLib::ext::shared_ptr< Scenario > &  scenario,
const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > &  oldCoordinates,
const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > &  newCoordinates 
)

Definition at line 227 of file scenarioutilities.cpp.

230 {
231
232 auto result = QuantLib::ext::make_shared<SimpleScenario>(
233 scenario->asof(), scenario->label() + " (mapped to new coordinates)", scenario->getNumeraire());
234 result->setAbsolute(scenario->isAbsolute());
235
236 std::set<std::pair<RiskFactorKey::KeyType, std::string>> keys;
237 for (auto const& k : scenario->keys()) {
238 if(newCoordinates.count({k.keytype, k.name})==1){
239 keys.insert(std::make_pair(k.keytype, k.name));
240 TLOG("Insert keys " << k.keytype << " " << k.name)
241 } else{
242 TLOG("Recast skip " << k.keytype << " " << k.name);
243 }
244 }
245
246
247
248 for (auto const& k : keys) {
249
250 auto c0 = oldCoordinates.find(k);
251 auto c1 = newCoordinates.find(k);
252 QL_REQUIRE(c0 != scenario->coordinates().end(), "recastScenario(): no coordinates for "
253 << k.first << "/" << k.second
254 << " found in old coordinates. This is unexpected.");
255 QL_REQUIRE(c1 != scenario->coordinates().end(), "recastScenario(): no coordinates for "
256 << k.first << "/" << k.second
257 << " found in new coordinates. This is unexpected.");
258 QL_REQUIRE(c0->second.size() == c1->second.size(), "recastScenario(): number of dimensions in old ("
259 << c0->second.size() << ") and new ("
260 << c1->second.size() << ") coordinates for " << k.first
261 << "/" << k.second << " do not match.");
262 if (c1->second.size() == 0) {
263
264 // nothing to interpolate, just copy the single value associated to a rf key
265
266 RiskFactorKey key(k.first, k.second, 0);
267 result->add(key, scenario->get(key));
268
269 } else {
270 // interpolate new values from old values
271 Size newKeyIndex = 0;
272 std::vector<Size> indices(c0->second.size(), 0);
273 int workingIndex;
274 do {
275 workingIndex = indices.size() - 1;
276 while (workingIndex >= 0 && indices[workingIndex] == c1->second[workingIndex].size()) {
277 --workingIndex;
278 if (workingIndex >= 0)
279 indices[workingIndex] = 0;
280 }
281 if (workingIndex >= 0) {
282 RiskFactorKey key(k.first, k.second, newKeyIndex++);
283 auto iValue = interpolatedValue(c0->second, c1->second, indices, k, scenario);
284 TLOG("Add "<< key << " interpolated value = " << iValue);
285 result->add(key, iValue);
286 indices[workingIndex]++;
287 }
288 } while (workingIndex >= 0);
289 }
290 }
291 return result;
292}
+ Here is the caller graph for this function:

◆ recastScenario() [2/2]

QuantLib::ext::shared_ptr< Scenario > recastScenario ( const QuantLib::ext::shared_ptr< Scenario > &  scenario,
const std::map< std::pair< RiskFactorKey::KeyType, std::string >, std::vector< std::vector< Real > > > &  oldCoordinates,
const std::set< std::tuple< RiskFactorKey::KeyType, std::string, std::vector< std::vector< Real > > > > &  newCoordinates 
)

Definition at line 294 of file scenarioutilities.cpp.

297 {
298
299 std::map<std::pair<RiskFactorKey::KeyType, std::string>, std::vector<std::vector<Real>>> newCoordinatesMap;
300 for (const auto& [key, name, coordinates] : newCoordinates) {
301 newCoordinatesMap[{key, name}] = coordinates;
302 }
303 return recastScenario(scenario, oldCoordinates, newCoordinatesMap);
304}
+ Here is the call graph for this function:

◆ getShiftSpecKeys()

std::set< std::string > getShiftSpecKeys ( const SensitivityScenarioData d)

Definition at line 1077 of file sensitivityscenariodata.cpp.

1077 {
1078 std::set<std::string> pids;
1079 for (auto const& [_, v] : d.discountCurveShiftData())
1080 extractKeysFromShiftData(*v, pids);
1081 for (auto const& [_, v] : d.indexCurveShiftData())
1082 extractKeysFromShiftData(*v, pids);
1083 for (auto const& [_, v] : d.fxShiftData())
1084 extractKeysFromShiftData(v, pids);
1085 for (auto const& [_, v] : d.capFloorVolShiftData())
1086 extractKeysFromShiftData(*v, pids);
1087 for (auto const& [_, v] : d.swaptionVolShiftData())
1088 extractKeysFromShiftData(v, pids);
1089 for (auto const& [_, v] : d.yieldVolShiftData())
1090 extractKeysFromShiftData(v, pids);
1091 for (auto const& [_, v] : d.fxVolShiftData())
1092 extractKeysFromShiftData(v, pids);
1093 for (auto const& [_, v] : d.cdsVolShiftData())
1094 extractKeysFromShiftData(v, pids);
1095 for (auto const& [_, v] : d.baseCorrelationShiftData())
1096 extractKeysFromShiftData(v, pids);
1097 for (auto const& [_, v] : d.zeroInflationCurveShiftData())
1098 extractKeysFromShiftData(*v, pids);
1099 for (auto const& [_, v] : d.yoyInflationCapFloorVolShiftData())
1100 extractKeysFromShiftData(*v, pids);
1101 for (auto const& [_, v] : d.yoyInflationCapFloorVolShiftData())
1102 extractKeysFromShiftData(*v, pids);
1103 for (auto const& [_, v] : d.zeroInflationCapFloorVolShiftData())
1104 extractKeysFromShiftData(*v, pids);
1105 for (auto const& [_, v] : d.creditCurveShiftData())
1106 extractKeysFromShiftData(*v, pids);
1107 for (auto const& [_, v] : d.equityShiftData())
1108 extractKeysFromShiftData(v, pids);
1109 for (auto const& [_, v] : d.equityVolShiftData())
1110 extractKeysFromShiftData(v, pids);
1111 for (auto const& [_, v] : d.dividendYieldShiftData())
1112 extractKeysFromShiftData(*v, pids);
1113 for (auto const& [_, v] : d.commodityCurveShiftData())
1114 extractKeysFromShiftData(*v, pids);
1115 for (auto const& [_, v] : d.commodityVolShiftData())
1116 extractKeysFromShiftData(v, pids);
1117 for (auto const& [_, v] : d.correlationShiftData())
1118 extractKeysFromShiftData(v, pids);
1119 for (auto const& [_, v] : d.securityShiftData())
1120 extractKeysFromShiftData(v, pids);
1121 return pids;
1122}
const map< string, VolShiftData > & correlationShiftData() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ close()

bool close ( const Real &  t_1,
const Real &  t_2 
)

Definition at line 79 of file sensitivityscenariogenerator.cpp.

79{ return QuantLib::close(t_1, t_2); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vectorEqual()

bool vectorEqual ( const vector< Real > &  v_1,
const vector< Real > &  v_2 
)

Definition at line 81 of file sensitivityscenariogenerator.cpp.

81 {
82 return (v_1.size() == v_2.size() && std::equal(v_1.begin(), v_1.end(), v_2.begin(), close));
83}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [19/29]

std::ostream & operator<< ( ostream &  out,
const ShiftScenarioGenerator::ScenarioDescription scenarioDescription 
)

Definition at line 145 of file shiftscenariogenerator.cpp.

145 {
146 out << scenarioDescription.typeString();
147 if (scenarioDescription.factor1() != "")
148 out << ":" << scenarioDescription.factor1();
149 if (scenarioDescription.factor2() != "")
150 out << ":" << scenarioDescription.factor2();
151 return out;
152}
string factor2() const
Return key2 as string with text2 appended as key index description.
string factor1() const
Return key1 as string with text1 appended as key index description.
+ Here is the call graph for this function:

◆ deconstructFactor()

std::pair< RiskFactorKey, std::string > deconstructFactor ( const std::string &  factor)

Retrieve the RiskFactorKey and index description from the result of ScenarioDescription::factor1() or ScenarioDescription::factor2()

Definition at line 154 of file shiftscenariogenerator.cpp.

154 {
155
156 // If string is empty
157 if (factor.empty()) {
158 return make_pair(RiskFactorKey(), "");
159 }
160
161 boost::escaped_list_separator<char> sep('\\', '/', '\"');
162 boost::tokenizer<boost::escaped_list_separator<char> > tokenSplit(factor, sep);
163
164 vector<string> tokens(tokenSplit.begin(), tokenSplit.end());
165
166 // first 3 tokens are the risk factor key, the remainder are the description
167 ostringstream o;
168 if (tokens.size() > 3) {
169 o << tokens[3];
170 Size i = 4;
171 while (i < tokens.size()) {
172 o << "/" << tokens[i];
173 i++;
174 }
175 }
176
177 return make_pair(RiskFactorKey(parseRiskFactorKeyType(tokens[0]), tokens[1], parseInteger(tokens[2])), o.str());
178}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reconstructFactor()

std::string reconstructFactor ( const RiskFactorKey key,
const string &  desc 
)

Reconstruct the string description from a risk factor key and its index description desc.

Definition at line 180 of file shiftscenariogenerator.cpp.

180 {
181 // If risk factor is empty
182 if (key == RiskFactorKey()) {
183 return "";
184 }
185
186 // If valid risk factor
187 return to_string(key) + "/" + desc;
188}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRiskFactorKey() [2/2]

QuantLib::ext::shared_ptr< RiskFactorKey > parseRiskFactorKey ( const string &  str,
vector< string > &  addTokens 
)

risk factor key parser that takes into account additional tokens occurring in sensitivity risk factor keys

Definition at line 190 of file shiftscenariogenerator.cpp.

190 {
191 // Use deconstructFactor to split in to pair: [key, additional token str]
192 auto p = deconstructFactor(str);
193
194 // The additional tokens
195 boost::escaped_list_separator<char> sep('\\', '/', '\"');
196 boost::tokenizer<boost::escaped_list_separator<char> > tokenSplit(p.second, sep);
197
198 vector<string> tokens(tokenSplit.begin(), tokenSplit.end());
199 addTokens = tokens;
200
201 // Return the key value
202 return QuantLib::ext::make_shared<RiskFactorKey>(p.first.keytype, p.first.name, p.first.index);
203}
pair< RiskFactorKey, string > deconstructFactor(const string &factor)
+ Here is the call graph for this function:

◆ operator<() [2/4]

Definition at line 207 of file shiftscenariogenerator.hpp.

208 {
209 return std::tie(lhs.type(), lhs.key1(), lhs.key2()) < std::tie(rhs.type(), rhs.key1(), rhs.key2());
210}
+ Here is the call graph for this function:

◆ operator==() [2/2]

Definition at line 212 of file shiftscenariogenerator.hpp.

213 {
214 return lhs.type() == rhs.type() && lhs.key1() == rhs.key1() && lhs.indexDesc1() == rhs.indexDesc1() &&
215 lhs.key2() == rhs.key2() && lhs.indexDesc2() == rhs.indexDesc2();
216}
+ Here is the call graph for this function:

◆ curveShiftDataToXml()

void curveShiftDataToXml ( ore::data::XMLDocument doc,
XMLNode node,
const std::map< std::string, StressTestScenarioData::CurveShiftData > &  data,
const std::string &  identifier,
const std::string &  nodeName,
const std::string &  parentNodeName = std::string() 
)

Definition at line 295 of file stressscenariodata.cpp.

298 {
299 std::string name = parentNodeName.empty() ? nodeName + "s" : parentNodeName;
300 auto parentNode = XMLUtils::addChild(doc, node, name);
301 for (const auto& [key, data] : data) {
302 auto childNode = XMLUtils::addChild(doc, parentNode, nodeName);
303 XMLUtils::addAttribute(doc, childNode, identifier, key);
304 XMLUtils::addChild(doc, childNode, "ShiftType", ore::data::to_string(data.shiftType));
305 XMLUtils::addGenericChildAsList(doc, childNode, "Shifts", data.shifts);
306 XMLUtils::addGenericChildAsList(doc, childNode, "ShiftTenors", data.shiftTenors);
307 }
308}
data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ volShiftDataToXml()

void volShiftDataToXml ( ore::data::XMLDocument doc,
XMLNode node,
const std::map< std::string, StressTestScenarioData::VolShiftData > &  data,
const std::string &  identifier,
const std::string &  nodeName,
const std::string &  parentNodeName 
)

Definition at line 310 of file stressscenariodata.cpp.

312 {
313 auto parentNode = XMLUtils::addChild(doc, node, parentNodeName);
314 for (const auto& [key, data] : data) {
315 auto childNode = XMLUtils::addChild(doc, parentNode, nodeName);
316 XMLUtils::addAttribute(doc, childNode, identifier, key);
317 XMLUtils::addChild(doc, childNode, "ShiftType", ore::data::to_string(data.shiftType));
318 XMLUtils::addGenericChildAsList(doc, childNode, "Shifts", data.shifts);
319 XMLUtils::addGenericChildAsList(doc, childNode, "ShiftExpiries", data.shiftExpiries);
320 }
321}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ spotShiftDataToXml()

void spotShiftDataToXml ( ore::data::XMLDocument doc,
XMLNode node,
const std::map< std::string, StressTestScenarioData::SpotShiftData > &  data,
const std::string &  identifier,
const std::string &  nodeName 
)

Definition at line 323 of file stressscenariodata.cpp.

325 {
326 auto parentNode = XMLUtils::addChild(doc, node, nodeName + "s");
327 for (const auto& [key, data] : data) {
328 auto childNode = XMLUtils::addChild(doc, parentNode, nodeName);
329 XMLUtils::addAttribute(doc, childNode, identifier, key);
330 XMLUtils::addChild(doc, childNode, "ShiftType", ore::data::to_string(data.shiftType));
331 XMLUtils::addChild(doc, childNode, "ShiftSize", data.shiftSize);
332 }
333}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ periodToLabels2()

string periodToLabels2 ( const QuantLib::Period &  p)

Definition at line 30 of file crifconfiguration.cpp.

30 {
31 if ((p.units() == QuantLib::Months && p.length() == 3) || (p.units() == QuantLib::Weeks && p.length() == 13)) {
32 return "Libor3m";
33 } else if ((p.units() == QuantLib::Months && p.length() == 6) || (p.units() == QuantLib::Weeks && p.length() == 26)) {
34 return "Libor6m";
35 } else if ((p.units() == QuantLib::Days && p.length() == 1) || p == 1 * QuantLib::Weeks) {
36 // 7 days here is based on ISDA SIMM FAQ and Implementation Questions, Sep 4, 2019 Section E.9
37 // Sub curve to be used for CNY seven-day repo rate (closest is OIS).
38 return "OIS";
39 } else if ((p.units() == QuantLib::Months && p.length() == 1) || (p.units() == QuantLib::Weeks && p.length() == 2) ||
40 (p.units() == QuantLib::Weeks && p.length() == 4) || (p.units() == QuantLib::Days && p.length() >= 28 && p.length() <= 31)) {
41 // 2 weeks here is based on ISDA SIMM Methodology paragraph 14:
42 // "Any sub curve not given on the above list should be mapped to its closest equivalent."
43 // A 2 week rate is more like sub-period than OIS.
44 return "Libor1m";
45 } else if ((p.units() == QuantLib::Months && p.length() == 12) || (p.units() == QuantLib::Years && p.length() == 1) ||
46 (p.units() == QuantLib::Weeks && p.length() == 52)) {
47 return "Libor12m";
48 } else {
49 return "";
50 }
51}
+ Here is the caller graph for this function:

◆ operator<<() [20/29]

std::ostream & operator<< ( ostream &  out,
const CrifRecord::RiskType rt 
)

Definition at line 104 of file crifrecord.cpp.

104 {
105 QL_REQUIRE(riskTypeMap.left.count(rt) > 0,
106 "Risk type (" << static_cast<int>(rt) << ") not a valid CrifRecord::RiskType");
107 return out << riskTypeMap.left.at(rt);
108}

◆ operator<<() [21/29]

std::ostream & operator<< ( ostream &  out,
const CrifRecord::ProductClass pc 
)

Definition at line 110 of file crifrecord.cpp.

110 {
111 QL_REQUIRE(productClassMap.left.count(pc) > 0,
112 "Product class (" << static_cast<int>(pc) << ") not a valid CrifRecord::ProductClass");
113 return out << productClassMap.left.at(pc);
114}
const bm< CrifRecord::ProductClass > productClassMap
Definition: crifrecord.cpp:95

◆ parseRiskType()

CrifRecord::RiskType parseRiskType ( const string &  rt)

Definition at line 117 of file crifrecord.cpp.

117 {
118 for (auto it = riskTypeMap.right.begin(); it != riskTypeMap.right.end(); it++) {
119 if (boost::to_lower_copy(rt) == boost::to_lower_copy(it->first))
120 return it->second;
121 }
122
123 // If we reach this point, then the risk type provided was not found
124 QL_FAIL("Risk type string " << rt << " does not correspond to a valid CrifRecord::RiskType");
125}
+ Here is the caller graph for this function:

◆ parseProductClass()

CrifRecord::ProductClass parseProductClass ( const string &  pc)

Definition at line 127 of file crifrecord.cpp.

127 {
128 for (auto it = productClassMap.right.begin(); it != productClassMap.right.end(); it++) {
129 if (boost::to_lower_copy(pc) == boost::to_lower_copy(it->first))
130 return it->second;
131 }
132
133 // If we reach this point, then the product class provided was not found
134 QL_FAIL("Product class string " << pc << " does not correspond to a valid CrifRecord::ProductClass");
135}
+ Here is the caller graph for this function:

◆ operator<<() [22/29]

std::ostream & operator<< ( std::ostream &  out,
const CrifRecord::CurvatureScenario scenario 
)

Definition at line 137 of file crifrecord.cpp.

137 {
138 switch(scenario){
139 case CrifRecord::CurvatureScenario::Down:
140 out << "CurvatureDown";
141 break;
142 case CrifRecord::CurvatureScenario::Up:
143 out << "CurvatureUp";
144 break;
145 default:
146 out << "";
147 break;
148 }
149 return out;
150}

◆ parseFrtbCurvatureScenario()

CrifRecord::CurvatureScenario parseFrtbCurvatureScenario ( const std::string &  scenario)

Definition at line 152 of file crifrecord.cpp.

152 {
153 if (scenario == "CurvatureDown") {
154 return CrifRecord::CurvatureScenario::Down;
155 } else if (scenario == "CurvatureUp") {
156 return CrifRecord::CurvatureScenario::Up;
157 } else {
158 return CrifRecord::CurvatureScenario::Empty;
159 }
160}

◆ operator<<() [23/29]

std::ostream & operator<< ( ostream &  out,
const CrifRecord cr 
)

Enable writing of a CrifRecord.

Definition at line 164 of file crifrecord.cpp.

164 {
166 if (n.empty()) {
167 out << "[" << cr.tradeId << ", " << cr.portfolioId << ", " << cr.productClass << ", " << cr.riskType
168 << ", " << cr.qualifier << ", " << cr.bucket << ", " << cr.label1 << ", " << cr.label2 << ", "
169 << cr.amountCurrency << ", " << cr.amount << ", " << cr.amountUsd;
170 } else {
171 out << "[" << cr.tradeId << ", [" << n << "], " << cr.productClass << ", " << cr.riskType << ", "
172 << cr.qualifier << ", " << cr.bucket << ", " << cr.label1 << ", " << cr.label2 << ", "
173 << cr.amountCurrency << ", " << cr.amount << ", " << cr.amountUsd;
174 }
175
176 if (!cr.collectRegulations.empty())
177 out << ", collect_regulations=" << cr.collectRegulations;
178 if (!cr.postRegulations.empty())
179 out << ", post_regulations=" << cr.postRegulations;
180
181 out << "]";
182
183 return out;
184}
NettingSetDetails nettingSetDetails
Definition: crifrecord.hpp:156
+ Here is the call graph for this function:

◆ operator<() [3/4]

bool operator< ( const SimmBucketMapper::FailedMapping a,
const SimmBucketMapper::FailedMapping b 
)

◆ operator<() [4/4]

bool operator< ( const BucketMapping a,
const BucketMapping b 
)

Definition at line 69 of file simmbucketmapperbase.cpp.

69 {
70 return a.name() < b.name();
71}
+ Here is the call graph for this function:

◆ operator<<() [24/29]

std::ostream & operator<< ( ostream &  out,
const SimmConfiguration::SimmSide s 
)

Definition at line 236 of file simmconfiguration.cpp.

236 {
237 string side = s == SimmConfiguration::SimmSide::Call ? "Call" : "Post";
238 return out << side;
239}

◆ operator<<() [25/29]

std::ostream & operator<< ( ostream &  out,
const SimmConfiguration::RiskClass rc 
)

Definition at line 241 of file simmconfiguration.cpp.

241 {
242 QL_REQUIRE(riskClassMap.left.count(rc) > 0,
243 "Risk class (" << static_cast<int>(rc) << ") not a valid SimmConfiguration::RiskClass");
244 return out << riskClassMap.left.at(rc);
245}

◆ operator<<() [26/29]

std::ostream & operator<< ( ostream &  out,
const SimmConfiguration::MarginType mt 
)

Definition at line 247 of file simmconfiguration.cpp.

247 {
248 QL_REQUIRE(marginTypeMap.left.count(mt) > 0,
249 "Margin type (" << static_cast<int>(mt) << ") not a valid SimmConfiguration::MarginType");
250 return out << marginTypeMap.left.at(mt);
251}
const bm< SimmConfiguration::MarginType > marginTypeMap

◆ operator<<() [27/29]

std::ostream & operator<< ( ostream &  out,
const SimmConfiguration::IMModel model 
)

Definition at line 253 of file simmconfiguration.cpp.

253 {
254 QL_REQUIRE(imModelMap.left.count(model) > 0, "Product class not a valid SimmConfiguration::IMModel");
255 if (model == SimmConfiguration::IMModel::SIMM_P || model == SimmConfiguration::IMModel::SIMM_R)
256 return out << "SIMM";
257 else
258 return out << imModelMap.left.at(model);
259}
const bm< SimmConfiguration::IMModel > imModelMap

◆ operator<<() [28/29]

std::ostream & operator<< ( ostream &  out,
const SimmConfiguration::Regulation regulation 
)

Definition at line 261 of file simmconfiguration.cpp.

261 {
262 QL_REQUIRE(regulationsMap.left.count(regulation) > 0, "Product class not a valid SimmConfiguration::Regulation");
263 return out << regulationsMap.left.at(regulation);
264}
const bm< SimmConfiguration::Regulation > regulationsMap

◆ parseSimmSide()

SimmConfiguration::SimmSide parseSimmSide ( const string &  side)

Definition at line 266 of file simmconfiguration.cpp.

266 {
267 if (side == "Call") {
268 return SimmConfiguration::SimmSide::Call;
269 } else if (side == "Post") {
270 return SimmConfiguration::SimmSide::Post;
271 } else {
272 QL_FAIL("Could not parse the string '" << side << "' to a SimmSide");
273 }
274}

◆ parseSimmRiskClass()

SimmConfiguration::RiskClass parseSimmRiskClass ( const string &  rc)

Definition at line 276 of file simmconfiguration.cpp.

276 {
277 QL_REQUIRE(riskClassMap.right.count(rc) > 0,
278 "Risk class string " << rc << " does not correspond to a valid SimmConfiguration::RiskClass");
279 return riskClassMap.right.at(rc);
280}

◆ parseSimmMarginType()

SimmConfiguration::MarginType parseSimmMarginType ( const string &  mt)

Definition at line 282 of file simmconfiguration.cpp.

282 {
283 QL_REQUIRE(marginTypeMap.right.count(mt) > 0,
284 "Margin type string " << mt << " does not correspond to a valid SimmConfiguration::MarginType");
285 return marginTypeMap.right.at(mt);
286}

◆ parseIMModel()

SimmConfiguration::IMModel parseIMModel ( const string &  model)

Definition at line 288 of file simmconfiguration.cpp.

288 {
289 for (auto it = imModelMap.right.begin(); it != imModelMap.right.end(); it++) {
290 if (boost::to_lower_copy(model) == boost::to_lower_copy(it->first))
291 return it->second;
292 }
293
294 // If we reach this point, then the IM modelprovided was not found
295 QL_FAIL("IM model string " << model << " does not correspond to a valid SimmConfiguration::IMModel");
296}
+ Here is the caller graph for this function:

◆ parseRegulation()

SimmConfiguration::Regulation parseRegulation ( const string &  regulation)

Definition at line 298 of file simmconfiguration.cpp.

298 {
299 if (regulationsMap.right.count(regulation) == 0) {
300 return SimmConfiguration::Regulation::Invalid;
301 } else {
302 return regulationsMap.right.at(regulation);
303 }
304}
+ Here is the caller graph for this function:

◆ combineRegulations()

std::string combineRegulations ( const string &  regs1,
const string &  regs2 
)

Definition at line 306 of file simmconfiguration.cpp.

306 {
307 if (regs1.empty())
308 return regs2;
309 if (regs2.empty())
310 return regs1;
311
312 return regs1 + ',' + regs2;
313}

◆ parseRegulationString()

std::set< std::string > parseRegulationString ( const string &  regsString,
const set< string > &  valueIfEmpty 
)

Reads a string containing regulations applicable for a given CRIF record.

Definition at line 315 of file simmconfiguration.cpp.

315 {
316 set<string> uniqueRegNames;
317
318 // "," is a delimiter; "[" and "]" are possible characters, but are not needed in processing
319 vector<string> regNames;
320 boost::split(regNames, regsString, boost::is_any_of(",[] "));
321
322 // Remove any resultant blank strings
323 regNames.erase(std::remove(regNames.begin(), regNames.end(), ""), regNames.end());
324
325 // One last trim for good measure
326 for (string& r : regNames)
327 boost::trim(r);
328
329 // Sort the elements to prevent different permutations of the same regulations being treated differently
330 // e.g. "APRA,USPR" and "USPR,APRA" should ultimately be treated as the same.
331 std::sort(regNames.begin(), regNames.end());
332
333 uniqueRegNames = set<string>(regNames.begin(), regNames.end());
334
335 // If no (valid) regulations provided, we consider the regulation to be unspecified
336 if (uniqueRegNames.empty())
337 return valueIfEmpty;
338 else
339 return uniqueRegNames;
340}
+ Here is the caller graph for this function:

◆ sortRegulationString()

std::string sortRegulationString ( const std::string &  regsString)

Cleans a string defining regulations so that different permutations of the same set will be seen as the same string, e.g. "APRA,SEC,ESA" and "SEC,ESA,APRA" should be equivalent.

Definition at line 342 of file simmconfiguration.cpp.

342 {
343 // This method will sort the regulations
344 set<string> uniqueRegNames = parseRegulationString(regsString);
345
346 if (uniqueRegNames.size() == 0 ||
347 (uniqueRegNames.size() == 1 && uniqueRegNames.count("Unspecified") > 0)) {
348 return string();
349 } else {
350 return boost::algorithm::join(uniqueRegNames, ",");
351 }
352}
set< string > parseRegulationString(const string &regsString, const set< string > &valueIfEmpty)
Reads a string containing regulations applicable for a given CRIF record.
+ Here is the call graph for this function:

◆ removeRegulations()

std::string removeRegulations ( const string &  regsString,
const vector< string > &  regsToRemove 
)

Removes a given vector of regulations from a string of regulations and returns a string with the regulations removed.

Definition at line 354 of file simmconfiguration.cpp.

354 {
355 set<string> uniqueRegNames = parseRegulationString(regsString);
356
357 for (const string& r : regsToRemove) {
358 auto it = uniqueRegNames.find(r);
359 if (it != uniqueRegNames.end())
360 uniqueRegNames.erase(it);
361 }
362
363 if (!uniqueRegNames.empty())
364 return boost::algorithm::join(uniqueRegNames, ",");
365 else
366 return string();
367}
+ Here is the call graph for this function:

◆ filterRegulations()

std::string filterRegulations ( const std::string &  regsString,
const std::vector< std::string > &  regsToFilter 
)

Filters a string of regulations on a given vector of regulations and returns a string containing only those filtered regulations

Definition at line 369 of file simmconfiguration.cpp.

369 {
370 set<string> uniqueRegNames = parseRegulationString(regsString);
371 set<string> filteredRegs;
372
373 for (const string& r : uniqueRegNames) {
374 auto it = std::find(regsToFilter.begin(), regsToFilter.end(), r);
375 if (it != regsToFilter.end())
376 filteredRegs.insert(*it);
377 }
378
379 if (!filteredRegs.empty())
380 return boost::algorithm::join(filteredRegs, ",");
381 else
382 return string();
383}
+ Here is the call graph for this function:

◆ getWinningRegulation()

SimmConfiguration::Regulation getWinningRegulation ( const std::vector< string > &  winningRegulations)

From a vector of regulations, determine the winning regulation based on order of priority.

Definition at line 385 of file simmconfiguration.cpp.

385 {
386
387 vector<SimmConfiguration::Regulation> mappedRegulations;
388
389 for (const string& reg : winningRegulations)
390 mappedRegulations.push_back(parseRegulation(reg));
391
392 SimmConfiguration::Regulation winningRegulation = mappedRegulations.front();
393 for (const auto& reg : mappedRegulations) {
394 if (reg < winningRegulation)
395 winningRegulation = reg;
396 }
397
398 return winningRegulation;
399}
SimmConfiguration::Regulation parseRegulation(const string &regulation)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<() [29/29]

std::ostream & operator<< ( ostream &  out,
const SimmResults::Key k 
)

Enable writing of Key.

Definition at line 115 of file simmresults.cpp.

115 {
116 return out << "[" << get<0>(k) << ", " << get<1>(k) << ", " << get<2>(k) << ", " << get<3>(k) << "]";
117}

◆ loadFactorList()

std::vector< std::string > loadFactorList ( const std::string &  inputFileName,
const char  delim 
)

Definition at line 55 of file utilities.cpp.

55 {
56 LOG("Load factor list from file " << inputFileName);
57 std::ifstream file;
58 file.open(inputFileName);
59 QL_REQUIRE(file.is_open(), "error opening file " << inputFileName);
60 std::vector<string> result;
61 try {
62 while (!file.eof()) {
63 std::string line;
64 getline(file, line, delim);
65 if (line.size() == 0)
66 continue;
67 result.push_back(line);
68 }
69 } catch (std::exception& e) {
70 file.close();
71 QL_FAIL("error during reading file: " << e.what());
72 }
73
74 LOG("Loaded factor list of size " << result.size());
75 return result;
76} // loadFactorList

◆ loadScenarios()

std::vector< std::vector< double > > loadScenarios ( const std::string &  inputFileName,
const char  delim 
)

Definition at line 78 of file utilities.cpp.

78 {
79 LOG("Load scenarios from file " << inputFileName);
80 std::ifstream file;
81 file.open(inputFileName);
82 QL_REQUIRE(file.is_open(), "error opening file " << inputFileName);
83 std::vector<std::vector<double>> result;
84 try {
85 while (!file.eof()) {
86 Size currentScenario = Null<Size>(); //, currentFactor;// = Null<Size>();
87 std::string line;
88 getline(file, line, delim);
89 if (line.size() == 0)
90 continue;
91 std::vector<string> tokens;
92 boost::trim(line);
93 boost::split(tokens, line, boost::is_any_of(",;\t "), boost::token_compress_off);
94 QL_REQUIRE(tokens.size() == 3, "loadScenarios, expected 3 tokens in line: " << line);
95 Size tmpSc = parseInteger(tokens[0]);
96 // Size tmpFc = parseInteger(tokens[1]);
97 if (currentScenario != tmpSc) {
98 result.push_back(std::vector<double>());
99 currentScenario = tmpSc;
100 }
101 // currentFactor = tmpFc;
102 double move = parseReal(tokens[2]);
103 result.back().push_back(move);
104 }
105 } catch (std::exception& e) {
106 file.close();
107 QL_FAIL("error during reading file: " << e.what());
108 }
109
110 LOG("Loaded " << result.size() << " scenarios, first entry contains " << result.front().size() << " factors");
111 return result;
112} // loadScenarios
+ Here is the call graph for this function:

◆ loadCovarianceMatrix()

QuantLib::Matrix loadCovarianceMatrix ( const std::string &  inputFileName,
const char  delim 
)

Definition at line 114 of file utilities.cpp.

114 {
115 LOG("Load covariance matrix from file " << inputFileName);
116 std::ifstream file;
117 file.open(inputFileName);
118 QL_REQUIRE(file.is_open(), "error opening file " << inputFileName);
119 std::vector<std::pair<Size, Size>> pos;
120 std::vector<double> val;
121 Size maxI = 0, maxJ = 0;
122 try {
123 while (!file.eof()) {
124 std::string line;
125 getline(file, line, delim);
126 if (line.size() == 0)
127 continue;
128 std::vector<string> tokens;
129 boost::trim(line);
130 boost::split(tokens, line, boost::is_any_of(",;\t "), boost::token_compress_off);
131 QL_REQUIRE(tokens.size() == 3, "loadCovarianceMatrix, expected 3 tokens in line: " << line);
132 Size i = parseInteger(tokens[0]);
133 Size j = parseInteger(tokens[1]);
134 double tmp = parseReal(tokens[2]);
135 pos.push_back(std::make_pair(i, j));
136 val.push_back(tmp);
137 maxI = std::max(maxI, i);
138 maxJ = std::max(maxJ, j);
139 }
140 } catch (std::exception& e) {
141 file.close();
142 QL_FAIL("error during reading file: " << e.what());
143 }
144
145 LOG("Loaded " << val.size() << " data points, dimension of matrix is " << maxI + 1 << "x" << maxJ + 1);
146 QL_REQUIRE(maxI == maxJ, "Expected quadratic matrix");
147
148 Matrix result(maxI + 1, maxI + 1);
149 for (Size i = 0; i < pos.size(); ++i) {
150 result[pos[i].first][pos[i].second] = val[i];
151 result[pos[i].second][pos[i].first] = val[i];
152 }
153
154 // log the eigenvalues
155 QuantLib::SymmetricSchurDecomposition ssd(result);
156 for (Size i = 0; i < ssd.eigenvalues().size(); ++i) {
157 LOG("Eigenvalue " << i << " = " << ssd.eigenvalues()[i]);
158 }
159 return result;
160} // load CovarianceMatrix
Size size(const ValueType &v)
+ Here is the call graph for this function:

◆ parseSimmVersion()

SimmVersion parseSimmVersion ( const string &  version)

Definition at line 162 of file utilities.cpp.

162 {
163 static map<string, SimmVersion> versionMap = {{"1.0", SimmVersion::V1_0},
164 {"1.1", SimmVersion::V1_1},
165 {"1.2", SimmVersion::V1_2},
166 {"1.3", SimmVersion::V1_3},
167 {"1.3.38", SimmVersion::V1_3_38},
168 {"2.0", SimmVersion::V2_0},
169 {"2.1", SimmVersion::V2_1},
170 {"2.2", SimmVersion::V2_2},
171 {"2.3", SimmVersion::V2_3},
172 {"2.3.8", SimmVersion::V2_3_8},
173 {"2.5", SimmVersion::V2_5},
174 {"2.5A", SimmVersion::V2_5A},
175 {"2.5.6", SimmVersion::V2_6},
176 // alias
177 {"2.4", SimmVersion::V2_3_8},
178 {"2.6", SimmVersion::V2_6},
179 // old names for backwards compatibility
180 {"ISDA_V315", SimmVersion::V1_0},
181 {"ISDA_V329", SimmVersion::V1_3},
182 {"ISDA_V338", SimmVersion::V1_3_38},
183 {"ISDA_V344", SimmVersion::V2_0}};
184
185 QL_REQUIRE(versionMap.count(version) > 0,
186 "Could not parse SIMM version string " << version << " to a valid version");
187
188 return versionMap.at(version);
189}
+ Here is the caller graph for this function:

◆ buildSimmConfiguration() [1/2]

QuantLib::ext::shared_ptr< SimmConfiguration > buildSimmConfiguration ( const string &  simmVersion,
const QuantLib::ext::shared_ptr< SimmBucketMapper > &  simmBucketMapper,
const QuantLib::ext::shared_ptr< SimmCalibrationData > &  simmCalibrationData,
const Size &  mporDays 
)

Definition at line 191 of file utilities.cpp.

194 {
195
196 // Check first if the SIMM calibration has the requested simmVersion
197 if (simmCalibrationData) {
198 const auto& simmCalibration = simmCalibrationData->getBySimmVersion(simmVersion);
199 if (simmCalibration) {
200 auto simmConfiguration = QuantLib::ext::make_shared<SimmConfigurationCalibration>(simmBucketMapper, simmCalibration, mporDays);
201 return simmConfiguration;
202 }
203 }
204
205 auto version = parseSimmVersion(simmVersion);
206
207 switch (version) {
208 case SimmVersion::V1_0:
209 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V1_0>(simmBucketMapper);
210 break;
211 case SimmVersion::V1_3:
212 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V1_3>(simmBucketMapper);
213 break;
214 case SimmVersion::V1_3_38:
215 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V1_3_38>(simmBucketMapper);
216 break;
217 case SimmVersion::V2_0:
218 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_0>(simmBucketMapper);
219 break;
220 case SimmVersion::V2_1:
221 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_1>(simmBucketMapper);
222 break;
223 case SimmVersion::V2_2:
224 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_2>(simmBucketMapper, mporDays);
225 break;
226 case SimmVersion::V2_3:
227 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_3>(simmBucketMapper, mporDays);
228 break;
229 case SimmVersion::V2_3_8:
230 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_3_8>(simmBucketMapper, mporDays);
231 break;
232 case SimmVersion::V2_5:
233 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_5>(simmBucketMapper, mporDays);
234 break;
235 case SimmVersion::V2_5A:
236 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_5A>(simmBucketMapper, mporDays);
237 break;
238 case SimmVersion::V2_6:
239 return QuantLib::ext::make_shared<SimmConfiguration_ISDA_V2_6>(simmBucketMapper, mporDays);
240 break;
241 default:
242 break;
243 }
244
245 QL_FAIL("SIMM configuration for version '" << simmVersion << "' cannot be built");
246}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ escapeCommaSeparatedList()

std::string escapeCommaSeparatedList ( const std::string &  str,
const char &  csvQuoteChar 
)

If the input str is a comma seperated list the method quotation marks " if the csvQuoteChar is '\0' Example: commaSeparatedListToJsonArrayString("item1,item2", '') -> "item1, item2" commaSeparatedListToJsonArrayString("item", '') -> "item"

Definition at line 248 of file utilities.cpp.

248 {
249 std::string result = str;
250 if (result.find(',') != string::npos && csvQuoteChar == '\0') {
251 result = '\"' + result + '\"';
252 }
253 return result;
254}
+ Here is the caller graph for this function:

◆ buildSimmConfiguration() [2/2]

QuantLib::ext::shared_ptr< SimmConfiguration > buildSimmConfiguration ( const std::string &  simmVersion,
const QuantLib::ext::shared_ptr< SimmBucketMapper > &  simmBucketMapper,
const QuantLib::ext::shared_ptr< SimmCalibrationData > &  simmCalibrationData = nullptr,
const QuantExt::Size &  mporDays = 10 
)

◆ nextValidFixingDate()

Date nextValidFixingDate ( Date  d,
const QuantLib::ext::shared_ptr< Index > &  index,
Size  gap = 7 
)

Definition at line 51 of file fixingmanager.cpp.

51 {
52 Date adjusted = d;
53 for (Size i = 0; i <= gap; ++i) {
54 adjusted = d + i;
55 if (index->isValidFixingDate(adjusted))
56 return adjusted;
57 }
58 QL_FAIL("no valid fixing date found for index " << index->name() << " within gap from " << io::iso_date(d));
59}
+ Here is the caller graph for this function:

Variable Documentation

◆ riskClassMap

const bm< SimmConfiguration::RiskClass > riskClassMap
Initial value:
= list_of<bm<MarketRiskConfiguration::RiskClass>::value_type>(
MarketRiskConfiguration::RiskClass::All, "All")
(MarketRiskConfiguration::RiskClass::InterestRate, "InterestRate")
(MarketRiskConfiguration::RiskClass::Inflation, "Inflation")
(MarketRiskConfiguration::RiskClass::Credit, "Credit")
(MarketRiskConfiguration::RiskClass::Equity, "Equity")
(MarketRiskConfiguration::RiskClass::FX, "FX")

Definition at line 45 of file riskfilter.cpp.

◆ riskTypeMap

const bm< CrifRecord::RiskType > riskTypeMap
Initial value:
= list_of<bm<MarketRiskConfiguration::RiskType>::value_type>(
MarketRiskConfiguration::RiskType::All, "All")(
MarketRiskConfiguration::RiskType::DeltaGamma, "DeltaGamma")(MarketRiskConfiguration::RiskType::Vega, "Vega")(
MarketRiskConfiguration::RiskType::BaseCorrelation, "BaseCorrelation")

Definition at line 53 of file riskfilter.cpp.

◆ isSimmParameter

auto isSimmParameter = [](const ore::analytics::CrifRecord& x) { return x.isSimmParameter(); }

Definition at line 38 of file crif.cpp.

◆ isNotSimmParameter

auto isNotSimmParameter = std::not_fn(isSimmParameter)

Definition at line 39 of file crif.cpp.

◆ productClassMap

const bm<CrifRecord::ProductClass> productClassMap
Initial value:
= boost::assign::list_of<bm<CrifRecord::ProductClass>::value_type>(
CrifRecord::ProductClass::RatesFX, "RatesFX")(CrifRecord::ProductClass::Rates, "Rates")(
CrifRecord::ProductClass::FX, "FX")(CrifRecord::ProductClass::Credit, "Credit")(
CrifRecord::ProductClass::Equity, "Equity")(CrifRecord::ProductClass::Commodity, "Commodity")(
CrifRecord::ProductClass::Other, "Other")(CrifRecord::ProductClass::Empty, "")(
CrifRecord::ProductClass::All, "All")(CrifRecord::ProductClass::AddOnNotionalFactor, "AddOnNotionalFactor")(
CrifRecord::ProductClass::AddOnFixedAmount, "AddOnFixedAmount")

Definition at line 95 of file crifrecord.cpp.

◆ nonVolRiskTypeMap

const map<RiskType, RiskType> nonVolRiskTypeMap
Initial value:
= {{RiskType::IRVol, RiskType::IRCurve},
{RiskType::InflationVol, RiskType::IRCurve},
{RiskType::CreditVol, RiskType::CreditQ},
{RiskType::CreditVolNonQ, RiskType::CreditNonQ},
{RiskType::EquityVol, RiskType::Equity},
{RiskType::CommodityVol, RiskType::Commodity}}

Definition at line 45 of file simmbucketmapperbase.cpp.

◆ marginTypeMap

const bm<SimmConfiguration::MarginType> marginTypeMap
Initial value:
=
list_of<bm<SimmConfiguration::MarginType>::value_type>(SimmConfiguration::MarginType::Delta, "Delta")(
SimmConfiguration::MarginType::Vega, "Vega")(SimmConfiguration::MarginType::Curvature, "Curvature")(
SimmConfiguration::MarginType::BaseCorr, "BaseCorr")(SimmConfiguration::MarginType::AdditionalIM, "AdditionalIM")(
SimmConfiguration::MarginType::All, "All")

Definition at line 66 of file simmconfiguration.cpp.

◆ imModelMap

const bm<SimmConfiguration::IMModel> imModelMap
Initial value:
=
list_of<bm<SimmConfiguration::IMModel>::value_type>(SimmConfiguration::IMModel::Schedule, "Schedule")(
SimmConfiguration::IMModel::SIMM, "SIMM")(SimmConfiguration::IMModel::SIMM_P, "SIMM-P")(
SimmConfiguration::IMModel::SIMM_R, "SIMM-R")

Definition at line 72 of file simmconfiguration.cpp.

◆ regulationsMap

const bm<SimmConfiguration::Regulation> regulationsMap
Initial value:
= list_of<bm<SimmConfiguration::Regulation>::value_type>(SimmConfiguration::Regulation::APRA, "APRA")
(SimmConfiguration::Regulation::CFTC, "CFTC")(SimmConfiguration::Regulation::ESA, "ESA")(SimmConfiguration::Regulation::FINMA, "FINMA")
(SimmConfiguration::Regulation::KFSC, "KFSC")(SimmConfiguration::Regulation::HKMA, "HKMA")(SimmConfiguration::Regulation::JFSA, "JFSA")
(SimmConfiguration::Regulation::MAS, "MAS")(SimmConfiguration::Regulation::OSFI, "OSFI")(SimmConfiguration::Regulation::RBI, "RBI")
(SimmConfiguration::Regulation::SEC, "SEC")(SimmConfiguration::Regulation::SEC_unseg, "SEC-unseg")(SimmConfiguration::Regulation::USPR, "USPR")
(SimmConfiguration::Regulation::NONREG, "NONREG")(SimmConfiguration::Regulation::BACEN, "BACEN")(SimmConfiguration::Regulation::SANT, "SANT")
(SimmConfiguration::Regulation::SFC, "SFC")(SimmConfiguration::Regulation::UK, "UK")(SimmConfiguration::Regulation::AMFQ, "AMFQ")
(SimmConfiguration::Regulation::Included, "Included")(SimmConfiguration::Regulation::Unspecified, "Unspecified")(SimmConfiguration::Regulation::Invalid, "Invalid")

Definition at line 77 of file simmconfiguration.cpp.