fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Cash Conversion Cycle

Install and import#

bash
npm install fintech-algorithms
ts
import { cashConversionCycle } from "fintech-algorithms/fundamental-analysis-and-valuation/statement-ratios/cash-conversion-cycle";

Signature#

cashConversionCycle(input)

Turns average receivables, inventory and trade payables into days sales outstanding, days inventory outstanding and days payables outstanding over a stated day count, then reports the cash conversion cycle as DIO plus DSO minus DPO.

Parameters#

NameTypeNotes
input{ revenue: number; cost_of_goods_sold: number; day_count: number; beginning_receivables: number; ending_receivables: number; beginning_inventory: number; ending_inventory: number; beginning_trade_payables: number; ending_trade_payables: number }A plain object. revenue scales DSO while cost_of_goods_sold scales DIO and DPO; day_count is the number of days the period is annualized over. The three balance pairs — beginning_receivables and ending_receivables, beginning_inventory and ending_inventory, beginning_trade_payables and ending_trade_payables — are each averaged. Every key must be a finite number.

Returns#

{ average_receivables: number; average_inventory: number; average_trade_payables: number; days_sales_outstanding: number | null; days_inventory_outstanding: number | null; days_payables_outstanding: number | null; cash_conversion_cycle_days: number | null; state: string; reason: string }

average_receivables, average_inventory and average_trade_payables are always emitted. days_sales_outstanding divides average receivables by revenue, days_inventory_outstanding and days_payables_outstanding divide by cost of goods sold, and each is multiplied by day_count; cash_conversion_cycle_days sums DIO and DSO and subtracts DPO. When revenue or cost of goods sold is not positive the four day figures are null, state is not-meaningful and reason is nonpositive-revenue or nonpositive-cogs; otherwise state is negative-cycle for a cycle below zero or calculated, with reason dio-plus-dso-minus-dpo.

Errors#

  • When any of the nine inputs is not a finite number — throws RangeError
  • When day_count is zero or negative — throws RangeError
  • When any receivables, inventory or trade payables balance is negative — throws RangeError

Complexity: time O(1), space O(1).

Worked example#

verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

Input#

input
{
  "revenue": 2400,
  "cost_of_goods_sold": 1440,
  "beginning_receivables": 280,
  "ending_receivables": 320,
  "beginning_inventory": 340,
  "ending_inventory": 380,
  "beginning_trade_payables": 200,
  "ending_trade_payables": 240,
  "day_count": 365
}

Call#

cashConversionCycle(input)

Returns#

object with 9 fields: average_receivables, average_inventory, average_trade_payables, days_sales_outstanding, days_inventory_outstanding, days_payables_outstanding, cash_conversion_cycle_days, state, …

{
  "average_receivables": 300,
  "average_inventory": 360,
  "average_trade_payables": 220,
  "days_sales_outstanding": 45.625,
  "days_inventory_outstanding": 91.25,
  "days_payables_outstanding": 55.763888888889,
  "cash_conversion_cycle_days": 81.111111111111,
  "state": "calculated",
  "reason": "dio-plus-dso-minus-dpo"
}

Other exports#

This module also exports dupontDecomposition, roicCalculation, interestCoverageRatio, netDebtToEbitda, commonSizeStatements, calculate. Every module additionally exports run as an alias of its primary function, and a meta object carrying its catalog id, domain, family, shape and article URL.

Diagrams#

Cash Conversion Cycle — article hero
Cash Conversion Cycle — definition comparison
Cash Conversion Cycle — evidence lineage
Cash Conversion Cycle — formula anatomy
Cash Conversion Cycle — system map
Cash Conversion Cycle — worked example

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Statement Ratios family#