The Treynor Ratio, also known as Treynor’s Measure or the Reward-to-Variability Ratio, is a financial metric used to assess the risk-adjusted performance of an investment portfolio or asset. It measures the excess return generated by the portfolio per unit of systematic or market risk, often represented by Beta. The Treynor Ratio is a valuable tool for evaluating the performance of investments in relation to their market risk exposure.

The formula is as follows:

\[\text{Treynor Ratio} = (\text{Portfolio's Return} - \text{Risk-Free Rate}) / \text{Portfolio Beta}\]

See definition: https://en.wikipedia.org/wiki/Treynor_ratio

Also known as: reward-to-volatility ratio.

Treynor Ratio in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_treynor_ratio as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.performance.get_treynor_ratio()

Which returns:

Date AAPL TSLA
2021 0.2468 0.2586
2022 -0.2364 -0.3971
2023 0.4028 0.4422
2024 0.2641 0.243
2025 0.0352 0.0323
2026 0.1146 -0.0879

Parameters

The function accepts the following parameters:

  • period (str, optional): The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialized with quarterly=True, otherwise “yearly”.
  • rolling (int, optional): The rolling window size to use for the Beta component of the calculation. If set, Beta is estimated over a rolling window of this many periods across the full return history instead of per period. Defaults to None.
  • 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.
Share