Indices · Statistics
Indices correlations
/v1/indices/correlationsindicesCorrelationsPearson correlation and beta of the daily log returns of two or three of the served indexes over their last window common sessions (20 to 252), as a matrix and as pairs. Beta is of the first index of a pair against the second. An index without daily bars is listed in meta.coverage.missing and every pair with it is null; fewer than 10 paired returns also give null. One daily-bar read per index; no index values are returned. The figures use a longer lookback than the dated rows your plan's history window allows (the window limits the rows returned, not the lookback a statistic is computed from); this route returns no dated rows.
Example request
curl -sS --get "https://api.ordermap.si/v1/indices/correlations" \
-H "Authorization: Bearer $ORDERMAP_API_KEY" \
--data-urlencode symbols=SPX,NDXconst params = new URLSearchParams({
symbols: "SPX,NDX",
});
const res = await fetch(`https://api.ordermap.si/v1/indices/correlations?${params}`, {
headers: { Authorization: `Bearer ${process.env.ORDERMAP_API_KEY}` },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data, meta } = await res.json();
console.log(data, meta.coverage);Set ORDERMAP_API_KEY to your key. Replace the dates with a recent trading date.
Parameters
2 parameters, 1 required.
| Parameter | Type and limits | Description |
|---|---|---|
symbolsqueryrequired | array<string>comma-separated in one parameter1 to 3 itemseach at most 10 characterspattern ^[A-Za-z][A-Za-z0-9]{0,9}$ | Two or three index symbols, comma separated, for example SPX,NDX,RUT. |
windowqueryoptional | integerdefault 60min 20max 252 | Number of daily returns, 20 to 252. |
Response
| Status | Meaning | Body |
|---|---|---|
200 | Successful response. | Schema below |
400 | Invalid, unknown or repeated parameters, or an invalid cursor. | Error object |
401 | Missing or invalid API key. | Error object |
403 | The plan, dataset release or account state does not allow this request. | Error object |
422 | The request is valid but no data exists for it. | Error object |
429 | Rate limit, burst limit or cooldown; wait Retry-After seconds.Retry-After | Error object |
500 | Internal error. | Error object |
503 | Data temporarily unavailable; retry after Retry-After seconds.Retry-After | Error object |
504 | The request timed out. | Error object |
Authenticated responses carry the X-RateLimit-* headers (see rate limits); 429 and 503 add Retry-After.
200 response body
dataobjectrequiredReturn correlations of two or three symbols.9 fields insidematrixarray<array<number>>requiredCorrelation matrix in the order of symbols; null where it cannot be computed.pairsarray<object>requiredEvery pair once.5 fields insideastringrequiredFirst symbol.bstringrequiredSecond symbol.betanumber | nullrequiredBeta of a's returns against b's: covariance over the variance of b.correlationnumber | nullrequiredPearson correlation of the daily log returns, -1 to 1.observationsintegerrequiredPaired daily returns used.
symbolsarray<string>requiredThe indexes, in request order.windowintegerrequiredDaily returns the correlation covers.
metaobjectrequiredMeta object
Example response
{
"data": {
"matrix": [
[
1,
0.93
],
[
0.93,
1
]
],
"pairs": [
{
"a": "SPX",
"b": "NDX",
"beta": 0.78,
"correlation": 0.93,
"observations": 60
}
],
"symbols": [
"SPX",
"NDX"
],
"window": 60
},
"meta": {
"as_of": 1760659200123,
"coverage": {
"complete": true
},
"delay_ms": 0,
"delayed": false,
"request_id": "0199f0c2-5a1e-7c3b-9d4e-2b6f8a1c3d5e",
"source": "index_feed"
}
}Values are illustrative. Missing values are null, never 0.
