HKUDS/Vibe-Trading · error · ValueError

no close prices returned for any requested symbol

Error message

no close prices returned for any requested symbol

What it means

Raised by PortfolioRiskTool._closes_frame after shaping the market-data fetch envelope: if not a single requested symbol produced a close-price series, an empty frame would make downstream risk math meaningless, so it aborts. This means the fetch returned bars for none of the symbols (or the payload had no usable close/date fields for any of them).

Source

Thrown at agent/src/tools/portfolio_risk_tool.py:193

                if not isinstance(record, Mapping) or "close" not in record:
                    continue
                when = next((record[k] for k in _DATE_KEYS if k in record), None)
                try:
                    price = float(record["close"])
                except (TypeError, ValueError):
                    continue
                times.append(when)
                prices.append(price)
            if not prices:
                continue
            # Mixed typed/untyped timestamps can't be sorted together; when any
            # bar lacks a date, trust loader order (chronological) instead.
            if any(when is None for when in times):
                series[sym] = pd.Series(prices, name=sym)
            else:
                series[sym] = pd.Series(prices, index=times, name=sym).sort_index()
        if not series:
            raise ValueError("no close prices returned for any requested symbol")
        return pd.DataFrame(series)

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Verify each requested symbol is a valid, currently listed ticker
  2. Inspect the raw fetch envelope to confirm the loader actually returned bars (check for auth/entitlement errors surfacing as empty data)
  3. Test with a single well-known symbol like AAPL to isolate basket-wide vs symbol-specific issues
  4. If the envelope shape changed, update _closes_frame's shaping logic to match the new schema
Defensive patterns

Strategy: try-catch

Try / catch

try:
    frame = tool._closes_frame(raw_payload, symbols)
except ValueError as e:
    if "no close prices" in str(e):
        raise RuntimeError(f"market data unavailable for {symbols}; check tickers/API access") from e

Prevention

When it happens

Trigger: Requesting a basket where every symbol ticker is invalid/delisted/renamed; the upstream market-data API returning an envelope with empty or missing 'bars'/'prices' arrays for all symbols; a payload schema change so the close-price extraction finds nothing.

Common situations: Typo'd or delisted tickers across the whole basket; API key or entitlement issues causing the loader to return empty results instead of an error; upstream API version changes altering the response envelope shape.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/f9c30702f54ad64b. Report an issue: GitHub.