Variability-Weighted Return (VWR)
Calculate the Variability-Weighted Return (VWR) of an investment portfolio or asset: the annualized return reduced by how far the value strays from a steady exponential path with the same overall growth. Two assets with the same return score alike only when they got there alike; the one that swung more keeps less of its return, and none of it once the standard deviation of its deviations from the steady path reaches maximum_deviation. Unlike the Sharpe ratio it stays a return, and it judges the path of the value rather than the spread of the single returns.
The formula is as follows:
\[\bar{r} = \text{Average of} \;\ln(1 + \text{Return}),\;\; \text{the average log return}\] \[\text{Annualized Return} = \exp(\bar{r} x P) - 1\] \[\text{Deviation}_{i} = \frac{V_{i}}{V_{0} x \exp(\bar{r} x i)} - 1,\;\; \text{for}\;\; i = 1 \ldots N,\;\; \text{with } V \text{ the growth of 1}\] \[\text{VWR} = \text{Annualized Return} \cdot \left(1 - \left(\frac{\operatorname{Std}(\text{Deviation})}{\text{maximum\_deviation}}\right)^{\tau}\right)\]Where P is the number of returns in a year (252 daily returns, 365 for a ticker that trades on weekends such as a cryptocurrency, or 52, 12, 4 or 1 for weekly, monthly, quarterly or yearly returns), N the number of returns and Std the sample standard deviation (with n - 1 in the denominator). The Annualized Return compounds continuously from the average log return, which equals the compounded annual growth over the returns.
Also known as: Variability-Weighted Return, VWR, log return Sharpe alternative.
Example · AAPL, MSFT, KO · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_variability_weighted_return:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT", "KO"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.performance.get_variability_weighted_return()
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
What was the variability-weighted return of Apple, Microsoft and Coca-Cola in each year from 2021 to 2025?
Which returns:
| Item | AAPL | MSFT | KO |
|---|---|---|---|
| 2021 | 0.3558 | 0.5444 | 0.1549 |
| 2022 | -0.2281 | -0.2632 | 0.1007 |
| 2023 | 0.4289 | 0.5329 | -0.0434 |
| 2024 | 0.2772 | 0.1237 | 0.0816 |
| 2025 | 0.0731 | 0.1284 | 0.1487 |
5 rows
Parameters
get_variability_weighted_return accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The period to use for the calculation. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”. | "weekly" |
within_period | bool | Whether to calculate the VWR from the daily returns within each period (e.g. each year if period = ‘yearly’) or from the returns of the periods themselves over the whole history. Defaults to True. | True |
tau | float | The exponent of the penalty for variability: higher values spare small deviations and punish large ones. Defaults to 2.0. | 0.1 |
maximum_deviation | float | The standard deviation of the deviations from the steady path at which the return is reduced to zero, as a decimal. Defaults to 0.2. | 0.2 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the values. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Library Shares similar logic as backtrader’s VWR