Class AScalarMarketDataPostProcessor
- java.lang.Object
-
- com.quartetfs.biz.pivot.postprocessing.impl.AAdvancedPostProcessor<OutputType>
-
- com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor<Double>
-
- com.activeviam.risk.core.postprocessor.impl.AScalarMarketDataPostProcessor
-
- All Implemented Interfaces:
IMaturityConverterAware
,IPnLExplainFormulaProviderAware
,com.quartetfs.biz.pivot.postprocessing.IAggregatedMeasureAware
,com.quartetfs.biz.pivot.postprocessing.IBasicPostProcessor<Double>
,com.quartetfs.biz.pivot.postprocessing.IEvaluator<Double>
,com.quartetfs.biz.pivot.postprocessing.IPartitionedPostProcessor<Double>
,com.quartetfs.biz.pivot.postprocessing.IPostProcessor<Double>
,com.quartetfs.fwk.types.IExtendedPluginValue
,Serializable
- Direct Known Subclasses:
ScalarMarketDataPostProcessor
public abstract class AScalarMarketDataPostProcessor extends com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor<Double> implements IMaturityConverterAware, IPnLExplainFormulaProviderAware
Abstract Post-processor used to get market data for current and previous date values. It is implemented by DeltaGamma and Vega market data postprocessors.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BUCKET_TYPES
static String
DATE_INFO
protected String
dateProperty
protected String
identifier
static String
INTERPOLATION_ORDER
static String
KEY_LEAF_LEVELS
static String
MARKET_DATA_STORE_FIELDS
static String
MARKET_DATA_STORE_NAME
protected List<String>
marketDataFields
protected String
marketDataStoreName
static String
MAX_FALLBACK_DAYS
protected int
maxFallbackDays
static String
MONEYNESS_DEFAULT_VALUE
static int
NB_LEAF_LEVELS_WITHOUT_TENORS
protected IPnLExplainFormulaProvider
provider
static String
SENSITIVITY_NAME_PROPERTY
protected String
sensitivityName
static String
TENOR_AND_MATURITY_DEFAULT_VALUE
-
Fields inherited from class com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor
BASIC_POST_PROCESSOR_PREFETCHER, isPartitionedOnRangeLevels
-
Fields inherited from class com.quartetfs.biz.pivot.postprocessing.impl.AAdvancedPostProcessor
aggregatedMeasureName, ANALYSIS_LEVELS_PROPERTY, analysisLevelsToExpand, continuousQueryHandlerKeys, derivedContextDependencies, evaluator, EVALUATOR, explicitContextDependencies, logger, measuresProvider, name, OUTPUT_TYPE, outputType, pivot, prefetchers, PRINT_TIMINGS, printTimings, properties, underlyingMeasures
-
Fields inherited from interface com.activeviam.risk.core.dates.IMaturityConverterAware
PROPERTY_NAME
-
Fields inherited from interface com.quartetfs.biz.pivot.postprocessing.IPartitionedPostProcessor
DEFAULT_PARTITIONING_ON_RANGE_LEVELS
-
Fields inherited from interface com.activeviam.risk.core.services.IPnLExplainFormulaProviderAware
PROPERTY_NAME
-
-
Constructor Summary
Constructors Constructor Description AScalarMarketDataPostProcessor(String name, com.quartetfs.biz.pivot.cube.hierarchy.measures.IPostProcessorCreationContext creationContext)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Double
doEvaluate(com.quartetfs.biz.pivot.ILocation leafLocation, LocalDate asOfDate, String marketDataSet, String riskFactor, Object[] primaryMembers, Object[] secondaryMembers, List<BiFunction<Double,Double,Double>> preInterpolationCalcs, List<BiFunction<Double,Double,Double>> postInterpolationCalcs, int[] interpolationOrder, boolean interpolate)
Double
evaluate(com.quartetfs.biz.pivot.ILocation leafLocation, Object[] underlyingMeasures)
There is only one underlying measure here: the Double Sensi Value .protected Optional<com.qfs.store.record.IRecordReader>
fetchMarketData(com.qfs.store.IDatastoreVersion datastoreVersion, String marketDataStoreName, LocalDate date, String marketDataSet, String riskFactor, Object[] labels, Object[] dates, List<String> marketDataFields)
Attempts to fetch a market data record by its key.boolean
getEnableMDStringDebug()
protected Optional<com.qfs.store.record.IRecordReader>
getMarketDataRecord(LocalDate date, String marketDataSet, String riskFactor, Object[] primaryMembers, Object[] secondaryMembers)
Method that retrieves the market data for the current dayprotected static com.activeviam.desc.build.ICanStartBuildingMeasures.BuildablePostProcessorBuilder
getPostProcessorDescription(com.activeviam.desc.build.ICanStartBuildingMeasures builder, String pluginKey, String measureName, String underlyingMeasures, String asOfDateLevel, String marketDataSetLevel, String riskFactorLevel, String riskClassLevel, String[] primaryLevels, String[] secondaryLevels, Integer maxFallbackDays, String dateInfo, String sensitivityName, String marketDataStoreName, String[] marketDataStoreFields, BucketType[] bucketTypes, String tenorAndMaturityDefaultValue, String moneynessDefaultValue, int[] interpolationOrder, String interpolationDebugStringIdentifier, String formatter, String folder)
This will create a PP configurationvoid
init(Properties properties)
Three custom property needs to be present in the configuration of the post-processor: keyLeafLevels: It's the value representing the key levels: AsOfDate, Risk Factor e.g.
"AsOfDate@Date@Dates", "RiskFactor@Risk Factor@Risk" * DateInfo: its value is the string representing the date property (either current date or precious date) e.g.
"currentDate" SensitivityName: its value is the string representing the sensi type, e.g.
"Delta", "Vega", "Gamma" * MaxFallback days: its value is the string representing the maximum fallback days for previous date market data.protected com.quartetfs.fwk.impl.Pair<Double,String>
interpolate(com.quartetfs.biz.pivot.ILocation location, String marketDataSet, LocalDate asOfDate, String riskFactor, List<BiFunction<Double,Double,Double>> preInterpolationCalcs, List<BiFunction<Double,Double,Double>> postInterpolationCalcs, int[] interpolationOrder, boolean enableDebugString)
Return the interpolated valueprotected static com.activeviam.copper.api.CopperMeasure
measure(String pluginKey, com.activeviam.copper.api.CopperMeasure underlyingMeasures, String asOfDateLevel, String marketDataSetLevel, String riskFactorLevel, String riskClassLevel, String[] primaryLevels, String[] secondaryLevels, Integer maxFallbackDays, String dateInfo, String sensitivityName, String marketDataStoreName, String[] marketDataStoreFields, BucketType[] bucketTypes, String tenorAndMaturityDefaultValue, String moneynessDefaultValue, String interpolationDebugStringIdentifier, int[] interpolationOrder)
This will create a PP configurationvoid
setMaturityConverter(IMaturityConverter maturityConverter)
Set the implementation ofIMaturityConverter
void
setPnLExplainFormulaProvider(IPnLExplainFormulaProvider provider)
Set the implementation ofIPnLExplainFormulaProvider
protected LocalDate
stepDate(LocalDate date, boolean first)
Step the as-of date forward or backwards according todateProperty
.-
Methods inherited from class com.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor
checkPrefetchers, compute, computePrefetchFilter, createPrefetchers, createProcedure, evaluate, initializeUnderlyingMeasures, reduce, setPartitioningLevels, supportsAnalysisLevels
-
Methods inherited from class com.quartetfs.biz.pivot.postprocessing.impl.AAdvancedPostProcessor
addContextDependency, checkInterruption, checkOutputType, computeNamePath, computeOutputType, createEvaluator, expandResult, getActivePivot, getContext, getContextDependencies, getContinuousQueryHandlerKeys, getCurrentMeasure, getDatastoreVersion, getDerivedContextDependencies, getExpansionProcedure, getGenericOutputType, getMeasuresProvider, getName, getOutputType, getOutputTypeFromGenericClassParameter, getOutputTypeFromProperties, getPrefetchers, getProperties, getQueryCache, getTypeFromClass, handleCircularDependency, handleNotSupportedAnalysisLevels, handleUnknownUnderlyingMeasure, hideEvaluator, initializeContinuousQueryHandlerKeys, removeAnalysisLevelsFromFilter, restrictLocationAnalysisLevels, retrieveAnalysisLevelsToExpand, retrieveNamedPrefetchAggregatesWithAnalysisLevels, retrievePrefetchAggregates, retrievePrefetchAggregatesWithAnalysisLevels, setAggregatedMeasureName, toString
-
-
-
-
Field Detail
-
KEY_LEAF_LEVELS
public static final String KEY_LEAF_LEVELS
- See Also:
- Constant Field Values
-
NB_LEAF_LEVELS_WITHOUT_TENORS
public static final int NB_LEAF_LEVELS_WITHOUT_TENORS
- See Also:
- Constant Field Values
-
DATE_INFO
public static final String DATE_INFO
- See Also:
- Constant Field Values
-
SENSITIVITY_NAME_PROPERTY
public static final String SENSITIVITY_NAME_PROPERTY
- See Also:
- Constant Field Values
-
MAX_FALLBACK_DAYS
public static final String MAX_FALLBACK_DAYS
- See Also:
- Constant Field Values
-
MARKET_DATA_STORE_NAME
public static final String MARKET_DATA_STORE_NAME
- See Also:
- Constant Field Values
-
MARKET_DATA_STORE_FIELDS
public static final String MARKET_DATA_STORE_FIELDS
- See Also:
- Constant Field Values
-
BUCKET_TYPES
public static final String BUCKET_TYPES
- See Also:
- Constant Field Values
-
INTERPOLATION_ORDER
public static final String INTERPOLATION_ORDER
- See Also:
- Constant Field Values
-
TENOR_AND_MATURITY_DEFAULT_VALUE
public static final String TENOR_AND_MATURITY_DEFAULT_VALUE
- See Also:
- Constant Field Values
-
MONEYNESS_DEFAULT_VALUE
public static final String MONEYNESS_DEFAULT_VALUE
- See Also:
- Constant Field Values
-
maxFallbackDays
protected int maxFallbackDays
-
sensitivityName
protected String sensitivityName
-
dateProperty
protected String dateProperty
-
marketDataStoreName
protected String marketDataStoreName
-
identifier
protected String identifier
-
provider
protected IPnLExplainFormulaProvider provider
-
-
Constructor Detail
-
AScalarMarketDataPostProcessor
public AScalarMarketDataPostProcessor(String name, com.quartetfs.biz.pivot.cube.hierarchy.measures.IPostProcessorCreationContext creationContext)
-
-
Method Detail
-
getPostProcessorDescription
protected static com.activeviam.desc.build.ICanStartBuildingMeasures.BuildablePostProcessorBuilder getPostProcessorDescription(com.activeviam.desc.build.ICanStartBuildingMeasures builder, String pluginKey, String measureName, String underlyingMeasures, String asOfDateLevel, String marketDataSetLevel, String riskFactorLevel, String riskClassLevel, String[] primaryLevels, String[] secondaryLevels, Integer maxFallbackDays, String dateInfo, String sensitivityName, String marketDataStoreName, String[] marketDataStoreFields, BucketType[] bucketTypes, String tenorAndMaturityDefaultValue, String moneynessDefaultValue, int[] interpolationOrder, String interpolationDebugStringIdentifier, String formatter, String folder)
This will create a PP configuration- Parameters:
builder
- measure builderpluginKey
- plugin keymeasureName
- Name of the postprocessorunderlyingMeasures
- The underlying measureasOfDateLevel
- Level containing the asOfSDatemarketDataSetLevel
- Level containing the market data set levelriskFactorLevel
- risk factor levelriskClassLevel
- risk class levelprimaryLevels
- primary pillar levelssecondaryLevels
- secondary pillar levelsmaxFallbackDays
- max fallback daysdateInfo
- date infosensitivityName
- sensitivity namemarketDataStoreName
- market data store namemarketDataStoreFields
- market data store fieldsbucketTypes
- bucket typestenorAndMaturityDefaultValue
- default value for tenors and maturitiesmoneynessDefaultValue
- default value for moneynessinterpolationDebugStringIdentifier
- internal identifier used in the query cache. The keys in the query cache that will be used have the following pattern: measure name + identifier + locationinterpolationOrder
- order in which the interpolation of market data is performed. That order is defined as an int[] in which each index indicates the order in which each of the axis defined in thebucketTypes
parameter is processed during the interpolation calculation, starting at the value 0. Ex: if there are three elements defined inbucketTypes
like:{BucketType.TENOR_INPUT, BucketType.MATURITY_INPUT, BucketType.MONEYNESS_INPUT}
and if the interpolation order is defined as:0,1,2
, the interpolation will first be done on the tenors axis, then on the maturity axis, and then on the moneyness axis.formatter
- formatterfolder
- Folder name of the metric, if not provider aka null measure is invisible- Returns:
- measure builder
-
measure
protected static com.activeviam.copper.api.CopperMeasure measure(String pluginKey, com.activeviam.copper.api.CopperMeasure underlyingMeasures, String asOfDateLevel, String marketDataSetLevel, String riskFactorLevel, String riskClassLevel, String[] primaryLevels, String[] secondaryLevels, Integer maxFallbackDays, String dateInfo, String sensitivityName, String marketDataStoreName, String[] marketDataStoreFields, BucketType[] bucketTypes, String tenorAndMaturityDefaultValue, String moneynessDefaultValue, String interpolationDebugStringIdentifier, int[] interpolationOrder)
This will create a PP configuration- Parameters:
pluginKey
- plugin keyunderlyingMeasures
- The underlying measureasOfDateLevel
- Level containing the asOfSDatemarketDataSetLevel
- Level containing the market data set levelriskFactorLevel
- risk factor levelriskClassLevel
- risk class levelprimaryLevels
- primary pillar levelssecondaryLevels
- secondary pillar levelsmaxFallbackDays
- max fallback daysdateInfo
- date infosensitivityName
- sensitivity namemarketDataStoreName
- market data store namemarketDataStoreFields
- market data store fieldsbucketTypes
- bucket typestenorAndMaturityDefaultValue
- default value for tenors and maturitiesmoneynessDefaultValue
- default value for moneynessinterpolationDebugStringIdentifier
- internal identifier used in the query cache. The keys in the query cache that will be used have the following pattern: measure name + identifier + locationinterpolationOrder
- order in which the interpolation of market data is performed. That order is defined as an int[] in which each index indicates the order in which each of the axis defined in thebucketTypes
parameter is processed during the interpolation calculation, starting at the value 0. Ex: if there are three elements defined inbucketTypes
like:{BucketType.TENOR_INPUT, BucketType.MATURITY_INPUT, BucketType.MONEYNESS_INPUT}
and if the interpolation order is defined as:0,1,2
, the interpolation will first be done on the tenors axis, then on the maturity axis, and then on the moneyness axis.- Returns:
- measure builder
-
init
public void init(Properties properties) throws com.quartetfs.fwk.QuartetException
Three custom property needs to be present in the configuration of the post-processor:- keyLeafLevels: It's the value representing the key levels: AsOfDate, Risk Factor e.g.
"AsOfDate@Date@Dates", "RiskFactor@Risk Factor@Risk" * - DateInfo: its value is the string representing the date property (either current date or precious date) e.g.
"currentDate" - SensitivityName: its value is the string representing the sensi type, e.g.
"Delta", "Vega", "Gamma" * - MaxFallback days: its value is the string representing the maximum fallback days for previous date market data. By default it is set to 1 e.g.
"1"
- Specified by:
init
in interfacecom.quartetfs.biz.pivot.postprocessing.IEvaluator<Double>
- Specified by:
init
in interfacecom.quartetfs.biz.pivot.postprocessing.IPostProcessor<Double>
- Overrides:
init
in classcom.quartetfs.biz.pivot.postprocessing.impl.ABasicPostProcessor<Double>
- Throws:
com.quartetfs.fwk.QuartetException
- keyLeafLevels: It's the value representing the key levels: AsOfDate, Risk Factor e.g.
-
evaluate
public Double evaluate(com.quartetfs.biz.pivot.ILocation leafLocation, Object[] underlyingMeasures)
There is only one underlying measure here: the Double Sensi Value .
-
doEvaluate
protected abstract Double doEvaluate(com.quartetfs.biz.pivot.ILocation leafLocation, LocalDate asOfDate, String marketDataSet, String riskFactor, Object[] primaryMembers, Object[] secondaryMembers, List<BiFunction<Double,Double,Double>> preInterpolationCalcs, List<BiFunction<Double,Double,Double>> postInterpolationCalcs, int[] interpolationOrder, boolean interpolate)
-
getMarketDataRecord
protected Optional<com.qfs.store.record.IRecordReader> getMarketDataRecord(LocalDate date, String marketDataSet, String riskFactor, Object[] primaryMembers, Object[] secondaryMembers)
Method that retrieves the market data for the current day- Parameters:
date
- as of datemarketDataSet
- market data set context valueriskFactor
- risk factorprimaryMembers
- primary pillarssecondaryMembers
- secondary pillars- Returns:
- market data for current day and tenor/maturity
-
fetchMarketData
protected Optional<com.qfs.store.record.IRecordReader> fetchMarketData(com.qfs.store.IDatastoreVersion datastoreVersion, String marketDataStoreName, LocalDate date, String marketDataSet, String riskFactor, Object[] labels, Object[] dates, List<String> marketDataFields)
Attempts to fetch a market data record by its key.- Parameters:
datastoreVersion
- The datastore version to run the query against.marketDataStoreName
- The store name.date
- The as of date.marketDataSet
- The market data set.riskFactor
- The risk factor.labels
- The array of label values.dates
- The array of date values.marketDataFields
- The fields to return from the store.- Returns:
- An optional containing a market data record, if found.
-
stepDate
protected LocalDate stepDate(LocalDate date, boolean first)
Step the as-of date forward or backwards according todateProperty
.- Parameters:
date
- input datefirst
- is this the first time this is called in a search- Returns:
- the target date
-
interpolate
protected com.quartetfs.fwk.impl.Pair<Double,String> interpolate(com.quartetfs.biz.pivot.ILocation location, String marketDataSet, LocalDate asOfDate, String riskFactor, List<BiFunction<Double,Double,Double>> preInterpolationCalcs, List<BiFunction<Double,Double,Double>> postInterpolationCalcs, int[] interpolationOrder, boolean enableDebugString)
Return the interpolated value- Parameters:
location
- The input location of the value to interpolatemarketDataSet
- The record to look inasOfDate
- The current dateriskFactor
- The name of the risk underlyingpreInterpolationCalcs
- The functions computed before the interpolation of market data is performed, defined by axis.postInterpolationCalcs
- The functions computed after the interpolation of market data is performed, defined by axis.interpolationOrder
- order in which the interpolation of market data is performed. That order is defined as an int[] in which each index indicates the order in which each of the axis defined in thebucketTypes
parameter is processed during the interpolation calculation, starting at the value 0. Ex: if there are three elements defined inbucketTypes
like:{BucketType.TENOR_INPUT, BucketType.MATURITY_INPUT, BucketType.MONEYNESS_INPUT}
and if the interpolation order is defined as:0,1,2
, the interpolation will first be done on the tenors axis, then on the maturity axis, and then on the moneyness axis.enableDebugString
- Flag used to enable the generation of a debug string for market data interpolation. If set to 'true', the string is generated, if set to 'false', it is not generated- Returns:
- The interpolated value for the given risk
-
getEnableMDStringDebug
public boolean getEnableMDStringDebug()
-
setMaturityConverter
public void setMaturityConverter(IMaturityConverter maturityConverter)
Description copied from interface:IMaturityConverterAware
Set the implementation ofIMaturityConverter
- Specified by:
setMaturityConverter
in interfaceIMaturityConverterAware
- Parameters:
maturityConverter
- the implementation ofIMaturityConverter
-
setPnLExplainFormulaProvider
public void setPnLExplainFormulaProvider(IPnLExplainFormulaProvider provider)
Description copied from interface:IPnLExplainFormulaProviderAware
Set the implementation ofIPnLExplainFormulaProvider
- Specified by:
setPnLExplainFormulaProvider
in interfaceIPnLExplainFormulaProviderAware
- Parameters:
provider
- the implementation ofIPnLExplainFormulaProvider
-
-