Calculate the days of sales outstanding ratio, an efficiency ratio that measures the average number of days it takes a company to collect payment on its credit sales.

The days of sales outstanding (DSO) ratio is calculated by dividing the accounts receivable by the total credit sales and then multiplying by the number of days in the period. It represents the average number of days it takes for a company to collect payment on its credit sales. A lower DSO indicates that the company is collecting payments more quickly.

The formula is as follows:

\[\text{Days of Sales Outstanding Ratio} = (\text{Average Accounts Receivable} / \text{Total Credit Sales}) \cdot \text{Days}\]

Also known as: DSO, days sales outstanding, receivable days.

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

Calculate the Days of Sales Outstanding in Python

The Days of Sales Outstanding is available in the Ratios module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_days_of_sales_outstanding as shown below.

from financetoolkit import Toolkit

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

dso_ratios = toolkit.ratios.get_days_of_sales_outstanding()

Which returns:

  2021 2022 2023 2024 2025
AAPL 21.1517 25.2057 27.4699 29.3645 32.0949
TSLA 12.8814 10.8991 12.1826 14.807 17.3095

Parameters

get_days_of_sales_outstanding accepts the following parameters:

  • days (int, optional): The number of days to use for the 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