TauricResearch/TradingAgents · error · NoMarketDataError
no fundamentals returned
Error message
no fundamentals returned
What it means
NoMarketDataError raised by get_fundamentals (y_finance.py) when yfinance's ticker.info comes back empty/None. An empty info dict means Yahoo returned no company profile — typically an unknown or delisted symbol. Raising a typed error (instead of returning prose) lets the routing layer emit one unambiguous unavailable signal.
Source
Thrown at tradingagents/dataflows/y_finance.py:285
f"Error getting stockstats indicator data for indicator {indicator} on {curr_date}: {e}"
)
return ""
return str(indicator_value)
def get_fundamentals(
ticker: Annotated[str, "ticker symbol of the company"],
curr_date: Annotated[str, "current date (not used for yfinance)"] = None
):
"""Get company fundamentals overview from yfinance."""
canonical = normalize_symbol(ticker)
try:
ticker_obj = yf.Ticker(canonical)
info = yf_retry(lambda: ticker_obj.info)
if not info:
raise NoMarketDataError(ticker, canonical, "no fundamentals returned")
fields = [
("Name", info.get("longName")),
("Sector", info.get("sector")),
("Industry", info.get("industry")),
("Market Cap", info.get("marketCap")),
("PE Ratio (TTM)", info.get("trailingPE")),
("Forward PE", info.get("forwardPE")),
("PEG Ratio", info.get("pegRatio")),
("Price to Book", info.get("priceToBook")),
("EPS (TTM)", info.get("trailingEps")),
("Forward EPS", info.get("forwardEps")),
("Dividend Yield", info.get("dividendYield")),
("Beta", info.get("beta")),
("52 Week High", info.get("fiftyTwoWeekHigh")),
("52 Week Low", info.get("fiftyTwoWeekLow")),
("50 Day Average", info.get("fiftyDayAverage")),
("200 Day Average", info.get("twoHundredDayAverage")),View on GitHub (pinned to a33fd4c0f1)
Solutions
- Confirm the symbol resolves on Yahoo Finance (quote page loads) before calling.
- Catch NoMarketDataError and degrade gracefully — skip fundamentals analysis for that symbol.
- If the symbol is valid but Yahoo is flaky, retry after a delay; persistent emptiness means the symbol is unsupported.
Example fix
# before
report = get_fundamentals('FOOBAR')
# after
from tradingagents.dataflows.errors import NoMarketDataError
try:
report = get_fundamentals('FOOBAR')
except NoMarketDataError:
report = None # fundamentals unavailable for this symbol Defensive patterns
Strategy: try-catch
Validate before calling
import yfinance as yf
def has_fundamentals(symbol: str) -> bool:
info = yf.Ticker(symbol).info
return bool(info) Try / catch
from tradingagents.dataflows.errors import NoMarketDataError
try:
report = get_fundamentals(symbol)
except NoMarketDataError:
report = None # mark fundamentals unavailable; skip that analyst step Prevention
- Maintain a whitelist of verified tickers for automated runs.
- Distinguish 'bad symbol' from 'Yahoo outage' before disabling a symbol permanently.
- Route all NoMarketDataError handling through one place in your orchestration code.
When it happens
Trigger: Calling get_fundamentals(ticker) where yf.Ticker(canonical).info is falsy — unknown ticker, delisted company, or Yahoo's profile endpoint failing. The `if not info` check fires before any field extraction.
Common situations: Typo'd or OTC-only symbols, recently delisted companies, Yahoo API changes/rate limiting causing empty .info payloads, or symbols valid on other data providers but not Yahoo.
Related errors
- no rows between {start_date} and {end_date}
- no fundamental fields returned
- no balance sheet data
- no cash flow data
- no income statement data
AI-assisted analysis of TauricResearch/TradingAgents@a33fd4c0f1 (2026-08-14).
Data as JSON: /api/errors/3e7e5e4b3a47f31d.
Report an issue: GitHub.