public final class ScenarioDefinition extends Object implements org.joda.beans.ImmutableBean
Each scenario definition contains market data filters and perturbations. Filters are used to choose items of market data that are shocked in the scenario, and the perturbations define those shocks.
Perturbations are applied in the order they are defined in scenario. An item of market data can only be perturbed once, so if multiple mappings apply to it, only the first will be used.
| Modifier and Type | Class and Description |
|---|---|
static class |
ScenarioDefinition.Builder
The bean-builder for
ScenarioDefinition. |
static class |
ScenarioDefinition.Meta
The meta-bean for
ScenarioDefinition. |
| Modifier and Type | Method and Description |
|---|---|
static ScenarioDefinition.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
static ScenarioDefinition |
empty()
Returns an empty scenario definition.
|
boolean |
equals(Object obj) |
ImmutableList<PerturbationMapping<?>> |
getMappings()
Gets the market data filters and perturbations that define the scenarios.
|
int |
getScenarioCount()
Returns the number of scenarios.
|
ImmutableList<String> |
getScenarioNames()
Gets the names of the scenarios.
|
int |
hashCode() |
static ScenarioDefinition.Meta |
meta()
The meta-bean for
ScenarioDefinition. |
ScenarioDefinition.Meta |
metaBean() |
static ScenarioDefinition |
ofMappings(List<? extends PerturbationMapping<?>> mapping)
Returns a scenario definition containing the perturbations in
mappings. |
static ScenarioDefinition |
ofMappings(List<? extends PerturbationMapping<?>> mappings,
List<String> scenarioNames)
Returns a scenario definition containing the perturbations in
mappings. |
static ScenarioDefinition |
ofMappings(PerturbationMapping<?>... mappings)
Returns a scenario definition containing the perturbations in
mappings. |
ScenarioDefinition.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
public static ScenarioDefinition empty()
public static ScenarioDefinition ofMappings(List<? extends PerturbationMapping<?>> mapping)
mappings.
Each mapping must contain the same number of perturbations. The definition will contain the same number of scenarios as the number of perturbations in each mapping.
The first scenario contains the first perturbation from each mapping, the second scenario contains the second perturbation from each mapping, and so on.
Given three mappings, A, B and C, each containing two perturbations, 1 and 2, there will be two scenarios generated:
| | A | B | C | |------------|------|------|------| | Scenario 1 | A[1] | B[1] | C[1] | | Scenario 2 | A[2] | B[2] | C[2] |For example, consider the following perturbation mappings:
| | USD Curves | EUR/USD Rate | |------------|------------|--------------| | Scenario 1 | -10bp | +5% | | Scenario 2 | 0 | 0 | | Scenario 3 | +10bp | -5% |
mapping - the filters and perturbations that define the scenario. Each mapping must contain the same
number of perturbationspublic static ScenarioDefinition ofMappings(PerturbationMapping<?>... mappings)
mappings.
Each mapping must contain the same number of perturbations. The definition will contain the same number of scenarios as the number of perturbations in each mapping.
The first scenario contains the first perturbation from each mapping, the second scenario contains the second perturbation from each mapping, and so on.
Given three mappings, A, B and C, each containing two perturbations, 1 and 2, there will be two scenarios generated:
| | A | B | C | |------------|------|------|------| | Scenario 1 | A[1] | B[1] | C[1] | | Scenario 2 | A[2] | B[2] | C[2] |For example, consider the following perturbation mappings:
| | USD Curves | EUR/USD Rate | |------------|------------|--------------| | Scenario 1 | -10bp | +5% | | Scenario 2 | 0 | 0 | | Scenario 3 | +10bp | -5% |
mappings - the filters and perturbations that define the scenario. Each mapping must contain the same
number of perturbationspublic static ScenarioDefinition ofMappings(List<? extends PerturbationMapping<?>> mappings, List<String> scenarioNames)
mappings.
Each mapping must contain the same number of perturbations. The definition will contain the same number of scenarios as the number of perturbations in each mapping.
The first scenario contains the first perturbation from each mapping, the second scenario contains the second perturbation from each mapping, and so on.
The set of scenario names must contain the same number of elements as the mappings.
Given three mappings, A, B and C, each containing two perturbations, 1 and 2, there will be two scenarios generated:
| | A | B | C | |------------|------|------|------| | Scenario 1 | A[1] | B[1] | C[1] | | Scenario 2 | A[2] | B[2] | C[2] |For example, consider the following perturbation mappings:
| | USD Curves | EUR/USD Rate | |------------|------------|--------------| | Scenario 1 | -10bp | +5% | | Scenario 2 | 0 | 0 | | Scenario 3 | +10bp | -5% |
mappings - the filters and perturbations that define the scenario. Each mapping must contain the same
number of perturbationsscenarioNames - the names of the scenarios. This must be the same size as the list of perturbations
in each mapping and the names must be uniqueIllegalArgumentException - if there are any duplicate scenario namespublic int getScenarioCount()
public static ScenarioDefinition.Meta meta()
ScenarioDefinition.public static ScenarioDefinition.Builder builder()
public ScenarioDefinition.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic ImmutableList<PerturbationMapping<?>> getMappings()
public ImmutableList<String> getScenarioNames()
public ScenarioDefinition.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.