How to Stop Claude from Hallucinating Stock Data

Give Claude a database instead of relying on its memory

← Back to shibui.finance

When you ask Claude "what is Tesla's P/E ratio?", it generates a plausible number from its training data. Sometimes the number is close. Sometimes it is not. There is no way to tell from the response alone, because Claude presents both real and fabricated figures with the same confidence. This is the hallucination problem in financial analysis, and it applies to every major LLM.

The fix is structural, not behavioral. Better prompts do not give Claude access to data it does not have. Shibui Finance is a free MCP server that connects Claude to 64 years of US stock market data: 31M+ daily prices, quarterly financials, daily valuations, and 56 technical indicators for nearly 10,000 companies. Once connected, Claude writes SQL queries against a real database instead of generating numbers from memory.

What goes wrong without a data source

The failures follow predictable patterns. Stale data: Claude's training has a cutoff date. It cannot know that a company's P/E changed last quarter. Confident fabrication: for less-covered stocks, Claude generates ratios from distributional priors. A hallucinated P/E of 31.4 looks precise enough to act on. Wrong time period: Claude cannot distinguish current from historical. It may return 2024 Q3 revenue when you asked about the latest quarter, with no indication the number is outdated.

Derived metric errors: ratios like EV/EBITDA or FCF yield require multiple inputs. If any one input is hallucinated, the derived figure is wrong. False citations: some models now cite sources for financial figures, but the sources do not always contain the attributed numbers. The hallucination moves from the answer to the citation.

For mega-cap stocks with heavy press coverage, headline figures (revenue, market cap) are often close to correct in recent models. The problem is worst for mid-cap and small-cap companies, historical data, and any derived metric that combines multiple data points. That is most of what investors actually need.

Why prompts and workarounds do not fix this

The most common workaround is adding a disclaimer to the system prompt: "always state when you are unsure about data." Claude may add a caveat, but the underlying number is still generated from training weights. A confident disclaimer does not make a fabricated figure real.

Uploading a CSV or PDF works for one company at a time. You download a financial statement, attach it to the conversation, and Claude reads from the document. This is accurate but does not scale. You cannot upload financials for 10,000 companies. The document goes stale the day after you download it.

Web search lets Claude pull figures from financial websites. This works for spot-checking one number, but it cannot screen thousands of companies at once, cannot run temporal queries across multiple periods, and returns data in inconsistent formats. It is a workaround, not a data infrastructure.

None of these approaches give Claude a database. They patch the symptom without fixing the cause.

The fix: connect Claude to a real database

MCP (Model Context Protocol) lets Claude connect to external data sources. Shibui Finance is an MCP server that gives Claude read access to a pre-built financial database. Once connected, Claude writes SQL queries against real data instead of generating from training weights. Every number traces back to a daily-refreshed data source (Tiingo, EODHD), not a language model.

On Shibui, you ask

"What is Tesla's current P/E ratio, and how has it changed over the past 5 years?"

Without Shibui, Claude generates a plausible P/E from training data. With Shibui, Claude queries the valuation table for Tesla's daily P/E history, returns the current value from yesterday's close, and shows the 5-year trajectory with actual dates. The difference is not the quality of the prompt. It is whether the model has access to real data.

Before and after

Simple lookup. Ask: "What is NVIDIA's P/E ratio?" Without a data source, Claude says "approximately 65" (may be months stale, may be fabricated). With Shibui, Claude queries the valuation table and returns yesterday's closing value with the exact date.

Screening. Ask: "Find stocks with P/E below 15 and positive free cash flow for 3 consecutive years." Without a data source, Claude lists companies it remembers from training, with no guarantee the criteria are currently true. With Shibui, Claude screens 9,900+ companies against actual quarterly financials and valuation data, checking each individual year.

Technical analysis. Ask: "Which stocks crossed below their 200-day moving average this week with RSI under 30?" Without a data source, Claude cannot answer. It has no price data after its training cutoff. With Shibui, Claude queries the technical indicators table, which is updated daily with 56 pre-calculated indicators including RSI, MACD, Bollinger Bands, and moving averages.

What this does not solve

Claude may still hallucinate about things outside the database: news events, management commentary, analyst opinions, macroeconomic interpretations. Shibui gives Claude financial data. It does not give Claude judgment.

The data is end-of-day, not real-time. Intraday prices and after-hours moves are not available. Coverage is US equities only (NYSE, NASDAQ). No international markets, options, crypto, or commodities. Data comes from tier-3 providers, not Bloomberg or Refinitiv. It is good for screening and analysis but not institutional-grade for regulatory compliance.

If Claude writes a wrong SQL query, the numbers will be real but the logic may be flawed. Shibui solves the data problem, not the reasoning problem. For full details on what data is available and what is not, see the data sources page.

This does not make Claude a financial advisor. It makes the numbers real.

Connect Shibui to Claude in 2 minutes

Shibui is free. Connect it to Claude and get financial data from a verified database instead of the model's training data.

Connect to Claude →