---
title: "Distance Covariance Matrix"
method: POST
path: "/assets/covariance/matrix/estimation/distance"
tags: ["Assets / Covariance Matrix Estimation"]
---

# Distance Covariance Matrix

`POST /assets/covariance/matrix/estimation/distance`

Compute the asset distance covariance matrix, from either:
* Asset returns
* Asset close-to-close prices, from which asset logarithmic returns are computed

References
* [Szekely, G. J., Rizzo, M. L. and Bakirov, N. K. (2007). Measuring and testing independence by correlation of distances. Ann. Statist. 35 2769–2794](https://mathscinet.ams.org/mathscinet/relay-station?mr=2382665)
* [Javier Pardo-Diaz, Lyuba V Bozhilova, Mariano Beguerisse-Díaz, Philip S Poole, Charlotte M Deane, Gesine Reinert, Robust gene coexpression networks using signed distance correlation, Bioinformatics, Volume 37, Issue 14, July 2021, Pages 1982–1989](https://academic.oup.com/bioinformatics/article/37/14/1982/6125359)

## Request body

- union
  - object
    - `assets` object[], required
      - `assetReturns` number[], required — assetReturns[t] is the return of the asset at the time t; all assetReturns arrays must have the same length
      - `distanceCovarianceCoefficientSign` 'unsigned' | 'pearsonSigned' — The sign of the distance covariance coefficient
  - object
    - `assets` object[], required
      - `assetPrices` object[], required — assetPrices[t] contains price information for the asset at the date t
        - `date` string, required — The date corresponding to the date t in format YYYY-MM-DD; all dates must be distinct
        - `close` number, required — The close price of the asset at the date t
      - `distanceCovarianceCoefficientSign` 'unsigned' | 'pearsonSigned' — The sign of the distance covariance coefficient

## Response `200`

OK

- object
  - `assetsCovarianceMatrix` array[], required — assetsCovarianceMatrix[i][j] is the covariance between the asset i and the asset j
    - number[]

---

[API](https://skmtc.net/portfoliooptimizer/apis/portfolio-optimizer.md) · [All operations](https://skmtc.net/portfoliooptimizer/apis/portfolio-optimizer/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/portfoliooptimizer/portfolio-optimizer/versions/479fd4ac44aa/schema)
