Catalog/finance-correlation-matrix

Finance

Crypto correlation matrix + diversification score API

Build the full N-asset Pearson correlation matrix for a basket of 2-10 CoinGecko coins from their daily returns (keyless price history), then collapse it into the decision an agent actually needs: a 0-100 DIVERSIFICATION SCORE derived from the average pairwise correlation (lower avg corr = better diversified), a WELL_DIVERSIFIED / MODERATE / CONCENTRATED rating, the per-asset average correlation to the rest of the basket (so you can see which holding is redundant and which is the best hedge), the most- and least-correlated pairs, and a human narrative. Tolerates partial upstream failure and falls back to Coinpaprika historical OHLCV when CoinGecko rate-limits an id. Answers 'is this basket diversified', 'which of my coins is redundant', 'how correlated is my portfolio', 'should I diversify these tokens'.

Price$0.16per request
MethodPOST
Route/v1/finance/correlation-matrix
StatusLive
MIME typeapplication/json
Rate limit60/minute
Cache3600s public
financecryptocorrelationdiversificationportfoliomatrixpearsonriskreturns
API URLhttps://x402.hexl.dev/v1/finance/correlation-matrix
Integration docs
Example request
{
  "ids": [
    "bitcoin",
    "ethereum",
    "solana"
  ],
  "days": 30
}
Example response
{
  "coins": [
    "bitcoin",
    "ethereum",
    "solana"
  ],
  "days": 30,
  "observations": 30,
  "matrix": [
    [
      1,
      0.862,
      0.845
    ],
    [
      0.862,
      1,
      0.862
    ],
    [
      0.845,
      0.862,
      1
    ]
  ],
  "avgPairwiseCorrelation": 0.856,
  "diversificationScore": 7,
  "rating": "CONCENTRATED",
  "perAsset": [
    {
      "coin": "bitcoin",
      "avgCorrelation": 0.854
    },
    {
      "coin": "ethereum",
      "avgCorrelation": 0.862
    },
    {
      "coin": "solana",
      "avgCorrelation": 0.854
    }
  ],
  "mostRedundant": {
    "coin": "ethereum",
    "avgCorrelation": 0.862
  },
  "bestHedge": {
    "coin": "bitcoin",
    "avgCorrelation": 0.854
  },
  "mostCorrelated": {
    "a": "bitcoin",
    "b": "ethereum",
    "correlation": 0.862
  },
  "leastCorrelated": {
    "a": "bitcoin",
    "b": "solana",
    "correlation": 0.845
  },
  "narrative": "CONCENTRATED: average pairwise correlation is high (0.856) — these assets largely move as one and provide little diversification. Most correlated pair: bitcoin/ethereum (0.862). Diversification score 7/100.",
  "disclaimer": "Best-effort Pearson correlation of daily returns over public price data; a short lookback or low observation count makes correlations noisy and unstable. Past correlation does not predict future co-movement. NOT investment advice."
}
Input schema
{
  "type": "object",
  "required": [
    "ids"
  ],
  "properties": {
    "ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 2,
      "maxItems": 10,
      "description": "CoinGecko coin ids (2-10), e.g. ['bitcoin','ethereum','solana']."
    },
    "days": {
      "type": "integer",
      "minimum": 7,
      "maximum": 90,
      "default": 30,
      "description": "Lookback window in days for the daily-return series (default 30, capped at 90)."
    }
  },
  "examples": [
    {
      "ids": [
        "bitcoin",
        "ethereum",
        "solana"
      ],
      "days": 30
    }
  ]
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}