Win Rate
Calculate the Win Rate of an investment portfolio or asset’s returns.
The Win Rate is the percentage of periods in which the asset’s return exceeds the benchmark’s return.
Also known as: batting average.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Win Rate for you. Just ask in plain English.
Calculate the Win Rate in Python
The Win Rate is available in the Performance module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_win_rate as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.performance.get_win_rate()
Which returns:
| Date | AAPL | TSLA |
|---|---|---|
| 2021 | 0.4921 | 0.5 |
| 2022 | 0.4821 | 0.498 |
| 2023 | 0.576 | 0.532 |
| 2024 | 0.504 | 0.4683 |
| 2025 | 0.472 | 0.468 |
| 2026 | 0.504 | 0.472 |
Parameters
get_win_rate accepts the following parameters:
- period (str, optional): The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
- rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
- lag (int | str, optional): The lag to use for the growth calculation. Defaults to 1.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
Related Performance Metrics
The Performance module page introduces the module, and the sidebar lists all of its functions.