Historical Risk Attribution¶
Computes historical risk attribution for a portfolio, measuring how each security has historically contributed to overall portfolio risk using observed return time series.
HTTP Request
POST /calculations/historical_risk_attribution
HTTP Parameters
| Parameter | Description |
|---|---|
portfolio_id string |
optional The ID of an existing portfolio. When provided, the calculation uses the portfolio's securities, date, base currency, and NLV. The securities parameter is no longer required. |
securities array |
REQUIRED * An array of objects describing the securities in the portfolio. Each object includes a unique id, symbol, quantity, and label. For more details click here. * Not required if portfolio_id is provided. |
date string date |
optional, default is null (today) Portfolio date in the format: YYYYMMDD. |
base_currency string |
optional, default is USD 3-letter ISO 4217 currency code. |
nlv float |
optional, default is null (calculated) Net liquidating value (NAV) of the portfolio. |
start_date string date |
optional Start date for the historical window, in the format: YYYYMMDD. When provided together with end_date, takes precedence over historical_days. |
end_date string date |
optional End date for the historical window, in the format: YYYYMMDD. Used together with start_date. |
historical_days integer |
optional, default is 252 Number of business days used when start_date/end_date are not provided. |
exponential_decay float |
optional, default is 0.94 EWMA decay factor. Accepts float values from 0 to 1. |
volatility_filter integer |
optional, default is 0 Minimum annualized volatility threshold (in percent) below which securities are excluded from the attribution. |
calendar string |
optional, default is BVMF Trading calendar used to compute business day offsets. Accepts standard exchange calendar codes (e.g. BVMF, NYSE). |
projection array |
optional, default is ["IND:SPX"] Array of securities used as the top-down factor model. Maximum: 15 elements. |
aggregation string |
optional, default is position Aggregation model. Accepts: 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. |
filter string |
optional, default is null Filter expression to select a subset of securities for display. Calculations are still run on the full portfolio. See Filter Expression. |
To calculate the historical risk attribution, run the following:
curl https://api.everysk.com/v2/calculations/historical_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",
"historical_days": 252
}' \
-X POST
The above call returns the following JSON object:
{
"historical_risk_attribution": {
"results": {
"port_historical_vol": 12589.36,
"port_historical_var": -13627.13,
"port_historical_cvar": -17621.20,
"port_historical_bvar": -13901.61,
"port_historical_st_value": -19237.37,
"port_historical_st_date": "20201006",
"port_historical_max_drawdown": -45487.00,
"sec_historical_vols": {
"id1": 9096.36,
"id2": 3492.99
},
"sec_historical_vars": {
"id1": -15458.10,
"id2": 1830.97
},
"sec_historical_cvars": {
"id1": -16652.94,
"id2": -968.27
},
"sec_historical_st_value": {
"id1": -22827.44,
"id2": 3590.06
}
},
"unmapped_tickers": []
}
}