Purpose: This study looked at the influence of working capital management on firm performance using both accounting measure (ROE) and market measure (Tobin’s q) of firms listed in Nigeria and Ghana. Design/methodology/approach: The study used ant colony optimization (ACO) and k-nearest neighbours (KNN) in establishing the long-term effect of working capital management on corporate performance. Data were extracted from annual financial reports of non-financial companies listed on the Nigeria and Ghana stock exchanges for the recession period 2012–2016, with a total observation of 510. Findings: ACO was applied to determine the working capital management variables that influence corporate performance, and KNN predicted its longitudinal influence, which, in our view, has not been deeply researched. It was discovered that non-financial firms in the period of economic crises manage the account receivables and payables, as well as cash conversion cycles, maintaining optimum working capital for efficient operational activities. It is therefore assumed that these firms are exposed to external and other sources of finance, which enables them to increase investment in working capital, preventing the risk of low production hindering firms from settling debt, as well as customers, leading to the collapse of many firms in this region and accounting for an increase in the unemployment rate. Research limitations/implications: This study will inform corporate management and policymakers on the effect of economic crises on the performance of firms in the management of working capital to achieve desirable accounting and market performance. The ability of a firm to manage working capital during boom and recession periods enhances maximization of shareholders’ wealth. Originality/value: This study will alert policymakers to the urgency in setting up appropriate policies to address pertinent issues regarding longitudinal influence of economic crises on firm continuity and value. JEL Code: M4