Monte Carlo Risk Attribution¶
The goal of Monte Carlo Risk Attribution is to calculate the contribution to the overall portfolio risk from each security. We use a measure called Marginal Contribution to Total Risk (MCTR) for Monte Carlo Risk Attribution.
To MCTR for a portfolio, make an HTTP POST to your calculation resource URI:
HTTP Request
POST /calculations/risk_attribution
HTTP Parameters
| Parameter | Description |
|---|---|
portfolio_id string |
optional It is the ID of and existing portfolio. When passing a portfolio's ID as parameter the calculation will be performed using the given portfolio's securities, date, base currency and nlv. The securities parameter is no longer required. |
securities array |
REQUIRED * It is an array of objects to describe the securities in the portfolio. Each object represents a security with a unique id, symbol, quantity and label. For more details click here. * Not required if portfolio_id is being provided. |
date string date |
optional, default is null (today) Portfolio date in the format: YYYYMMDD. The Portfolio Date is important because it instructs the API to use the market conditions and security prices prevailing on that date. Therefore, historical portfolios will be calculated without looking ahead. In order to run the portfolio using the market conditions prevailing today, use null. |
base_currency string |
optional, default is USD 3-letter ISO 4217 code for currency. Portfolios can have their base currency changed via the API call. By changing the base currency, a new set of currency risks is automatically taken into account. To see all supported currencies click here. |
nlv float |
optional, default is null (calculated) The net liquidating value of the portfolio (also called NAV). When not supplied by user, the API will calculate the net liquidating value of all the cash securities. Securities traded on margin are assumed to have NLV zero. Supplying a NLV effectively reconciles the margin. |
horizon integer |
optional, default is 5 Simulates the behavior of each security via their underlying risk factors. It accepts: 1, 5, 20 or 60. For more information click here. |
sampling integer |
optional, default is 1 Sampling represents the frequency that historical prices and rates (spreads) are collected in order to compute the invariant risk factors. In order to sample daily, use 1. In order to sample weekly (non-overlapping), pass 5. It accepts: 1 or 5. For various combinations between horizon and sampling click [here]. |
aggregation string |
optional, default is position Aggregation computes individual security MCTR's and aggregates them according to the supported criteria:custom, position, country, sector, gics_sector, market_capitalization, liquidity, implied_rating, duration, security_type, security_type_refined, dividend_yield, exposure, currency, fixed_income, total_esg. For more information click here. |
projection array |
optional, default is ["IND:SPX"] User supplied array of securities to be used as a top-down factor model. Maximum number of elements in the projection array is 15. |
volatility_half_life integer |
optional, default is 2 Half life of volatility information in months: 0 (no decay), 2, 6, 12, 24 or 48. |
correlation_half_life integer |
optional, default is 6 Half life of correlation information in months: 0 (no decay), 2, 6, 12, 24 or 48. |
risk_measure string |
optional, default is vol Specifies the forward looking portfolio risk property being measured by MCTR, such as: vol, var or cvar. vol: forward looking annualized volatility of the P&L distribution for the portfolio. var: Value-at-Risk of the P&L distribution for the portfolio. cvar: Conditional Value-at-Risk of the P&L distribution for the portfolio. |
filter string |
optional, default is null (use the whole portfolio) Filter Expression: When present it runs a pre-processing calculation to select identifiers that satisfy certain criteria. It can be used to highlight the properties of a subset of the portfolio, for example: only fixed income securities. Calculations are performed for the whole portfolio and only displayed for the securities that satisfy the filter. See Filter Expression. |
To calculate the MCTR, run the following:
curl https://api.everysk.com/v2/calculations/risk_attribution \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"securities": [
{
"id": "id1",
"symbol": "AAPL",
"quantity": 1000.0
},
{
"id": "id2",
"symbol": "SIE:XETR",
"quantity": 750.0
}
],
"date": "20210622"
}' \
-X POST
The above call returns the following JSON object:
{
"risk_attribution": {
"unmapped_tickers": [],
"results": [
{
"id": "id1",
"mctr": [
{
"projection": "IND:SPX",
"value": 0.0731895836099715
},
{
"projection": "residual",
"value": 0.048455690761258066
}
]
},
{
"id": "id2",
"mctr": [
{
"projection": "IND:SPX",
"value": 0.043270012765204605
},
{
"projection": "residual",
"value": 0.024765489616676867
}
]
}
]
}
}