Skip to content

Parametric Stress Test


Computes a parametric stress test for the portfolio, estimating portfolio losses under predefined regulatory and factor shock scenarios using a parametric (analytical) approach rather than full Monte Carlo revaluation.

HTTP Request

POST /calculations/parametric_stress_test

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.
use_cashflow boolean optional, default is True For fixed income securities: True maps each cashflow event to key points in the interest rate curve; False uses Macaulay duration instead.
factor_model string optional, default is beta Factor model to use for stress test. Accepts: beta.
st_worst_method string optional, default is by_factor Method used to compute the worst-case stress test scenario. Accepts: by_factor.
b3_core_method string optional, default is standard B3 core margin calculation method. Accepts: standard.
historical_days integer optional, default is 252 Number of business days used to compute the factor covariance matrix.
custom_shocks object optional, default is null An object defining custom shock scenarios to apply on top of the built-in scenarios.
projection array optional, default is ["IND:SPX"] Array of securities used as the top-down factor model. Maximum: 15 elements.
filter string optional, default is null Filter expression to select a subset of securities for display. See Filter Expression.

To calculate the parametric stress test, run the following:

curl https://api.everysk.com/v2/calculations/parametric_stress_test \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
        "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_stress_test": {
    "results": {
      "port_parametric_st_bear_b3": -531.94,
      "port_parametric_st_bull_b3": 475.35,
      "port_parametric_st_worst_b3": -531.94,
      "port_parametric_st_base_custom": -99.0,
      "sec_parametric_st_bear_b3": {
        "id1": [-531.94]
      },
      "sec_parametric_st_bull_b3": {
        "id1": [475.35]
      },
      "sec_parametric_st_worst_b3": {
        "id1": [-531.94]
      },
      "factor_labels": ["IND:BVSP"],
      "parametric_st_shocks": {
        "bear": [-0.0085, ...],
        "bull": [0.0107, ...],
        "worst": [-0.0085, ...]
      }
    },
    "unmapped_tickers": []
  }
}