Class for setting up Debt objects. The idea of this class is to model baskets (funds) of bond instruments.
The shocked value is derived from a sensitivity approach based on Modified duration and
convexity. These sensitivities describe the total basket properties in terms of interest rate sensitivity.
The following formula is applied to calculate the instrument shock:
dP
--- = -D dY + 0.5 C dY^2
P
If you want to model all underlying bonds directly, use Bond class for underlyings and Synthetic class for the basket (fund).
This class contains all attributes and methods related to the following Debt types:
In the following, all methods and attributes are explained and a code example is given.
Methods for Debt object obj:
- Debt(id) or Debt(): Constructor of a Debt 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.calc_value(discount_curve,scenario): Calculate instrument shocked value based on interest rate sensitivity.
Modified Duration and Convexity are used to predict change in value based on absolute shock discount curve at given term.
- obj.getValue(scenario): Return Debt value for given scenario.
Method inherited from Superclass Instrument
- Debt.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]
Attributes of Debt objects:
- id: Instrument id. Has to be unique identifier. Default: empty string.
- name: Instrument name. Default: empty string.
- description: Instrument description. Default: empty string.
- value_base: Base value of instrument of type real numeric. Default: 0.0.
- currency: Currency of instrument of type string. Default: ’EUR’
During instrument valuation and aggregation, FX conversion takes place if corresponding FX rate is available.
- asset_class: Asset class of instrument. Default: ’debt’
- type: Type of instrument, specific for class. Set to ’debt’.
- value_stress: Line vector with instrument stress scenario values.
- value_mc: Line vector with instrument scenario values.
MC values for several timestep_mc are stored in columns.
- timestep_mc: String Cell array with MC timesteps. If new timesteps are set, values are automatically appended.
- discount_curve: Discount curve is used as sensitivity curve to derive absolute shocks at term given by duration.
- term: Term of debt instrument (in years). Equals average maturity of all underlying cash flows.
- duration: Modified duration of debt instrument.
- convexity: Convexity of debt instrument.
For illustration see the following example:
Stress values of a debt instrument with average maturity of underlyings of 8.35 years and given duration and convexity
are calculated based on 100bp parallel down- and upshift scenarios of a given discount curve.
Stress results are [108.5300000000000;91.1969278203125]
c = Curve();
c = c.set('id','IR_EUR','nodes',[730,3650,4380],'rates_base',[0.01,0.02,0.025],'method_interpolation','linear');
c = c.set('rates_stress',[0.00,0.01,0.015;0.02,0.031,0.035],'method_interpolation','linear');
d = Debt();
d = d.set('duration',8.35,'convexity',18,'term',8.35);
d = d.calc_value(c,'stress');
d.getValue('base')
d.getValue('stress')