AI Agents for Finance Series — Part 3 of 5

Building Analyst Agents — Automated Research & Scoring

The complete pipeline from raw data to institutional-grade analysis. How to build agents that collect financial data, extract structured insights, run sentiment analysis, benchmark against peers, generate comprehensive reports, and self-verify every claim for accuracy.

Data Ingestion Structured Extraction Scoring System Anti-Hallucination
AI Agents for Finance3/5
Analyst WorkflowData IngestionStructured ExtractionSentiment AnalysisPeer BenchmarkingReport GenerationAnti-HallucinationKey Takeaways
The Pipeline

The Analyst Agent Workflow

A human financial analyst follows a predictable workflow: collect data, analyze it across multiple dimensions, synthesize findings, and produce a recommendation. An analyst agent follows the exact same workflow — but executes it in 10 minutes instead of 6 hours, with perfect consistency across every report.

1

Data Collection

Fetch quotes, historical bars, financials, earnings, insider activity, analyst consensus, sentiment, options chain, and news via MCP tools and web search. This is the raw material for the analysis.

2

Structured Extraction

Transform raw data into structured dimensions: technical score, fundamental score, sentiment score, risk score. Each dimension uses a consistent rubric with numerical ratings.

3

Comparative Analysis

Benchmark the stock against peers in the same sector, against its own history, and against market averages. Identify relative strengths and weaknesses.

4

Synthesis & Recommendation

Combine all dimensions into a composite score and investment thesis. Generate trade ideas with entry, stop, and target levels when warranted.

5

Report Generation

Produce a 50-100KB institutional-grade HTML report with ECharts visualizations, data tables, trade boxes, and structured navigation.

6

Quality Assurance

Verify file size, validate data citations against live sources, check for hallucinated numbers, run anti-doublon checks, index and deploy.

Human Analyst vs. Agent Analyst
6 hours manual → 10 minutes autonomous → 5 minutes human review = 36x productivity gain
Raw Material

Data Ingestion: Building the Information Base

The quality of an analysis is bounded by the quality of its data. An analyst agent's first task is to build a comprehensive information base for the target security. Here is the full data matrix that a production analyst agent collects:

Data Category MCP Tool / Source Key Fields Use
Price & Volume QueryData: quote, bars_daily, bars_intraday Price, change%, 52W range, volume, VWAP Current positioning, trend assessment
Technical Indicators QueryData: trading_signals, support_resistance RSI, MACD, EMAs, S/R levels, volume profile Technical score, entry/exit levels
Fundamentals QueryData: financials, stats Revenue, EPS, PE, PB, ROE, debt/equity, FCF Valuation assessment, financial health
Earnings QueryData: earnings_quarterly Beat/miss history, surprise %, guidance Earnings quality, trend
Analyst Coverage QueryData: analyst_actions Upgrades, downgrades, PT changes, consensus Street sentiment, PT upside
Insider Activity QueryData: insider_transactions Buy/sell transactions, 10b5-1 plans, cluster buys Smart money signal
Sentiment QueryData: sentiment_overall Bull/bear ratio, social mentions, news tone Crowd positioning
Holders QueryData: holders Institutional %, top holders, recent changes Institutional conviction
Options QueryData: options_chain IV percentile, put/call ratio, max pain, OI Expected move, hedging activity
News QueryData: news + WebSearch Headlines, catalysts, regulatory actions Event risk, narrative assessment
Short Interest QueryData: ctb (cost to borrow) Short %, days to cover, CTB rate Bear conviction, squeeze potential
Data Collection — Full Agent Call Sequence
// Step 1: Core data via single MCP call
GetInstruments(symbols=["NVDA"])
→ Returns comprehensive snapshot: price, fundamentals, technicals

// Step 2: Detailed time-series and flow data
QueryData(
  types="quote,bars_daily,bars_intraday,financials,
         earnings_quarterly,holders,stats,support_resistance,
         volume_profile,sentiment_overall,trading_signals,
         analyst_actions,insider_transactions,ctb,news",
  symbols="NVDA"
)

// Step 3: Options data (if equity)
QueryData(types="options_chain", symbols="NVDA")

// Step 4: Recent news and catalysts
WebSearch("NVIDIA NVDA latest news earnings catalyst 2026")
WebSearch("NVDA analyst upgrade downgrade this week")

The Data Completeness Principle

A common mistake in automated analysis is collecting too little data and compensating with LLM reasoning. This invites hallucination. The opposite approach is better: collect exhaustive data and let the LLM summarize and synthesize. An LLM summarizing real data is reliable. An LLM inventing data is dangerous. The rule: when in doubt, fetch more data.

From Raw to Structured

Structured Extraction: Turning Data into Scores

Raw data is useless until it is structured into comparable dimensions. The analyst agent applies a consistent scoring rubric that converts 50+ data points into a small set of dimensional scores.

The Multi-Dimensional Scoring Framework

Analyst Agent Scoring Rubric
SCORING RUBRIC — Each dimension 0-10

Technical Score (weight: 0.25)
  RSI 30-50 oversold bounce zone:    +2
  Price above EMA50:                  +1
  Price above EMA200:                 +1
  MACD bullish crossover:             +2
  Volume confirmation (> 1.2x avg):   +1
  Near support level (< 3%):          +2
  Clean chart pattern (base/flag):    +1
  Max: 10

Fundamental Score (weight: 0.30)
  PE below sector average:            +2
  Revenue growth > 10% YoY:           +2
  EPS beat 3+ consecutive quarters:   +2
  ROE > 15%:                          +1
  Debt/Equity < 1.0:                  +1
  FCF yield > 3%:                     +1
  Margin expansion YoY:               +1
  Max: 10

Sentiment Score (weight: 0.20)
  Analyst consensus Buy (> 70%):      +2
  PT upside > 15%:                    +2
  Insider buying (non-routine):       +3
  Social sentiment bullish:           +1
  Short interest declining:           +1
  Institutional accumulation:         +1
  Max: 10

Risk Score (weight: 0.25)
  Beta < 1.5:                         +2
  IV percentile < 50:                 +1
  Clear stop loss level:              +2
  R/R ratio > 2:1:                    +2
  No earnings in 2 weeks:             +1
  No regulatory overhang:             +1
  Portfolio correlation < 0.6:        +1
  Max: 10

Composite = Tech*0.25 + Fund*0.30 + Sent*0.20 + Risk*0.25
  A+: >= 8.5  |  A: >= 7.5  |  B+: >= 6.5
  B:  >= 5.5  |  C: >= 4.5  |  D: < 4.5

Extraction from SEC Filings

For deep-dive analyses, agents can process SEC filings (10-K, 10-Q, 8-K) to extract metrics not available in standard data feeds:

Risk Factors

Extract and categorize risk factors from 10-K. New risks vs. prior filing indicate emerging concerns.

Management Commentary

Parse MD&A section for tone shifts, guidance language, and strategic pivots that numbers alone miss.

Segment Breakdown

Extract revenue and margin by business segment. Identify which segments are growing vs. dragging.

Related Party Transactions

Flag unusual related party deals, executive compensation changes, and governance red flags.

Market Psychology

Sentiment Analysis: Reading the Market's Mood

Quantitative data tells you where a stock is. Sentiment tells you where the crowd thinks it is going — and whether that crowd is right or wrong. Analyst agents combine multiple sentiment signals into a composite view.

Sentiment Sources Hierarchy

Source Signal Quality Lead Time Agent Access
Insider Transactions Highest (skin in the game) 1-3 months MCP: insider_transactions
Institutional 13F High (smart money) 45 days delayed MCP: holders
Analyst Actions Medium-high (professional) 0-7 days MCP: analyst_actions
Options Flow Medium (positioning) Real-time MCP: options_chain
News Tone Medium (narrative) Real-time MCP: news + WebSearch
Social Media Low-medium (noisy) Real-time MCP: sentiment_overall
Reddit/StockTwits Low (retail noise) Real-time WebSearch

The Contrarian Signal

Sentiment is most useful at extremes. When 90%+ of social media is bullish on a stock, it often means the easy money has been made and a pullback is coming (everyone who wanted to buy already has). When sentiment is deeply bearish but fundamentals are intact, it can signal a buying opportunity. The analyst agent weighs sentiment as a confirming or contrarian signal, never as the primary driver. Insider buying during a period of deep retail pessimism is one of the strongest bullish signals in markets.

Earnings Call Tone Analysis

Agents can analyze earnings call transcripts for tone shifts that predict future performance:

Earnings Call Tone Extraction
// Agent prompt for earnings call analysis
Analyze this earnings call transcript for:

1. Confidence indicators:
   - "We are confident" / "We expect" (strong)
   - "We hope" / "We believe" (weak)
   - Frequency of hedging language ("approximately", "roughly")

2. Forward guidance tone:
   - Raised / maintained / lowered
   - Specific numbers vs. vague ranges
   - Management's tone on macro headwinds

3. Red flag phrases:
   - "One-time charge" / "Non-recurring"
   - "Challenging environment" / "Headwinds"
   - "Strategic review" / "Exploring alternatives"

4. Positive signals:
   - "Record" / "Strongest quarter"
   - "Accelerating" / "Expanding margins"
   - "Returning capital" / "Increasing dividend"

Output: tone_score (-5 to +5), key_quotes[], red_flags[]
Relative Analysis

Comparative Analysis: Peer Benchmarking

No stock exists in isolation. An analyst agent evaluates every security relative to its peers, its sector, and the broader market. This comparative analysis is where agents truly shine — they can process 10 peer companies as easily as one.

The Benchmarking Matrix

Peer Comparison — Agent Workflow
// Step 1: Identify peers (same sector, similar market cap)
Target: NVDA (Semiconductors, $3.5T)
Peers: AMD, INTC, AVGO, QCOM, TXN

// Step 2: Fetch comparable data for all
QueryData(
  types="quote,financials,stats,earnings_quarterly",
  symbols="NVDA,AMD,INTC,AVGO,QCOM,TXN"
)

// Step 3: Build comparison matrix
Metrics: PE, PEG, Revenue Growth, Gross Margin,
         ROE, Debt/Equity, FCF Yield, EPS Growth

// Step 4: Rank and highlight outliers
NVDA ranks:
  PE: 5th/6 (most expensive) — BUT
  Revenue Growth: 1st/6 (highest growth justifies premium)
  Gross Margin: 1st/6 (73% — structural moat)
  ROE: 1st/6 (exceptional capital efficiency)
  Verdict: Premium valuation justified by best-in-class growth

Sector Positioning Map

The agent generates a scatter plot positioning the target stock against peers across two key dimensions (typically valuation vs. growth). This provides an instant visual read on whether the stock is over or underpriced relative to peers.

The Valuation Trap

A stock can look "cheap" on PE but be a value trap (declining business). A stock can look "expensive" on PE but be a great investment (accelerating growth). The agent's comparative analysis adjusts for growth by using PEG ratio (PE / EPS growth) and forward multiples. NVDA at 68x trailing PE looks expensive. NVDA at 2.1x PEG with 32% EPS growth looks reasonable. Context is everything.

The Deliverable

Report Generation: From Data to Deliverable

The final output of an analyst agent is an institutional-grade research report. In the DailyTickers system, these are 50-100KB HTML files with structured navigation, interactive ECharts visualizations, data tables, trade ideas, and a consistent visual identity.

The Report Template Architecture

Every analyst report follows a standardized structure defined in the project's CLAUDE.md. This ensures consistency across hundreds of analyses:

1

Hero Section

Ticker, price, change%, key badges (sector, grade, market cap tier), variant switcher for language/level

2

Navigation

FAB floating menu with 6-8 section shortcuts. Brand bar with home link. Series bar if part of a series.

3

Overview Dashboard

Score metrics row, company snapshot, key fundamentals grid. Radar chart for multi-dimensional score.

4

Technical Analysis

Support/resistance levels, trend assessment, chart patterns, momentum indicators. ECharts for price action.

5

Fundamental Deep Dive

Revenue/earnings trends, margin analysis, valuation vs. peers, cash flow quality. Compare tables and bar charts.

6

Sentiment & Flow

Social radar, analyst consensus, insider activity, options positioning. Gauge charts for sentiment scores.

7

Trade Idea

Entry zone, stop loss, TP1/TP2, R/R ratio, confirmation/invalidation signals, timing/sizing guidance.

8

Disclaimer & Sources

Risk warnings, data sources, publication date, history modal for version tracking.

ECharts Visualization Strategy

A single analysis report typically includes 6-10 ECharts visualizations. The agent selects chart types based on data characteristics:

Data Type Chart Type Use Case
Multi-dimensional scores Radar chart Technical/Fundamental/Sentiment/Risk spider
Revenue/earnings history Bar + line combo Revenue bars with EPS growth line overlay
Peer comparison Horizontal bar Valuation metrics ranked across peers
Sector allocation Treemap or pie Revenue by segment, holder distribution
Sentiment meter Gauge Bull/bear ratio, Fear & Greed index
Correlation matrix Heatmap Sector correlations, portfolio overlap
Price positioning Scatter Valuation vs. growth across peers

The Visualization Principle

Every chart must answer a specific question. "What does this chart tell me that a table cannot?" If you cannot answer that question in one sentence, the chart does not belong in the report. A radar chart instantly shows that NVDA excels technically but lags on valuation — a table of 10 numbers requires mental processing to reach the same conclusion. The agent is trained to select the visualization that delivers the insight with minimum cognitive load.

Trust & Verify

Anti-Hallucination: Ensuring Data Integrity

The single biggest risk in AI-generated financial analysis is hallucination — the model confidently stating incorrect facts. In finance, a hallucinated price, a fabricated earnings number, or an invented analyst upgrade can lead to real financial losses. Anti-hallucination is not optional; it is the foundation of trust.

Real Hallucination Examples

"AAPL reported Q2 2026 EPS of $2.18, beating estimates by 12%" — Completely fabricated. The model generated a plausible-sounding but fictional earnings number because it was asked to analyze before the actual report was released. This kind of hallucination is dangerous because it sounds authoritative.

The Anti-Hallucination Stack

1. Ground in Live Data

Every numerical claim must trace back to a tool call result. Never let the model generate prices, PE ratios, or earnings numbers from memory.

2. Cite Sources

Every data point must have an explicit source: "Price: $198.50 (MCP:quote, 2026-03-06 14:32 UTC)". If a claim has no source, it should not be in the report.

3. Express Uncertainty

"Based on available data..." / "Estimated..." / "Unable to verify..." — The agent must communicate confidence levels, not pretend certainty.

4. Cross-Validate

For critical claims (earnings, insider activity), verify against a second source. MCP data + web search confirmation = validated fact.

5. Spot Price Check (P0)

Every trade idea must validate entry price against live quote. If entry differs by >10% from spot, reject the setup. This catches stale or fabricated prices.

6. File Size Gate

A complete analysis should be 50-100KB. Below 10KB, sections are missing. Below 50KB, the analysis is likely superficial. These bounds catch truncated or incomplete outputs.

Anti-Hallucination Prompt Template
CRITICAL INSTRUCTIONS:

1. NEVER generate a price, PE ratio, revenue figure, or EPS
   number from your training data. Always use the values
   returned by MCP tool calls in this conversation.

2. If a data point is unavailable (tool returned null or error),
   write "Data unavailable" — do NOT estimate or approximate.

3. For every numerical claim, include the source in parentheses:
   "Revenue: $35.1B (MCP:financials)"

4. Before generating a trade idea, validate:
   - Entry price within 10% of live quote (MCP:quote)
   - Stop loss at a real technical level (MCP:support_resistance)
   - Target at a real resistance level, not a round number

5. If you are uncertain about any claim, prefix with
   "Based on available data..." or "Note: this could not
   be independently verified."

6. NEVER say "as of my last update" — you have live data.
   Say "as of [date from tool response]" instead.

The Trust Spectrum

Not all agent outputs need the same level of verification. The trust spectrum for financial analysis: Qualitative commentary (low risk — the model's interpretation of data) needs light review. Quantitative claims (medium risk — specific numbers) need source verification. Trade recommendations (high risk — money at stake) need both data verification AND logical validation of the trade thesis. The anti-hallucination stack applies proportionally: more critical outputs get more validation layers.

Summary

Key Takeaways

Building Analyst Agents

Quiz: Test Your Understanding

Q1: What is the most important anti-hallucination technique for financial agents?

A: Grounding every numerical claim in live data from tool calls (MCP, API), never from model memory. If a data point is unavailable, the agent must say "data unavailable" rather than estimate.

Q2: Why is PEG ratio better than PE ratio for peer comparison?

A: PE alone does not account for growth. A stock at 60x PE with 30% growth (PEG 2.0) may be cheaper than a stock at 15x PE with 3% growth (PEG 5.0). PEG adjusts valuation for the growth rate.

Q3: Which sentiment source has the highest signal quality and why?

A: Insider transactions, because insiders have the most information about their company and are putting their own money at stake. Non-routine insider buying (not 10b5-1 plans) is one of the strongest bullish signals.

Next — Part 4 of 5
Trading Agents — From Signals to Execution
AI Agents for Finance3/5