{"record":{"id":"58c697d07017c5a7","repo":"TauricResearch/TradingAgents","slug":"no-cash-flow-data","errorCode":null,"errorMessage":"no cash flow data","messagePattern":"no cash flow data","errorType":"exception","errorClass":"NoMarketDataError","httpStatus":null,"severity":"error","filePath":"tradingagents/dataflows/y_finance.py","lineNumber":394,"sourceCode":"def get_cashflow(\n    ticker: Annotated[str, \"ticker symbol of the company\"],\n    freq: Annotated[str, \"frequency of data: 'annual' or 'quarterly'\"] = \"quarterly\",\n    curr_date: Annotated[str, \"current date in YYYY-MM-DD format\"] = None\n):\n    \"\"\"Get cash flow data from yfinance.\"\"\"\n    canonical = normalize_symbol(ticker)\n    try:\n        ticker_obj = yf.Ticker(canonical)\n\n        if freq.lower() == \"quarterly\":\n            data = yf_retry(lambda: ticker_obj.quarterly_cashflow)\n        else:\n            data = yf_retry(lambda: ticker_obj.cashflow)\n\n        data = filter_financials_by_date(data, curr_date)\n\n        if data.empty:\n            raise NoMarketDataError(ticker, canonical, \"no cash flow data\")\n\n        # Convert to CSV string for consistency with other functions\n        csv_string = data.to_csv()\n\n        # Add header information\n        header = f\"# Cash Flow data for {canonical} ({freq})\\n\"\n        header += f\"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\\n\\n\"\n\n        return header + csv_string\n\n    except NoMarketDataError:\n        raise\n    except Exception as e:\n        return f\"Error retrieving cash flow for {ticker}: {str(e)}\"\n\n\ndef get_income_statement(\n    ticker: Annotated[str, \"ticker symbol of the company\"],","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/TauricResearch/TradingAgents/blob/a33fd4c0f134485a43553a2c23a63cb14adbd88f/tradingagents/dataflows/y_finance.py#L376-L412","documentation":"NoMarketDataError raised by get_cash_flow (y_finance.py) when the date-filtered cash-flow frame from yfinance is empty. Same pattern as the other financial-statement getters: unknown symbol, or curr_date predates the first available statement period, so filter_financials_by_date leaves zero columns and the empty check raises.","triggerScenarios":"Calling get_cash_flow(ticker, freq, curr_date) for a symbol with no cash-flow statements on Yahoo, or with a curr_date before the earliest statement date; freq='quarterly' when only annual statements exist also yields an empty frame.","commonSituations":"Pre-IPO/backtest dates older than the company's filings, new listings with limited history, delisted tickers, or quarterly granularity not published for the symbol.","solutions":["Use a curr_date after the first available cash-flow statement (or today for latest).","Try freq='yearly' if quarterly data is missing for the symbol.","Catch NoMarketDataError and treat cash-flow analysis as unavailable for that symbol/date."],"exampleFix":"# before\ncf = get_cash_flow('FOOBAR', 'quarterly', '2018-01-01')\n\n# after\nfrom tradingagents.dataflows.errors import NoMarketDataError\ntry:\n    cf = get_cash_flow('FOOBAR', 'quarterly', '2018-01-01')\nexcept NoMarketDataError:\n    cf = get_cash_flow('FOOBAR', 'yearly', '2018-01-01')  # or None","handlingStrategy":"try-catch","validationCode":"import yfinance as yf\n\ndef has_cashflow(symbol: str, freq: str = 'yearly') -> bool:\n    obj = yf.Ticker(symbol)\n    frame = obj.quarterly_cashflow if freq == 'quarterly' else obj.cashflow\n    return frame is not None and not frame.empty","typeGuard":null,"tryCatchPattern":"from tradingagents.dataflows.errors import NoMarketDataError\n\ntry:\n    cf = get_cash_flow(symbol, freq, curr_date)\nexcept NoMarketDataError:\n    cf = None  # or fall back: get_cash_flow(symbol, 'yearly', curr_date)","preventionTips":["Fall back to annual data when quarterly cash flows are missing.","Validate curr_date is within the symbol's reporting history.","Handle all statement getters (balance/cashflow/income) with the same NoMarketDataError pattern."],"tags":["market-data","yfinance","cash-flow","financials"],"backgroundTag":null,"analyzedSha":"a33fd4c0f134485a43553a2c23a63cb14adbd88f","analyzedAt":"2026-08-14T19:45:16.920Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}