Docs / Endpoints
Correlation
POST/v1/correlationunits: 1 + 1 per symboldaily
Correlation matrix over a window, the most and least correlated pairs, annualised volatilities, and a rolling correlation for the first pair.
Add "async": true to run it as a job, and "webhook_url" to be called when it finishes (Jobs & async). Calls estimated above 1,000 units run as jobs automatically.
Parameters
| Field | Type | Default | Description |
|---|---|---|---|
symbolsrequired | array of string | — | 2–50 tickers. |
start_date | date | — | YYYY-MM-DD. First date to include. Default: the full history available. |
end_date | date | — | YYYY-MM-DD. Last date to include. Default: the latest bar. |
lookback_days | integer | 252 | Window in trading days when no dates are given. |
method | "pearson" | "spearman" | "kendall" | "pearson" | Correlation method. |
on | "returns" | "log_returns" | "prices" | "returns" | Series to correlate. |
frequency | "daily" | "weekly" | "monthly" | "daily" | Resample before correlating. |
rolling_window | integer | 60 | Window for the rolling correlation of the first pair. |
Example request
Do stocks, bonds and gold still diversify? Read the walkthrough →
Request
POST /v1/correlation{ "symbols": [ "SPY", "TLT", "GLD", "BTCUSD" ], "lookback_days": 252, "rolling_window": 60 }
The same call with curl, Python and JavaScript
curl https://clickapis.com/v1/correlation \
-H "Authorization: Bearer $CLICKAPIS_KEY" \
-H "Content-Type: application/json" \
-d '{"symbols":["SPY","TLT","GLD","BTCUSD"],"lookback_days":252,"rolling_window":60}'import os, requests
r = requests.post(
"https://clickapis.com/v1/correlation",
headers={"Authorization": f"Bearer {os.environ['CLICKAPIS_KEY']}"},
json={
"symbols": [
"SPY",
"TLT",
"GLD",
"BTCUSD"
],
"lookback_days": 252,
"rolling_window": 60
},
timeout=60,
)
print(r.json()["data"])const r = await fetch("https://clickapis.com/v1/correlation", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.CLICKAPIS_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"symbols": [
"SPY",
"TLT",
"GLD",
"BTCUSD"
],
"lookback_days": 252,
"rolling_window": 60
}),
});
console.log((await r.json()).data);Example response
Response 200 OK
{ "ok": true, "data": { "symbols": [ "SPY", "TLT", "GLD", "BTCUSD" ], "method": "pearson", "on": "returns", "frequency": "daily", "start": "2025-11-12", "end": "2026-11-12", "observations": 252, "observations_used": 252, "matrix": [ [ 1.0, 0.2735, 0.3613, 0.4557 ], [ 0.2735, 1.0, 0.1651, 0.0832 ], [ 0.3613, 0.1651, 1.0, 0.3102 ], [ 0.4557, 0.0832, 0.3102, 1.0 ] ], "most_correlated": [ { "a": "SPY", "b": "BTCUSD", "correlation": 0.455701 }, { "a": "SPY", "b": "GLD", "correlation": 0.361285 }, { "a": "GLD", "b": "BTCUSD", "correlation": 0.310205 }, { "a": "SPY", "b": "TLT", "correlation": 0.273483 }, { "a": "TLT", "b": "GLD", "correlation": 0.165059 } ], "least_correlated": [ { "a": "TLT", "b": "BTCUSD", "correlation": 0.083198 }, { "a": "TLT", "b": "GLD", "correlation": 0.165059 }, { "a": "SPY", "b": "TLT", "correlation": 0.273483 }, { "a": "GLD", "b": "BTCUSD", "correlation": 0.310205 }, { "a": "SPY", "b": "GLD", "correlation": 0.361285 } ], "annual_volatility": { "SPY": 0.137333, "TLT": 0.096837, "GLD": 0.289481, "BTCUSD": 0.434839 }, "notes": [] }, "meta": { "op": "correlation", "units": 5, "cost_usd": 0.0, "billing": "internal", "free_call": false, "free_calls_left": 0, "balance_usd": 5.0, "ms": 133, "interval": "1day", "data_as_of": "2026-11-12", "partial_last_bar": false } }
Every response has the same envelope: ok, data and meta (op, units, cost_usd, ms, interval, billing, balance_usd, data_as_of, partial_last_bar). Numbers are decimals (0.05 = 5%), dates ISO, and a value that cannot be computed is null.