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

# Covariance Matrix

`POST /assets/covariance/matrix`

Compute the covariance matrix of assets from either:  
* The asset correlation matrix and their standard deviations
* The asset correlation matrix and their variances

References
* [Wikipedia, Covariance Matrix](https://en.wikipedia.org/wiki/Covariance_matrix)

## Request body

- union
  - object
    - `assets` integer, required — The number of assets
    - `assetsCorrelationMatrix` array[], required — assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
      - number[]
    - `assetsVariances` number[], required — assetsVariances[i] is the variance of the asset i
  - object
    - `assets` integer, required — The number of assets
    - `assetsCorrelationMatrix` array[], required — assetsCorrelationMatrix[i][j] is the correlation between the asset i and the asset j
      - number[]
    - `assetsVolatilities` number[], required — assetsVolatilities[i] is the volatility of the asset i

## 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/revisions/dee9caba1913/schema)
