---
title: "Exponentially Weighted Moving Average Model (EWMA)"
method: POST
path: "/assets/covariance/matrix/forecast/ewma"
tags: ["Assets / Covariance Matrix Forecast"]
---

# Exponentially Weighted Moving Average Model (EWMA)

`POST /assets/covariance/matrix/forecast/ewma`

## Request

- Base URL: `https://api.portfoliooptimizer.io/v1`
- URL: `https://api.portfoliooptimizer.io/v1/assets/covariance/matrix/forecast/ewma`
- Auth: API key in header `X-API-Key`

Forecast an (averaged) asset covariance matrix using an exponentially weighted moving average (EWMA) model.

References
* [Kasper Johansson, Mehmet G. Ogut, Markus Pelger, Thomas Schmelzer and Stephen Boyd (2023), A Simple Method for Predicting Covariance Matrices of Financial Returns, Foundations and Trends® in Econometrics: Vol. 12: No. 4, pp 324-407](https://www.nowpublishers.com/article/Details/ECO-047)
* [Gianluca De Nard, Olivier Ledoit, Michael Wolf, Factor Models for Portfolio Selection in Large Dimensions: The Good, the Better and the Ugly, Journal of Financial Econometrics, Volume 19, Issue 2, Spring 2021, Pages 236–257](https://academic.oup.com/jfec/article/19/2/236/5285483)

## 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
    - `covarianceProxy` 'periodToPeriodReturnsOuterProduct' | 'demeanedPeriodToPeriodReturnsOuterProduct': The covariance proxy to use
    - `covarianceForecastHorizon` integer: The forecast horizon, corresponding to the number of multi-steps ahead covariance matrix forecasts to compute and average together
    - `covarianceProxyDecayFactor` union: The common decay factor of the exponentially weighted moving average applied to the assets returns; by default, the value of the best decay factor is automatically computed
      - number
      - 'auto'
  - 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
    - `covarianceProxy` 'closeToCloseReturnsOuterProduct' | 'demeanedCloseToCloseReturnsOuterProduct': The covariance proxy to use
    - `covarianceForecastHorizon` integer: The forecast horizon, corresponding to the number of multi-steps ahead covariance matrix forecasts to compute and average together
    - `covarianceProxyDecayFactor` union: The common decay factor of the exponentially weighted moving average applied to the assets returns; by default, the value of the best decay factor is automatically computed
      - number
      - 'auto'

## Response `200`

OK

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

## Changes

- **2026-04-03** `24e65d80f8eb`: 1 breaking, 1 info
  - removed `subschema #1, subschema #2` from the request body `oneOf` list
  - added `subschema #1, subschema #2` to the request body `oneOf` list
- **2026-02-08** `ac51d393c9a9`: 1 breaking, 1 info
  - removed `subschema #1, subschema #2` from the request body `oneOf` list
  - added `subschema #1, subschema #2` to the request body `oneOf` list
- **2025-05-16** `148ff00a3baf`: 1 info
  - the `covarianceProxy` request property default value changed from `demeanedPeriodToPeriodReturnsOuterProduct` to `periodToPeriodReturnsOuterProduct`

[Operation history](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer/changes/assets/covariance/matrix/forecast/ewma/post.md)

---

[API](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer.md) - [All operations](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer/llms.txt) - [OpenAPI document](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer/revisions/9d075aa717bf?raw)
