Operating Ratio
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 sum of the cost of goods sold and the operating expenses by revenue. It shows how much of each dollar of revenue is absorbed by the costs of running the business; one minus the operating ratio is roughly the operating margin. 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}\]Railroads and trucking companies report the operating ratio as their headline efficiency measure, and lower is better. Because cost of goods sold and operating expenses are added together, the ratio does not depend on how a company splits its costs between those two lines, which makes it easier to compare than the expense lines on their own. It leaves out interest and taxes, so it says nothing about leverage.
Also known as: operating efficiency ratio, operating expense ratio.
Operating Ratio in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_operating_ratio as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["UNP", "CSX", "NSC"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.ratios.get_operating_ratio()
Or, after setting up the Finance Toolkit MCP, ask:
What was the operating ratio of Union Pacific, CSX and Norfolk Southern from 2021 to 2025?
Which returns:
| 2021 | 2022 | 2023 | 2024 | 2025 | |
|---|---|---|---|---|---|
| CSX | 0.588 | 0.5991 | 0.627 | 0.6309 | 0.6792 |
| NSC | 0.6082 | 0.6286 | 0.769 | 0.6895 | 0.6709 |
| UNP | 0.5717 | 0.6013 | 0.6235 | 0.5995 | 0.5986 |
Parameters
get_operating_ratio accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
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 ratios. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
compound | bool | Whether the growth is the compound annual growth rate over the lag (e.g. lag=5 for the five-year CAGR) instead of the total change. Defaults to False. | False |
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 |
trailing | int | The number of periods to sum flows (income and cash flow statement items) over, with balance sheet items averaged over the same number of period ends. E.g. 4 with quarterly data gives the trailing twelve months (TTM) and 3 with annual data a three-year cumulative figure. Defaults to None, which uses single-period flows (per quarter and not annualized with quarterly data). | 4 |