TauricResearch/TradingAgents · error · NoMarketDataError

no income statement data

Error message

no income statement data

What it means

NoMarketDataError raised by get_income_statement (y_finance.py) when the date-filtered income-statement frame is empty. Identical guard to the balance-sheet/cash-flow getters: unknown symbol, or curr_date earlier than the first statement period, so filter_financials_by_date produces an empty frame.

Source

Thrown at tradingagents/dataflows/y_finance.py:429

def get_income_statement(
    ticker: Annotated[str, "ticker symbol of the company"],
    freq: Annotated[str, "frequency of data: 'annual' or 'quarterly'"] = "quarterly",
    curr_date: Annotated[str, "current date in YYYY-MM-DD format"] = None
):
    """Get income statement data from yfinance."""
    canonical = normalize_symbol(ticker)
    try:
        ticker_obj = yf.Ticker(canonical)

        if freq.lower() == "quarterly":
            data = yf_retry(lambda: ticker_obj.quarterly_income_stmt)
        else:
            data = yf_retry(lambda: ticker_obj.income_stmt)

        data = filter_financials_by_date(data, curr_date)

        if data.empty:
            raise NoMarketDataError(ticker, canonical, "no income statement data")

        # Convert to CSV string for consistency with other functions
        csv_string = data.to_csv()

        # Add header information
        header = f"# Income Statement data for {canonical} ({freq})\n"
        header += f"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n"

        return header + csv_string

    except NoMarketDataError:
        raise
    except Exception as e:
        return f"Error retrieving income statement for {ticker}: {str(e)}"


def get_insider_transactions(
    ticker: Annotated[str, "ticker symbol of the company"]

View on GitHub (pinned to a33fd4c0f1)

Solutions

  1. Move curr_date forward to a period where statements exist (or use today).
  2. Fall back to freq='yearly' when quarterly statements are missing.
  3. Catch NoMarketDataError and mark income-statement analysis unavailable.

Example fix

# before
inc = get_income_statement('FOOBAR', 'quarterly', '2012-06-01')

# after
from tradingagents.dataflows.errors import NoMarketDataError
try:
    inc = get_income_statement('FOOBAR', 'quarterly', '2012-06-01')
except NoMarketDataError:
    inc = get_income_statement('FOOBAR', 'yearly', '2012-12-31')  # or None
Defensive patterns

Strategy: try-catch

Validate before calling

import yfinance as yf

def has_income_stmt(symbol: str, freq: str = 'yearly') -> bool:
    obj = yf.Ticker(symbol)
    frame = obj.quarterly_income_stmt if freq == 'quarterly' else obj.income_stmt
    return frame is not None and not frame.empty

Try / catch

from tradingagents.dataflows.errors import NoMarketDataError

try:
    inc = get_income_statement(symbol, freq, curr_date)
except NoMarketDataError:
    inc = None  # or try yearly freq / later curr_date

Prevention

When it happens

Trigger: Calling get_income_statement(ticker, freq, curr_date) with a symbol lacking income statements on Yahoo, or a curr_date before the earliest filing; requesting 'quarterly' when only annual data exists.

Common situations: Backtests reaching before the company's first annual report, young companies, foreign listings with sparse Yahoo coverage, delisted symbols.

Related errors


AI-assisted analysis of TauricResearch/TradingAgents@a33fd4c0f1 (2026-08-14). Data as JSON: /api/errors/b6be893a5c424343. Report an issue: GitHub.