Calculate the days sales in inventory ratio, an efficiency ratio that measures how long it takes a company to sell its inventory.

The days sales in inventory ratio (DSI) is calculated by dividing the average inventory by the cost of goods sold (COGS) and then multiplying by the number of days in the period. It represents the average number of days it takes for a company to sell its inventory. A lower DSI indicates that the company is selling its inventory more quickly.

The formula is as follows:

\[\text{Days Sales in Inventory Ratio} = (\text{Average Inventory} / \text{Cost of Goods Sold}) \cdot \text{Days}\]

Also known as: DIO, days inventory outstanding.

Days of Inventory Outstanding in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_days_of_inventory_outstanding as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["NKE", "LULU", "DECK"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.ratios.get_days_of_inventory_outstanding()

Or, after setting up the Finance Toolkit MCP, ask:

How many days of inventory did Nike, Lululemon and Deckers Outdoor hold from 2021 to 2025?

Which returns:

  2021 2022 2023 2024 2025
DECK 92.864 105.297 96.625 84.2594 77.4483
LULU 111.215 121.754 126.114 116.91 119.035
NKE 110.479 106.465 102.373 103.283 103.284

Parameters

get_days_of_inventory_outstanding accepts the following parameters.

ParameterTypeDescriptionExample
daysint | floatThe number of days in the window the flows cover. Defaults to None, which uses 365 for annual data and 365 / 4 for quarterly data, multiplied by trailing when set (e.g. 365 for quarterly data with trailing=4).360
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the ratios. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
compoundboolWhether 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
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
trailingintThe 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
Share