Skip to main content
The VaR cube integrates the Scenario Engine framework in two ways. A scenario can override the Confidence Level measure, so a query returns VaR and ES computed at a confidence level the cube is not configured with. A scenario can also activate a pre-trade What-If, surfacing a hypothetical trade’s pre-loaded P&L vector under a scenario name without altering the loaded TradePnL data. This page assumes familiarity with the Scenario Engine framework, which ships with Atoti Server.

Which measure can be overridden?

The VaR cube hooks one measure: Confidence Level, which reads the active member of the confidence levels hierarchy. Several measures take Confidence Level as an input: VaR, Harrell-Davis VaR, VaR Scenario Index, VaR Scenario Name, ES, ES Scenario Indices, ES Scenario Name(s), ES Values, and ES L-Estimated. Overriding Confidence Level moves those measures, and every measure derived from them, to the overridden level. The hook supports two action keys: the built-in constant_scalar and scale_scalar. Confidence Level is read from a manual hierarchy over Double values and mapped to a primitive double, so the measure, and the hook wrapping it, report DOUBLE. VaR and ES read Confidence Level as a primitive double, and a scenario action’s value is a JSON number.

How is the integration wired?

The VaR cube registers its Scenario Engine contributions through VaRScenarioEngineConfiguration, a Spring configuration bean. It calls forCube on the shared configurator and registers the cube’s data actions and measure hooks:
The bean registers contributions from VaRActionsDefaults:
  • allMeasureActionFactories() is empty. VaR contributes no solution-specific measure-action factory and relies entirely on the built-in constant_scalar and scale_scalar actions.
  • allDataActionFactories(tradePnLTable, tradeAttributesTable) registers the pretrade_whatif data action over the TradePnL facts table and the TradeAttributes table, the same two tables the cube’s SimulationScenariosFeature scenario-tags.
  • allMeasureHooks(varCube) builds the Confidence Level hook described above. It defaults to reading the underlying measure through unchanged when no scenario action applies to a location.
varCubeProperties.getSimulations().mergedWith(defaultHooks) merges these built-in hooks with any entries declared under atoti.solution.model.cubes.var.simulations.measure-actions. A configured entry for a measure with no default hook contributes a brand-new hook. A configured entry for Confidence Level may only add supported action types to it; it can never replace its output type or aggregate function. See Configuration properties for the property details.

How to reprice VaR at a confidence level the cube is not configured with

The following scenario overrides Confidence Level with constant_scalar, answering at 90.0, a confidence level the cube is not configured with:
Executing this scenario writes the constant 90.0 into Confidence Level for every location the scenario is queried at. VaR, Harrell-Davis VaR, VaR Scenario Index, and VaR Scenario Name read Confidence Level as an input, so they recompute their quantile position at 90.0 instead of at whichever hierarchy member the query would otherwise select. ES, ES Scenario Indices, and ES Scenario Name(s) derive from the same measure and recompute alongside them. Selecting ConfidenceWhatIf on the Simulation Scenario Name hierarchy returns these repriced values next to the base view, which keeps reading the hierarchy member actually selected. scale_scalar is also available on Confidence Level: with "measureActionType": "scale_scalar" and "parameters": { "factor": 1.1 }, the hierarchy member the query would otherwise select is multiplied by 1.1 instead of being replaced outright.

How to activate a pre-trade What-If scenario

A pre-trade What-If evaluates a hypothetical, not-yet-booked trade’s impact on VaR and ES. The pretrade_whatif data action loads no data itself. The hypothetical trade’s P&L vector must already be present in the datastore before the scenario runs. The flow has two parts: load the hypothetical data out-of-band, then activate a scenario that makes it discoverable.

How is the hypothetical data loaded?

The hypothetical trade’s TradePnL row is loaded through the same Trade P&L file format used for every other trade. The datastore stores this table as PnLVectors, so a NO_PRELOADED_ROWS warning names it PnLVectors, not TradePnL. This load happens outside the Scenario Engine, through the normal data-loading process. TradePnL carries no time-point column, so one hypothetical trade is a single row, unlike a Mark-to-Future table keyed on a time point. The pre-loaded row carries an id in its DataSimulationId column, for example PT1, that no other scenario uses. The VaR cube also scenario-tags TradeAttributes. The hypothetical trade’s TradeAttributes row carries its trader, sales, counterparty, and other descriptors. That row must carry the same DataSimulationId value. Otherwise, the join between TradePnL and TradeAttributes does not resolve for the hypothetical trade.

How to create and activate the scenario

Create a scenario with a single pretrade_whatif data action. Pass the id used when loading the hypothetical data as dataActionId:
Executing this scenario writes, tags, or modifies no fact rows. It reports PT1 as the only data-simulation id for the scenario name PreTradeWhatIf. The engine then adds a mapping row to the VaR cube’s VaRSimulationScenarios bridge table. Selecting PreTradeWhatIf in a query returns the base facts plus the row already carrying DataSimulationId = PT1.

How to query the surfaced rows

Select the scenario name on the Simulation Scenarios dimension:
contributors.COUNT is the count of base facts contributing to a cell. With PreTradeWhatIf active it reflects the base data plus the pre-loaded row tagged PT1, so the count rises by one. The hypothetical trade’s P&L vector contributes to PnL Vector Sum alongside the base trades. Selecting PreTradeWhatIf shifts VaR and ES to reflect the added trade. Every measure that does not aggregate the P&L vector is unaffected.

What happens on deactivation?

Deactivating PreTradeWhatIf removes the mapping row. The pre-loaded TradePnL and TradeAttributes rows are not deleted. They remain in the datastore under DataSimulationId = PT1. They drop out of both the PreTradeWhatIf scenario view and the base (no-scenario) view. The base view only includes rows whose DataSimulationId is the shared base data id.

What if no rows match the supplied id?

Validation checks every scenario-tagged table, the TradePnL facts and TradeAttributes, for rows carrying the supplied dataActionId. If any of them has none (for example the hypothetical trade’s TradePnL row was loaded but its TradeAttributes row was not), validation returns a NO_PRELOADED_ROWS warning naming the empty tables. The warning does not block activation. The scenario still activates, but surfaces incomplete pre-trade data, and nothing at all if no table carries the id.