VaR calculation
Portfolio Risk Service" module
The entry point for the risk calculation via the risk service is always a risk service object (MM-Talk function RsvRiskServiceObject
) and a list of ValueAtRiskPosition
with date. These are summarized in an RsvValueAtRiskPortfolio
.
Two optional parameters have been added to the ValueAtRiskPosition
function: Class and balance.
Instrument.ValueAtRiskPosition
[Position;Cost price;Class;Balance]
- Instrument: If it is a special investment (forward exchange transaction, fixed-term deposit, margin, loan), its parameters are adopted as fixed. The corresponding object should therefore generally originate from a portfolio valuation on the evaluation date . (Please note the comment on the evaluation date in the description of the
RsvValueAtRiskPortfolio
function: the actual evaluation date may differ from the requested evaluation date) - Stock (number): Holdings of the instrument in the value-at-risk position.
- Cost price (number): If it is a future, this parameter specifies the futures price in contract currency.
- Class (string): The portfolio can be divided into sub-portfolios using the class label. All positions with the same class label are combined into a sub-portfolio. VaR types that relate to sub-portfolios (Marginal VaR, Component VaR, Incremental VaR) use this breakdown.
- Balance (number): If this parameter is set, the balance of accounts is not read from the account valuation, but this value is used (only in connection with risk service functions). This functionality is useful if the execution of securities purchases is to be simulated, as the account balance changes. In this case, the stock parameter is ignored in the valuation.
An RsvValueAtRiskPortfolio
is generated as follows:
RsvValueAtRiskPortfolio
[List of ValueAtRiskPosition;Date;FuturesClearing]
- The list of
ValueAtRiskPosition
contains all positions that make up the portfolio to be calculated. In the case of value-at-risk positions containing special investments, it should be noted that the securities account valuation from which the special investment objects originate is carried out on the evaluation date . - The date is the evaluation date on which the risk is to be determined (default value: today). It should be noted that the date on which the risk is actually determined may differ from this date if no precalculations have (yet) been carried out on the server for this date.
The central function for risk calculation is the RsvValueAtRisk
function on the RsvRiskServiceObject. When this function is called up, a connection to the risk service is established in the background and the corresponding results are queried there.
If too many parameters are transferred here, it is currently possible that too many results are to be calculated, so that the calculation on the server takes longer and the wait for the response from the Infront Portfolio Manager is canceled. Therefore, fewer parameters or fewer combinations of portfolios, time horizons, VaR types, etc. per call of this function are preferable.
RsvRiskServiceObject.RsvValueAtRisk
[RSVPortfolios;TimeHorizons;Conficencelevels;Currency;Restrictions;VaRTypes;DoAdHocPricing;ExcludedRiskFactors]
- RSV portfolios: Individual RsvValueAtRiskPortfolio or a list of portfolios for which risk figures are to be calculated.
- TimeHorizons: Character string or list of character strings, where each character string represents a time horizon supported by the risk service, e.g. in the form P1M for "one month". The permitted values can be assigned to the result of the function RsvServiceStatus.
RsvVarTypes
. Please read the section Auxiliary functions for calculation. - Confidence levels: Number or list of numbers corresponding to the desired confidence level, e.g. 0.99 for 99%.
- Currency: Currency. The RsvStatusObject
.RsvCurrencies
function provides permitted values (see section Auxiliary functions for calculation). - Restrict (Boolean): If "False", the calculation is aborted if a requested portfolio contains an unvaluable instrument. With "True", the calculation is only carried out on the instruments that can be valued.
- VaRTypes: Character string or list of character strings. The key risk figures to be calculated. See section "Risk measures" or "Auxiliary functions" (RsvServiceStatus
.RsvVarTypes
). - DoAdHocPricing (Boolean): for some instruments that are not registered for precalculation, the simulation of possible future price developments is also possible during the evaluation of a template. If this option is set to "True", these instruments are included in the calculation. This extends the duration of the calculation on the server.
Calling the RsvValueAtRisk
function on the RsvRiskServiceObject returns a list of value-at-risk result objects (of type "RsvValueAtRiskResult"), each of which contains the aspects of a single result:
RsvVaR (number): The function provides the value at risk ("VaR") in evaluation currency.
RsvVaRType (character string): The function returns the VaR type. Please read the section on risk measures.
RsvAnalysisCurrency (currency): The function returns the evaluation currency, i.e. the currency of RsvVaR.
RsvTimeHorizon (character string): The function provides the time horizon for which the risk assessment applies.
RsvConfidenceLevel (number): The function provides the confidence level.
RsvPortfolio (RsvValueAtRiskPortfolio): The function returns the portfolio to which this result relates.
RsvLevelObject (RsvValueAtRiskPortfolio, character string or risk position): Different risk ratios can relate to different properties. For example, the marginal VaR relates to individual positions and classes. The object returned by this function is the object to which the result refers.
In the case of positions, this is a ValueAtRisk position.
In the case of classes, this is a character string that designates this class (see the description of
ValueAtRiskPosition
).In the case of portfolios, this is the RsvValueAtRiskPortfolio.
RsvActualValuationDate (date): The date to which the precalculations on the server refer. (Courses are included in the modeling of the instruments up to this date, for example)
RsvTheoreticalValue (number): The calculations on the risk service are based on mathematical modeling of the instruments. These model rates may differ from the actual rates. This value provides the associated model course (or, in the case of classes or portfolios, the sum of the associated model courses). In the case of classes or portfolios, individual non-valuable items are not taken into account, whereas an "n/a" is returned for individual items if they cannot be valued.
RsvValue (number): For individual positions, this function returns the value as it is available in the Infront Portfolio Manager: In evaluation currency, on the date to which the precalculations on the server refer. For classes or portfolios, this function returns the sum of all items in the portfolio or class, using the server-side value if available. If this is not available for a position, this position is valued in the Infront Portfolio Manager. If no evaluation is possible there either, the overall result is "n/a".
The relevant results can be removed from the results list using DeleteIfNot
.