---
title: "Time-Weighted Portfolio"
method: POST
path: "/portfolios/transformation/time-weighted"
tags: ["Portfolio Transformation"]
---

# Time-Weighted Portfolio

`POST /portfolios/transformation/time-weighted`

## Request

- Base URL: `https://api.portfoliooptimizer.io/v1`
- URL: `https://api.portfoliooptimizer.io/v1/portfolios/transformation/time-weighted`
- Auth: API key in header `X-API-Key`

Compute time-weighted portfolio values from portfolio values and portfolio contributions/withdrawals.

References
* [Wikipedia, Time-weighted return](https://en.wikipedia.org/wiki/Time-weighted_return)
* Carl R. Bacon, Practical Portfolio Performance Measurement and Attribution
* [Kenneth B. Gray, Jr. and Robert B. K. Dewar. 1971. Axiomatic Characterization of the Time-Weighted Rate of Return", Management Science, Vol. 18, No. 2, pp. B32-B35](https://www.jstor.org/stable/2629526)

## Request body

- object
  - `portfolios` object[], required
    - `portfolioValues` object[], required: portfolioValues[t] contains portfolio value information at the date t
      - `date` string, required: The date corresponding to the date t in format YYYY-MM-DD; all dates are distinct
      - `portfolioValue` number, required: The value of the portfolio at the date t, excluding any potential contribution or withdrawal possibly made at the same date
    - `portfolioContributions` object[]: portfolioValues[t] contains portfolio contributions information at the date t
      - `date` string, required: The date corresponding to the date t in format YYYY-MM-DD; all dates are distinct; the date must be found in the array portfolioValues
      - `contributionAmount` number, required: The amount contributed to the portfolio at the date t
    - `portfolioWithdrawals` object[]: portfolioValues[t] contains portfolio withdrawals information at the date t
      - `date` string, required: The date corresponding to the date t in format YYYY-MM-DD; all dates are distinct; the date must be found in the array portfolioValues
      - `withdrawalAmount` number, required: The amount withdrew from the portfolio at the date t

## Response `200`

OK

- object
  - `portfolios` object[], required
    - `portfolioValues` object[], required: portfolioValues[t] contains time-weighted portfolio value information at the date t
      - `date` string, required: The date corresponding to the date t in format YYYY-MM-DD; all dates are distinct
      - `portfolioValue` number, required: The time-weighted value of the portfolio at the date t

---

[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)
