Beta¶
Calculates the beta of each security in the portfolio relative to a reference index. Beta measures the sensitivity of a security's returns to movements in the benchmark index.
HTTP Request
POST /calculations/beta
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. |
index_symbol string |
REQUIRED, default is SPY The symbol of the reference index used to compute beta (e.g. SPY, IND:SPX). |
n_days integer |
optional, default is 252 Number of business days of history used when computing beta with daily returns (weekly is False). |
n_weeks integer |
optional, default is 104 Number of weeks of history used when computing beta with weekly returns (weekly is True). |
weekly boolean |
optional, default is False If True, beta is computed using weekly returns; otherwise daily returns are used. |
port_beta boolean |
optional, default is False If True, also computes the portfolio-level beta in addition to per-security betas. |
inverted_beta boolean |
optional, default is False If True, returns the inverse of the computed beta values. |
filter string |
optional, default is null Filter expression to select a subset of securities for display. See Filter Expression. |
To calculate the beta, run the following:
curl https://api.everysk.com/v2/calculations/beta \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"securities": [
{
"id": "id1",
"symbol": "AAPL",
"quantity": 1.0
}
],
"date": "20250124",
"base_currency": "USD",
"index_symbol": "IND:SPX",
"n_days": 252,
"n_weeks": 200,
"weekly": false,
"port_beta": true
}' \
-X POST
The above call returns the following JSON object:
{
"beta": {
"results": {
"beta": {
"id1": 0.9210
},
"port_beta": 0.9210
}
},
"unmapped_tickers": []
}