Class for setting up Index objects.
Index class is used for specifying asset indizes, exchange rates and consumer price
indizes. Indizes serve as underlyings for e.g. Options or Forwards, are used
to set up forex rates or CPI indizes for inflation linked products.
Indizes can be shocked with risk factors (e.g. risk factor types RF_EQ or RF_FX)
or in MC scenarios.
This class contains all attributes and methods related to the following Index types:
- EQUITY INDEX
- BOND INDEX
- VOLATILITY INDEX
- COMMODITY INDEX
- REAL ESTATE INDEX
- EXCHANGE RATE
- CPI (Consumer Price index)
- AGGREGATED INDEX (consists of underlying indexes)
In the following, all methods and attributes are explained and a code example is given.
Methods for Index object obj:
- Index(id) or Index(): Constructor of a Index object. id is optional and specifies id and name of new object.
- obj.set(attribute,value): Setter method. Provide pairs of attributes and values. Values are checked for format and constraints.
- obj.get(attribute): Getter method. Query the value of specified attribute.
- obj.getValue(scenario): Return Index value according to scenario type.
- Index.help(format,returnflag): show this message. Format can be [plain text, html or texinfo].
If empty, defaults to plain text. Returnflag is boolean: True returns
documentation string, false (default) returns empty string. [static method]
- Index.get_basis(dcc_string): Return basis integer value for
given day count convention string. [static method]
Attributes of Index objects:
- id: Index id. Has to be unique identifier. Default: empty string.
- name: Index name. Default: empty string.
- description: Index description. Default: empty string.
- type: Index type. Can be [EQUITY INDEX, BOND INDEX, VOLATILITY INDEX,
COMMODITY INDEX, REAL ESTATE INDEX, EXCHANGE RATE, CPI]. Default: empty string.
- value_base: Base value of index. Default: 1.0
- currency: Index currency. Default: ’EUR’
- index_function: Type Aggregated Index only: specifies how
to aggregated indexes, which are specified in attribute increments.
Can be [sum, product, divide, factor]. [sum, product, divide] specifies
mathematical operation applied on all curve increments.
[factor] allows only one increment and uses curve_parameter for multiplication. Default: ’sum’
- index_parameter: Type Aggregated indexes only: used as multiplication
parameter for factor curve_function.
- increments: Type Aggregated indexes only: List of IDs of all
underlying indexes. Use index_function to specify how to aggregated indexes.
- scenario_mc: Vector with Monte Carlo index values.
\n
- scenario_stress: Vector with Stress index values.
- timestep_mc: String Cell array with MC timesteps. Automatically appended if values for new timesteps are set.
- shift_type: (unused) Specify a vector specifying stress index shift type .
Can be either 0 (absolute) or 1 (relative) shift.
For illustration see the following example:
disp('Setting up an equity index and Exchange Rate')
i = Index();
i = i.set('id','MSCIWORLD','value_base',1000, ...
'scenario_stress',[2000;1333;800],'currency','USD');
fx = Index();
fx = fx.set('id','FX_EURUSD','value_base',1.1, ...
'scenario_stress',[1.2;1.18;1.23]);