Leveraging Generative AI for Stock Research: A Use Case for the Non-Technical Investor
A case study in grounded GenAI: an AI research assistant for stocks and mutual funds that explains the numbers in plain English but never invents them.
My father is not technical by profession. He can read a balance sheet, but the modern machinery of investing (finance portals, stock screeners, a screen full of ratios) was never his world. And yet he invests. So, again and again, he would call me with the same simple question: “Is this a good stock? Should I put money here?” Every time, I ended up doing the same thing by hand: pulling the live numbers, checking the fundamentals, and explaining them back in plain language he could act on. Kaudee (कौड़ी) is what happened when I turned that into software. It is an AI research assistant for stocks and mutual funds that does exactly what I did for him: it reads the real numbers and explains them simply, but never invents a figure. This is a case study of how it is built, and of a GenAI pattern called grounded generation that makes a language model trustworthy enough to hand to someone who takes its answer at face value.
Domain FinTech research Pattern Grounded generation LLMs Groq / open-weight Stack Python · Streamlit · Supabase Markets IN · US · SG Status Pilot
LLMs are fluent, but they will state a wrong number with total confidence, which is unacceptable in finance.
Insight
Never let the model produce numbers. Compute every figure in code first; let the LLM only interpret them.
Pattern
Grounded, context-augmented generation: deterministic facts in → plain-English judgement out.
Result
Analyst-style explanations a non-expert can act on, with zero fabricated data by construction.
02Why you can’t just point an LLM at the market
A large language model predicts the next token; it does not look up a fact. Ask it for Reliance’s P/E and it will emit a plausible-looking number drawn from patterns in its training data: possibly months stale, possibly for the wrong listing, possibly invented outright. It will not tell you which. In casual chat that is harmless. In investing, a single confidently wrong figure can move real money, and the fluency of the answer makes the error more dangerous, not less, because it reads like authority. Someone like my father, who cannot tell a real P/E from an invented one, would simply believe it and act. That is the exact person this tool is built for, and the exact reason the numbers can never be left to the model.
So the design problem was precise: keep the language model’s fluency, remove its licence to make numbers up. The comparison below frames the two failure modes and the target.
Raw LLM chatbot
×Generates numbers from memory, so it can hallucinate a P/E, NAV or expense ratio.
×No idea if a figure is current, stale, or for the wrong instrument.
×Fluency disguises the error as confidence.
×Not reproducible: same question, different numbers.
Kaudee: grounded generation
✓Every number computed deterministically in code, before the model is called.
✓Figures come from live pricing & ISIN-verified fact-sheets.
✓The LLM only interprets facts it is handed, and cannot alter them.
✓Same inputs → same figures, every time.
Two ways to fail, and the target: fluent like the chatbot, trustworthy like a terminal.
Where Kaudee sits
Fluency on one axis, numeric trustworthiness on the other. A terminal is trustworthy but unreadable; a chatbot is readable but untrustworthy. The goal is the top-right corner.
Conceptual positioning: the design goal is fluent and grounded.
03Core pattern: grounded generation
Kaudee is deliberately not a fine-tuned model, not a price-forecasting time-series model, and not vector-database RAG. It is grounded, context-augmented generation. The system splits every request into two zones: a deterministic zone where code fetches and computes every figure, and a generative zone where the LLM is handed those locked figures and asked only to explain them. The numbers are frozen before the model ever sees them.
01 · Query
User picks an instrument or asks a question
02 · Resolve
Map to a ticker / ISIN in the chosen market
03 · Fetch
Live prices, NAVs, fact-sheets, news
04 · Compute
Ratios, Sharpe/Sortino, scores, in code
05 · Ground
Assemble verified figures into structured context
06 · Generate
LLM interprets the context & streams prose
Deterministic zone: every number verifiable
Generative zone: explanation only
Facts are computed and locked in steps 3–5; the model in step 6 can phrase them, never change them.
04System architecture
Six layers, each replaceable. AI is only one band; the trust comes from the compute and data layers beneath it.
Presentation
Streamlit PWAkaudee.com (installable)Market switch: IN / US / SGTabbed hubs
Layered architecture. Swap yfinance, or swap the model, without touching the rest.
05How one AI analysis runs
What actually happens between a tap and a paragraph of insight. Note that the model is the last step, and it receives only finished numbers.
1
Resolve the instrumentApp
The user’s selection is mapped to a market-qualified symbol (e.g. RELIANCE.NS) or a mutual-fund ISIN. The active market (India / US / Singapore) decides suffixes, currency and which feature set is valid.
2
Fetch raw dataData
Live price & fundamentals from yfinance; NAV history from mfapi.in; expense ratio, AUM and holdings scraped from the fund’s fact-sheet and verified by ISIN match so the right fund is never confused for a similarly-named one; recent headlines from Google News RSS.
3
Compute the metricsCompute
In code, not in the model: valuation ratios, risk-adjusted returns (Sharpe, Sortino), rolling and multi-year returns, a composite score, and portfolio concentration flags. Missing inputs are back-filled from identities (e.g. market-cap from price × shares) rather than guessed.
4
Assemble grounded contextAI
The computed figures are serialised into a compact, labelled block and embedded in the prompt alongside a system instruction that fixes the model’s role: explain these exact numbers for a non-expert, flag risks, recommend nothing, invent nothing.
5
Generate & streamAI
A Groq-hosted open-weight model turns the context into plain-English analysis, streamed token-by-token so the reader sees it appear live. If the primary model errors or is unavailable, the request falls through to a backup model automatically.
6
Guardrail & presentApp
Output is framed as research, never advice; premium depth sits behind login. The figures on screen are the same ones the model saw, so the prose and the data can never disagree.
06Inside the AI layer
Model routing & fallback
Inference runs on Groq’s low-latency open-weight models. Rather than depend on a single model, requests route through an ordered list: the first model that responds wins, and any error, rate-limit or outage silently cascades to the next. It keeps the assistant responsive even when one backend has a bad minute.
gpt-oss-120b
primary · deepest reasoning
on error →
gpt-oss-20b
fallback · faster
on error →
compound-mini
last resort
first success →
Response
streamed to user
Ordered failover across open-weight models: reliability without a heavyweight dependency.
Prompt architecture: context engineering, not a chat
The prompt is engineered, not conversational. It has three fixed parts: a role & guardrail instruction (you are a research assistant; explain, do not advise; use only the figures given), a grounded-context block (the deterministic metrics, clearly labelled), and the user’s question. Because the numbers live in the context rather than in the model’s memory, the same prompt on any model yields the same facts, and the model is swappable precisely because it is doing interpretation, not recall.
Streaming & responsiveness
Responses stream token-by-token, so a multi-paragraph analysis feels instant rather than arriving after a long pause. It is a small detail that matters a lot on a phone, which is where most pilot users open it.
07Data pipeline and verification
The AI is only as trustworthy as the numbers under it, so the data layer does the unglamorous work. Prices and fundamentals come from yfinance; fund NAV history from mfapi.in; and the fee and holdings data that matters most (expense ratio, AUM, top holdings) is read from the fund fact-sheet and cross-checked by ISIN, the fund’s unique identifier, so a “Bluechip Fund” is never confused with a differently-managed fund of a similar name. Where a provider omits a field, Kaudee reconstructs it from a financial identity rather than leaving a blank or letting the model fill it in.
Design rule If a number cannot be computed or verified, it is shown as “–”, never estimated by the language model. A missing figure is honest; a hallucinated one is not.
08Techniques used
GenAI and engineering techniques this project exercises, read as a capability map.
Grounded generation
Deterministic in, natural language out. The model never sources a figure, the single most important choice in the build.
Context engineering
Verified metrics serialised into a structured context block so facts live in the prompt, not the weights.
Prompt architecture
Fixed role + guardrail + context + query, tuned so the model reasons like an analyst, not a chatbot.
Model routing & fallback
Ordered failover across open-weight models on Groq for low latency and resilience.
Streaming inference
Token-by-token output for a responsive, phone-first reading experience.
Guardrails & scope control
Research-only framing enforced in the product; the AI informs, never advises a trade.
Deterministic pre-compute
pandas/numpy pipeline for ratios, Sharpe/Sortino, scoring: the source of every number.
Verified data ingestion
ISIN-matched fact-sheets and identity-based back-fill instead of guesses or blanks.
Multi-market & multilingual
India, US and Singapore data; market news including Hindi sources.
Auth, membership & gating
Supabase-backed accounts with a freemium/premium boundary around the AI features.
09What runs where
Capability coverage across the three supported markets; feature availability follows each market’s data sources.
Capability
India
USA
Singapore
Stock scoring & fundamentals
✓
✓
✓
Technical signals
✓
✓
✓
AI analysis & portfolio review
✓
✓
✓
Mutual-fund metrics & screener
✓
–
–
ISIN-verified fund fact-sheets
✓
–
–
Market news (incl. Hindi)
✓
✓
✓
10Design decisions & trade-offs
Grounded generation over RAG
Hard facts here are numeric and computable, not scattered across documents. Computing them beats retrieving them, and removes the retrieval-error surface entirely.
Open-weight on Groq over a frontier API
This task is interpretation of supplied facts, not frontier reasoning. Fast, inexpensive open models are the right tool, and routing covers reliability.
No price forecasting
Deliberately excluded. Predicting prices with ML would manufacture false confidence; Kaudee explains what is, and says so.
Blanks over guesses
A missing number is shown as missing. Honesty about gaps is worth more than coverage that can’t be trusted.
11Why this pattern generalises
Strip away the finance and the shape is reusable. Anywhere an LLM has to be trustworthy with real, computable data (a pricing assistant, a clinical-metrics explainer, an ops dashboard that talks, a compliance summariser), the same split applies: compute the ground truth deterministically, hand it to the model as context, and constrain the model to interpretation. You get the fluency of GenAI without betting the outcome on the model’s memory. Kaudee is proof that the pattern works end to end, in a domain where being wrong actually costs something. And it started with the simplest test I know: could I hand it to my father, and would the answer be one he could trust?
Status & integrity Kaudee is in pilot testing. It is a research and educational tool. It presents data and AI-generated analysis, not investment advice, and every output is meant to be checked, not obeyed. In finance, owning the limits is the whole point.
Building something like this? If your product needs an LLM that stays honest with real data, this is the pattern that makes it work. Let’s talk · Open Kaudee · All tools
Dr. Pranay Jha is a Cloud and AI Consultant with 18+ years of experience in hybrid cloud, virtualization, and enterprise infrastructure transformation. He specializes in VMware technologies, multi-cloud strategy, and Generative AI solutions. He holds a PhD in Computer Applications with research focused on Cloud and AI, has published multiple research papers, and has been a VMware vExpert since 2016 and a VMUG Community Leader.
Dr. Pranay Jha is a Cloud and AI Consultant with 18+ years of experience in hybrid cloud, virtualization, and enterprise infrastructure transformation. He specializes in VMware technologies, multi-cloud strategy, and Generative AI solutions. He holds a PhD in Computer Applications with research focused on Cloud and AI, has published multiple research papers, and has been a VMware vExpert since 2016 and a VMUG Community Leader.
This site uses cookies only for anonymous analytics, to understand which guides and tools are useful. Accept to help, or decline — either way the site works fully.