Skip to content

Parametric Risk Attribution


Calculates the magnitude of a security's reaction to changes in underlying factors, most often in terms of its price response to other factors.

HTTP Request

POST /calculations/parametric_risk_attribution

HTTP Parameters

Parameter Description
id string REQUIRED A string used to identify the portfolio.
projection array REQUIRED User-supplied array of securities to be used as a top-down factor model. Maximum number of elements is 15.
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.
use_cashflow boolean optional, default is True For fixed income securities:
• True: maps each cashflow event (interest, principal amortization) to key points in the respective interest rate curve.
• False: uses Macaulay duration to map bond price to neighboring key points in the respective curve.
sampling integer optional, default is 1 Frequency of historical data sampling. Use 1 for daily, 5 for weekly (non-overlapping). Accepts: 1 or 5.
confidence string optional, default is 95% Confidence level for calculating VaR and CVaR. Accepts: 1sigma, 2sigma, 3sigma, 85%, 90%, 95%, 97%, or 99%. More details here.
historical_days integer optional, default is 252 Number of business days used to calculate the covariance for the primitive risk factors.
exponential_decay float optional, default is 0.94 Factor used in the exponentially weighted moving average (EWMA). Accepts float values from 0 to 1.

To calculate the parametric risk, run the following:

curl https://api.everysk.com/v2/calculations/parametric_risk_attribution \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
        "projection": ["IND:BVSP"],
        "securities": [
          {
            "id": "id1",
            "symbol": "PETR4:BVMF",
            "quantity": 150.0
          }
        ],
        "base_currency": "BRL",
        "date": "20210711"
      }' \
  -X POST

The above call returns the following JSON object:

{
  "parametric_risk_attribution": {
    "results": {
      "port_parametric_vol": 428.93616533156944,
      "port_parametric_var": -705.5372072762883,
      "port_parametric_cvar": -884.87,
      "sec_parametric_contribution_to_vol": {
        "id1": 428.93616533156944
      },
      "sec_parametric_contribution_to_var": {
        "id1": -705.5372072762883
      },
      "sec_parametric_standalone_vol": {
        "id1": 428.93616533156944
      },
      "sec_parametric_standalone_var": {
        "id1": -705.5372072762883
      },
      "sec_factor_exposure_dixpre": {
        "id1": 0.0
      },
      "sec_parametric_factor_exposure": {
        "id1": [6881.49]
      },
      "sec_parametric_no_sens_factor_exposure": {
        "id1": [6881.49]
      },
      "factor_parametric_correlations": [
        [1.0]
      ],
      "factor_labels": ["IND:BVSP"]
    },
    "unmapped_tickers": []
  }
}