Project Gallery

Project Videos

Play

Cofinance Analyst

The Autonomous Investment Committee: A Multi-Agent System for Hybrid Asset Analysis & Interactive Visualization.

GitHub Repository


Problem Statement

Retail investment analysis is currently a fragmented, cognitive nightmare. To perform due diligence on a single asset, an investor is forced to juggle multiple disconnected platforms: TradingView for technical charts, Yahoo Finance for fundamental data, and X (Twitter)/Google for sentiment analysis.

This “context switching” leads to decision fatigue and missed opportunities. Furthermore, when investors turn to standard LLMs (like ChatGPT) for help, they face two critical risks:

  1. Hallucination: AI making up prices or referencing outdated financial data.
  2. Context Collapse: AI applying the wrong analytical framework to the wrong asset class. For example, trying to analyze Bitcoin using a P/E ratio, or treating a stable utility stock like a volatile meme coin.

We realized the world doesn’t need another chatbot. It needs an Autonomous Investment Committee that unifies these streams into a single, rigorous, data-backed conversation.


Why Agents?

Standard procedural code cannot handle the nuance of financial markets, and standalone LLMs lack access to real-time truth. Agents are the only solution because they bridge this gap.

We utilized a Multi-Agent Architecture because finance requires specialization, not generalization.

  • A single model trying to do everything often gets confused or lazy.
  • By splitting roles—a Data Analyst (who speaks Python and code), a News Researcher (who speaks search), and a Team Manager (who speaks strategy)—we reduce error rates significantly.
  • Crucially, agents allow for “Hybrid Reasoning.” Our Manager Agent can dynamically detect if the user is asking about a stock or a crypto asset and autonomously swap its “Analysis Protocol” (Risk Management vs. Fundamental Growth) without the user needing to prompt it.

What You Created (Architecture)

Cofinance Analyst is a Hub-and-Spoke Multi-Agent System powered by Google Gemini 2.0 Flash and orchestrated via Phidata.

The Core Components:

  1. The Manager (Team Lead):
    This agent acts as the brain. It utilizes Chain of Thought (CoT) reasoning to plan a strategy before acting. It breaks down user queries, classifies the asset type, and delegates tasks.

  2. The Data Analyst (The Technician):
    Equipped with yfinance and plotly. It doesn’t just return text; it writes and executes Python code to generate interactive, zoomable charts that are rendered directly in the chat stream.

  3. The News Researcher (The Fundamentalist):
    Uses duckduckgo_search to find real-time macro news, filtering out product support pages to focus on financial sentiment.

  4. The Memory Bank:
    We integrated SQLite to provide persistent long-term memory. The agent remembers the user’s “Watchlist” across different sessions, allowing for portfolio-level queries like “How is my portfolio doing today?”

The Differentiator: “Risk Guardian” Logic

We implemented a unique logic layer where the agents treat Crypto differently than Stocks.

  • If AAPL is requested, the agents analyze Earnings and P/E Ratios.
  • If BTC is requested, the Manager activates “Risk Guardian Mode,” prioritizing the Fear & Greed Index, Volatility metrics, and Distance from All-Time Highs (ATH) to protect the user from hype.

Demo

  1. Transparency:
    The UI displays a “Reasoning Log” showing the Manager classifying the intent and delegating tasks.

  2. Visuals:
    The Data Analyst generates an interactive stock chart for NVDA.

  3. Synthesis:
    The Manager combines the strong earnings report of NVDA with the high volatility warning for BTC.

  4. Context:
    If the user then asks, “Which is riskier?”, the agent retrieves the previous data from its short-term memory to provide a side-by-side comparison table without re-fetching data.


The Build

We built Cofinance using a modern AI stack designed for speed and reliability:

  • Orchestration: Phidata for managing agent teams, tools, and memory.
  • Model: Google Gemini via the Gemini API. Chosen for its massive context window and speed in generating Python visualization code. Also supports LM Studio and OpenRouter options.
  • Frontend: Streamlit. Customized with a dark, “terminal-style” aesthetic and split-pane layout (Chat vs. Live Watchlist).
  • Tools: yfinance (Market Data), DuckDuckGo (Search), Plotly (Visualization), SQLite (Storage).
  • Deployment: The application is Dockerized and deployed on Render to ensure reliable API access and 24/7 availability.