← Back to all spotlights

Inside virattt/financial-agent: Multi-Agent Market Analysis

Ditch LLM hallucinations on stock metrics. Build a modular multi-agent financial research team using virattt/financial-agent and real-time market data.

P24
By Pickwise24 Editorial Team
Verified Open-Source Review

Ask any standard large language model to analyse an equity balance sheet, and you will quickly run into a familiar catastrophe. At best, it feeds you stale training data from eighteen months ago. At worst, it hallucinates a sparkling 40% operating margin for a company currently barrelling toward insolvency. When numbers actually matter, treating a singular general-purpose LLM like an equity research associate is a recipe for tears.

Enter virattt/financial-agent, an open-source project by Virat Singh that tackles this failure mode head-on. Instead of relying on one hallucination-prone prompt to do the heavy lifting, it deploys a collaborative squad of specialised AI agentsβ€”dividing quantitative metric retrieval, news sentiment scraping, and report synthesis into distinct, deterministic workflows.


What is virattt/financial-agent?


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   virattt/financial-agent                β”‚
β”‚                                                          β”‚
β”‚  Entity Type:       Multi-Agent Financial Framework      β”‚
β”‚  Primary Language:  Python                               β”‚
β”‚  Core Dependencies: Phidata / Agno, YFinance, DuckDuckGo  β”‚
β”‚  Primary Function:  Automated equity research, live data β”‚
β”‚                     fetching, multi-source synthesis     β”‚
β”‚  Repository URL:    github.com/virattt/financial-agent   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Definition: virattt/financial-agent is an open-source Python framework designed to perform automated, end-to-end investment research. It choreographs autonomous agents equipped with distinct toolingsβ€”such as live Yahoo Finance connectors and web search scrapersβ€”to fetch market fundamentals, interpret price action, track sector news, and compile institutional-style financial memos.


Why Vanilla Prompts Fail at Financial Research

The technical consensus across developer forums and AI finance channels is straightforward: LLMs do not calculate; they predict tokens. When a prompt asks for price-to-earnings (P/E) ratios, free cash flow yields, or moving averages, a solitary model will happily autocomplete a plausible-looking number rather than admitting it has no active terminal connection.

virattt/financial-agent breaks this deadlock by enforcing separation of concerns:

1. Deterministic Data Ingestion: Math and market statistics are strictly offloaded to external APIs (yfinance), stripping the LLM of its opportunity to fabricate revenue figures.

2. Role Specialisation: One agent behaves strictly as a fundamental analyst (evaluating balance sheets and multiples), while another monitors qualitative market signals (macro news, analyst downgrades, executive turnover).

3. Synthesis & Validation: A lead coordinator synthesises findings into a structured markdown report, highlighting conflicting indicators rather than glossing over them.


Single Prompt vs. Multi-Agent Pipeline

Metric / CapabilityRaw LLM Promptvirattt/financial-agent Pipeline
Data RecencyLimited to knowledge cutoffReal-time (live market feeds via API)
Metric AccuracyHigh hallucination probabilityDeterministic API retrieval
Qualitative SearchStatic or ungroundedLive web search via DuckDuckGo / Tavily
Separation of TasksMonolithic prompt degradationIsolated agents with explicit system roles
Output ConsistencyVaries wildly per generationFormatted, modular markdown analyst briefings

Architectural Walkthrough

The framework typically relies on lightweight agent orchestration libraries (such as Phidata/Agno) to handle tool calls and conversation context.


                           [ User Query: "Analyse NVDA" ]
                                         β”‚
                                         β–Ό
                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                             β”‚  Team Lead / Orchestr. β”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                         β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β–Ό                                         β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚  Financial Analyst  β”‚                   β”‚    News Researcher   β”‚
         β”‚  (YFinance Tools)   β”‚                   β”‚   (DuckDuckGo Search)β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚                                         β”‚
                    β”‚  β€’ Current Price                        β”‚  β€’ Recent Earnings Notes
                    β”‚  β€’ Fundamentals / P/E                   β”‚  β€’ Macro Environment
                    β”‚  β€’ Analyst Targets                      β”‚  β€’ Industry Sentiment
                    β”‚                                         β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                         β”‚
                                         β–Ό
                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                             β”‚ Final Research Dossierβ”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • The Financial Data Agent: Initialised with tools that query market tickers, analyst recommendations, target prices, company overview parameters, and quarterly balance updates. It cannot browse general web pages; its job is purely quantitative extraction.
  • The Web & Sentiment Agent: Restricted to search indexes. It queries news sources for recent corporate actions, SEC filings summaries, and macroeconomic factors impacting the sector.
  • The Orchestrator: Receives raw outputs from both sub-agents, harmonises dates and currency denominations, checks for discrepancies, and renders the final brief.

Local Setup and Installation

Setting up the repository on your local machine requires Python 3.10+ and standard API credentials (an OpenAI or Groq API key for LLM reasoning, depending on your chosen backend).


# Clone the repository
git clone https://github.com/virattt/financial-agent.git
cd financial-agent

# Create and activate a clean virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install required dependencies
pip install -r requirements.txt

Set up your environment variables by creating a .env file in the project root:


OPENAI_API_KEY=your_openai_api_key_here
# Optional: alternative model provider configurations
# GROQ_API_KEY=your_groq_api_key_here

Running a Multi-Agent Briefing

Below is a minimal representation of how the framework establishes the multi-agent collective to produce a stock brief:


from phi.agent import Agent
from phi.model.openai import OpenAIChat
from phi.tools.yfinance import YFinanceTools
from phi.tools.duckduckgo import DuckDuckGo

# 1. Instantiate the Financial Quantitative Agent
finance_agent = Agent(
    name="Finance Analyst",
    role="Retrieve and analyse core financial fundamentals and metrics",
    model=OpenAIChat(id="gpt-4o"),
    tools=[
        YFinanceTools(
            stock_price=True,
            analyst_recommendations=True,
            stock_fundamentals=True,
            company_info=True,
        )
    ],
    instructions=["Always format financial figures in tables for clarity."],
    show_tool_calls=True,
    markdown=True,
)

# 2. Instantiate the News & Qualitative Agent
news_agent = Agent(
    name="News Analyst",
    role="Gather recent sector and company news updates",
    model=OpenAIChat(id="gpt-4o"),
    tools=[DuckDuckGo()],
    instructions=["Only cite reputable financial outlets; include sources."],
    show_tool_calls=True,
    markdown=True,
)

# 3. Create the Team Lead Orchestrator
multi_agent = Agent(
    team=[finance_agent, news_agent],
    model=OpenAIChat(id="gpt-4o"),
    instructions=[
        "First, instruct the Finance Analyst to pull core fundamentals.",
        "Then, instruct the News Analyst to check for major news over the last 14 days.",
        "Synthesise both inputs into a concise research brief. Include risk factors.",
    ],
    show_tool_calls=True,
    markdown=True,
)

# Run the pipeline
multi_agent.print_response(
    "Provide a detailed investment research memo on ARM Holdings (ARM).",
    stream=True
)

What Developers Are Saying

Across developer communities and YouTube architecture teardowns, this implementation pattern draws praise for avoiding over-engineering. While massive frameworks often trap developers in endless graph nodes and state machines, Virat Singh’s blueprint sticks to an accessible pattern: clean tool wrappers, dedicated personas, and immediate terminal outputs.

The primary friction point highlighted in discussions is latency. Chaining multiple tool-assisted LLM runs sequentially means a single stock evaluation can take anywhere from 10 to 30 seconds depending on API response rates. However, as community members regularly point out: waiting half a minute for verified, API-grounded metrics is infinitely better than getting an instant, completely fabricated price target.

Key Takeaways

  • Grounding Over Guesswork: Decoupling API tool execution from text generation eliminates standard metric hallucinations.
  • Modular Design: Agents can easily be swapped, allowing you to run local open-weights models (via Ollama or vLLM) for news summarisation while reserving frontier models for final synthesis.
  • Practical Foundation: It acts as a clear reference architecture for anyone building bespoke equity research tooling, corporate intelligence bots, or autonomous market watchers.

πŸ›‘οΈ Editorial Standards & Methodology

Every repository featured on Pickwise24 undergoes testing on local workstation hardware before publication. We verify CLI installation steps, review open-source repository licensing, benchmark computational footprint, and evaluate architectural trade-offs to provide genuine, high-utility developer intelligence.