Calculate the defensive interval ratio (DIR), a liquidity ratio that measures how many days a company could continue to cover its operating expenses using only its existing defensive (most liquid) assets, without relying on additional revenue.

Unlike the current, quick, and cash ratios, which express liquidity relative to current liabilities, the defensive interval ratio expresses liquidity relative to the company’s actual daily cash burn rate, making it a more direct measure of how long a company could survive a sudden stop in incoming cash flow.

The formula is as follows:

\[\text{Defensive Interval Ratio} = (\text{Cash and Cash Equivalents} + \text{Short Term Investments} + \text{Accounts Receivable}) / \text{Daily Operating Expenses}\]

Where Daily Operating Expenses = (Operating Expenses - Depreciation and Amortization) / Days, i.e. the average cash operating expenses incurred per day, net of the largest non-cash charge (depreciation and amortization).

Also known as: defensive interval period, basic defense interval.

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

Calculate the Defensive Interval Ratio in Python

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

pip install financetoolkit -U

Then call get_defensive_interval_ratio as shown below.

from financetoolkit import Toolkit

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

defensive_interval_ratios = toolkit.ratios.get_defensive_interval_ratio()

Parameters

get_defensive_interval_ratio accepts the following parameters:

  • days (int, optional): The number of days to use for the daily operating expenses calculation. Defaults to 365.
  • 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