Recently we have written about the UnRisk Financial Language (UFL), our asset enabling quants to program in "their language". Up to now we did not give you examples but this will change today. I have chosen a Value at Risk scenario, as it makes it clearly obvious how a domain specific language can help to simplify things tremendously.
In a first step we set up the risk factors (Interest, Equity, FX, Credit) as a list. These list also contains the historical values and the information up to what extent the information will be taken account in the calculation (number of principal components).
|Setup risk factors|
With a one-liner we can set up the Monte Carlo scenarios. All necessary information, not explicitly passed will be calculated, for example the correlations between the risk factors.
|Generating Monte Carlo scenarios, necessary parameters are calculated automatically from the market data. |
Now the scenarios will be applied to a single instrument. Using UnRisk Financial Language it would be of course possible to apply the scenarios to arbitrary portfolios.
|With the time series command one can specify which risk factors will be applied.|
|The actual market data set describes today's market data and is needed to create scenario deltas.|
|We will apply the scenario deltas to a fixed rate bond.|
|We calculate the scenarios deltas|
The results can be extracted easily by again providing high level commands.
|Scenario Delta Values for the fixed rate bond. Additionally one can of course get out the single risk factor scenario deltas.|
The above example shows how a programmatically elaborate task can be simplified significantly by using a domain specific language like UnRisk Financial Language.