Calculate the operating ratio, a financial metric that measures the efficiency of a company’s operations by comparing its operating expenses to its revenue.

The operating ratio is calculated by dividing the company’s operating expenses by its net sales and multiplying by 100 to express it as a percentage. It provides insight into how efficiently a company is managing its operations.

The formula is as follows:

\[\text{Operating Ratio} = (\text{Operating Expenses} + \text{Cost of Goods Sold}) / \text{Revenue}\]

Also known as: operating efficiency ratio, operating expense ratio.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Operating Ratio for you. Just ask in plain English.

Calculate the Operating Ratio in Python

The Operating Ratio is available in the Ratios module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_operating_ratio as shown below.

from financetoolkit import Toolkit

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

operating_ratios = toolkit.ratios.get_operating_ratio()

Which returns:

  2021 2022 2023 2024 2025
AAPL 0.7022 0.6971 0.7018 0.6849 0.6803
TSLA 0.8793 0.8324 0.9081 0.9276 0.9541

Parameters

get_operating_ratio accepts the following parameters:

  • 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.
  • trailing (int): Defines whether to select a trailing period. E.g. when selecting 4 with quarterly data, the TTM is calculated.

The Ratios module page introduces the module, and the sidebar lists all of its functions.

Share