---
title: "Rolling Sharpe Ratios"
method: POST
path: "/portfolios/analysis/mean-variance/sharpe-ratio/rolling"
tags: ["Portfolio Analysis / Mean-Variance"]
---

# Rolling Sharpe Ratios

`POST /portfolios/analysis/mean-variance/sharpe-ratio/rolling`

## Request

- Base URL: `https://api.portfoliooptimizer.io/v1`
- URL: `https://api.portfoliooptimizer.io/v1/portfolios/analysis/mean-variance/sharpe-ratio/rolling`
- Auth: API key in header `X-API-Key`

Compute the rolling Sharpe Ratios of a portfolio.

References
* Harry M. Markowitz, Portfolio Selection, Efficient Diversification of Investments, Second edition, Blackwell Publishers Inc.
* [Sharpe, W. (1994) The Sharpe Ratio. Journal of Portfolio Management, 21, 49-58](https://www.pm-research.com/content/iijpormgmt/21/1/49)

## Request body

- object
  - `riskFreeReturn` number: The constant risk-free arithmetic return over the considered time period, in percentage; exclusive with riskFreeReturns
  - `riskFreeReturns` number[]: riskFreeReturns[t] is the risk-free arithmetic return at the time t; the riskFreeReturns array must have the same length as all the portfolioReturns arrays or the same length minus 1 as all the portfolioValues arrays; exclusive with riskFreeReturn
  - `portfolios` object[], required
    - `portfolioReturns` number[]: portfolioReturns[t] is the arithmetic return of the portfolio at the time t; exclusive with portfolioValues
    - `portfolioValues` number[]: portfolioValues[t] is the value of the portfolio at the time t; exclusive with portfolioReturns
    - `portfolioRollingSharpeRatioWindowSize` integer: The size of the window over which to compute the portfolio rolling Sharpe Ratios; must be lower than the length of the array portfolioReturns; must be lower than the length of the array portfolioValues - 1

## Response `200`

OK

- object
  - `portfolios` object[], required
    - `portfolioRollingSharpeRatio` number[], required: portfolioRollingSharpeRatio[t] is the value of the portfolio Sharpe Ratio over the window [t, t + portfolioRollingSharpeRatioWindowSize - 1]

## Changes

- **2026-08-22** `efac1128c762`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/portfoliooptimizer/apis/portfolio-optimizer/changes/portfolios/analysis/mean-variance/sharpe-ratio/rolling/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)
