Tracking Error¶
Tracking error is the divergence between the price behavior of a position or a portfolio and the price behavior of a benchmark. This is often in the context of a hedge fund, mutual fund, or exchange-traded fund (ETF) that did not work as effectively as intended, creating an unexpected profit or loss.
HTTP Request
POST /calculations/marginal_tracking_error
HTTP Parameters
| Parameter | Description |
|---|---|
securities1 array |
REQUIRED The securities of the portfolio to analyze. See Securities. Not required when you send portfolio_id1. |
portfolio_id1 string |
optional, default is null The ID of an existing portfolio to analyze. When you send it, the API uses that portfolio and ignores securities1, date1, base_currency1 and nlv1. |
date1 string date |
optional, default is null (today) Date of the analyzed portfolio, in the format YYYYMMDD. |
base_currency1 string |
optional, default is USD 3-letter ISO 4217 base currency of the analyzed portfolio. |
nlv1 float |
optional, default is null Net liquidating value of the analyzed portfolio. If you do not send it, the API calculates it from the securities. |
securities2 array |
REQUIRED The securities of the benchmark portfolio. The API calculates the deviations against this portfolio. Not required when you send portfolio_id2. |
portfolio_id2 string |
optional, default is null The ID of an existing portfolio to use as the benchmark. When you send it, the API ignores securities2, date2, base_currency2 and nlv2. |
date2 string date |
optional, default is null (today) Date of the benchmark portfolio, in the format YYYYMMDD. |
base_currency2 string |
optional, default is USD 3-letter ISO 4217 base currency of the benchmark portfolio. |
nlv2 float |
optional, default is null Net liquidating value of the benchmark portfolio. |
weekly boolean |
optional, default is True If True, the Calculation API uses weekly returns to calculate the tracking error. |
exp_decay float |
optional, default is 0.94 Exponential decay factor applied to the volatilities. The API always applies it. Send 0 to use no decay (equal weights). |
n_days integer |
optional, default is 252 Number of historical business days used in the calculation when weekly is False. Accepts 1 to 100000. |
n_weeks integer |
optional, default is 200 Number of historical weeks used in the calculation when weekly is True. Accepts 1 to 100000. |
filter string |
optional, default is null (use the whole portfolio) Filter expression that selects the securities of the first portfolio to show in the results. The calculation runs on the whole portfolio. See Filter Expression. |
model string |
optional, default is v1 The calculation engine: v1 or v2. See Calculation model. |
To calculate the tracking errors, run the following:
curl https://api.everysk.com/v2/calculations/marginal_tracking_error \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-d '{
"securities1": [
{
"id": "id1",
"symbol": "AAPL",
"quantity": 1000.0
},
{
"id": "id2",
"symbol": "MSFT",
"quantity": 500.0
}
],
"securities2": [
{
"id": "id3",
"symbol": "SPY",
"quantity": 1000.0
}
],
"weekly": false
}' \
-X POST
The above call returns the following JSON object:
{
"marginal_tracking_error": {
"unmapped_tickers": [],
"results": {
"mcte": {
"id1": 0.005884471459323663,
"id2": 0.006365037307355700
},
"te": 0.008751094213396014,
"corr": 0.8394975109763287
}
}
}