Skip to content

Repository files navigation

One Search. Complete Market Intelligence.

MarketLoom is an autonomous Market & Competitor Intelligence Agent that weaves live quantitative financial data together with real-time qualitative news sentiment, then has an LLM synthesize both into a single, structured Bull vs. Bear market briefing in seconds.

Demo License Built For

Next.js TypeScript Tailwind CSS Vercel AI SDK Google Gemini Recharts

Overview · Features · How It Works · Architecture · Team ·


Overview

Researching a stock today means bouncing between a finance site for fundamentals and a news feed for sentiment, then manually deciding whether the two stories agree. MarketLoom closes that gap. Type a ticker or company name, and two specialist agents go to work in parallel - one pulling quantitative fundamentals and historical OHLCV data, the other pulling qualitative news - before an LLM orchestrator fuses both into one structured briefing: key metrics, interactive trend/volume charts, sector benchmarking, a risk rating, and a side-by-side Bull Case vs. Bear Case.

No dashboards to piece together yourself. One search, one synthesized answer.


Features

  • Ticker or Company Search - Search using a stock ticker (TCS.NS, RELIANCE) or company name (Tata Consultancy Services).
  • Financial Agent - Retrieves live spot price, 24h return, 52-week high/low, NIFTY 50 Alpha, and 90-day daily OHLCV historical price & volume data.
  • News Agent - Fetches recent news headlines and extracts sentiment signals from live market sources.
  • Interactive Price & Volume Chart - Features an interactive Recharts area chart paired with custom-styled volume bar charts, custom dark tooltips, and dynamic 30D / 60D / 90D timeframe toggles.
  • NIFTY 50 Benchmarking - Calculates relative performance against the NIFTY 50 index.
  • Market Sentiment Barometer - Displays a visual distribution breakdown of Bullish, Neutral, and Bearish sentiment percentages.
  • LLM Synthesis Layer - Combines outputs from both agents into a structured market briefing via @ai-sdk/google (Google Gemini) and generateObject with Zod validation schemas.
  • Bull vs. Bear Analysis - Presents balanced growth catalysts and downside risks for every search.
  • Risk Rating & Regulatory Flags - Highlights Low, Medium, or High risk levels along with SEBI caution flags where applicable.
  • Sector & Peer Benchmarking - Automatically identifies industry sectors and compares performance against primary market peers.
  • Performance Caching - Includes a server-side memory cache (10-minute TTL) to minimize latency and token expenditure.
  • Responsive Terminal UI - Modern, dark-themed trading dashboard built with Tailwind CSS and Lucide React icons.

How It Works

flowchart TD
    U["User types a ticker\n(e.g. TCS)"] --> SF[SearchForm]
    SF --> API["/api/market-agent"]
    API --> FA["Financial Agent\nfetchStockData()"]
    API --> NA["News Agent\nfetchCompanyNews()"]
    FA --> LLM["LLM Orchestrator\n(generateObject + Gemini)"]
    NA --> LLM
    LLM --> DB[MarketDashboard]
    DB --> R["
    · Spot Price & NIFTY Alpha
    · Interactive Price & Volume Chart
    · Sentiment Barometer
    · Peer Benchmarking
    · Bull vs. Bear Case
    · Risk Rating & SEBI Flags"]

Loading

The Financial and News agents run concurrently, and their combined output is handed to an LLM that returns a single structured JSON payload the dashboard renders directly.


Architecture

MarketLoom is a stateless, serverless 2-agent pipeline - no database, deployed entirely on Vercel's edge network.


┌───────────────────────────┐
│        SearchForm         │
│     (components/)         │
│  • Ticker input           │
│  • Popular ticker chips   │
└─────────────┬─────────────┘
              │
              ▼
┌───────────────────────────┐
│    Agent Orchestrator     │
│  (app/api/market-agent/)  │
│  • Calls both agent tools │
│  • Cache validation layer │
│  • Synthesizes via Gemini │
└──────┬───────────────┬────┘
       │               │
       ▼               ▼
┌──────────────┐  ┌──────────────┐
│ Finance Tool │  │  News Tool   │
│(lib/tools/)  │  │(lib/tools/)  │
│ Stock spot,  │  │  Headlines & │
│ NIFTY alpha, │  │  sentiment   │
│ 90D OHLCV    │  │  signals     │
└──────────────┘  └──────────────┘
              │
              ▼
┌───────────────────────────┐
│      MarketDashboard      │
│     (components/)         │
│  • Metrics grid           │
│  • Price & Volume Chart   │
│  • Sentiment Barometer    │
│  • Bull vs. Bear cards    │
│  • Risk badge & news feed │
└───────────────────────────┘


  • SearchForm owns input - capturing what the user wants analyzed
  • Agent Orchestrator owns reasoning - running both tools, managing caching, and synthesizing the result via Google Gemini
  • Finance & News tools own data - each is an isolated, independently testable fetcher
  • MarketDashboard owns output - rendering the synthesized briefing, interactive Recharts graphs, and market signals

Tech Stack

Layer Technology
Framework Next.js 14 (App Router)
Language TypeScript
Styling Tailwind CSS, lucide-react
Charting Recharts (ComposedChart, Area, Bar)
AI Orchestration Vercel AI SDK (generateObject, Zod schemas)
LLM Provider Google Gemini (@ai-sdk/google)
Data Sources Yahoo Finance (spot, NIFTY 50, 90D OHLCV), live web/news search
Deployment Vercel (serverless, edge-first)

Project Structure

MarketLoom/
├── app/
│   ├── layout.tsx                # Metadata, custom fonts, favicon logo setup
│   ├── page.tsx                  # Main layout, search + dashboard state
│   └── api/
│       └── market-agent/
│           └── route.ts          # Agent orchestrator & cache (finance + news → Gemini synthesis)
├── components/
│   ├── SearchForm.tsx            # Ticker input, shortcuts, loading state
│   └── MarketDashboard.tsx       # Metrics grid, Recharts Price + Volume chart, Sentiment barometer, Bull/Bear cards, risk badge, news feed
├── lib/
│   └── tools/
│       ├── finance-tool.ts       # fetchStockData() - spot price, NIFTY alpha, 90-day OHLCV history
│       └── news-tool.ts          # fetchCompanyNews() - headlines & sentiment signals
├── public/
│   └── logo.svg                  # MarketLoom logo mark
├── .env.local                    # GOOGLE_GENERATIVE_AI_API_KEY (not committed)
└── README.md


Getting Started

Prerequisites

  • Node.js 18+ and npm
  • A Google Gemini API Key (GOOGLE_GENERATIVE_AI_API_KEY)
  • Git

Clone the repo

git clone [https://github.com/calsify/MarketLoom.git](https://github.com/calsify/MarketLoom.git)
cd MarketLoom

Install & configure

npm install

Create a .env.local file at the project root:

GOOGLE_GENERATIVE_AI_API_KEY=your-gemini-api-key-here

Run locally

npm run dev

Open http://localhost:3000 to see MarketLoom running.


Usage

  1. Type a ticker (TCS.NS, RELIANCE) or company name (Tata Consultancy Services) into the search bar - or click one of the popular ticker shortcuts
  2. Hit Analyze (or press Enter)
  3. The Financial Agent and News Agent fetch data in parallel
  4. The LLM synthesizes both into one structured briefing
  5. Read the metrics grid, toggle between 30D/60D/90D on the interactive price and volume chart, review market sentiment distribution, Bull vs. Bear cases, and recent news signals

Contributing / Git Workflow

To keep merges conflict-free, each module lives in its own file and branch no one edits outside their assigned path.

Branch File Owned
1 feature/member-1-core app/page.tsx
2 feature/member-2-finance-tool lib/tools/finance-tool.ts
3 feature/member-3-news-tool lib/tools/news-tool.ts
4 feature/member-4-agent-orchestrator app/api/market-agent/route.ts
5 feature/member-5-search-ui components/SearchForm.tsx
6 feature/member-6-dashboard-ui components/MarketDashboard.tsx

Roadmap

  • Interactive price & volume charting (30D / 60D / 90D timeframes)
  • NIFTY 50 Alpha & sentiment distribution barometer
  • Export briefing as PDF
  • Recent searches
  • Real-time price streaming
  • Portfolio-level multi-ticker analysis
  • Historical sentiment trend charts

Team

Module Team Member GitHub LinkedIn Responsibilities
🧠 Core & Integration Avanish GitHub LinkedIn Repo setup, app/page.tsx layout, state management, PR approvals
📊 Financial Agent Gyanendra GitHub LinkedIn lib/tools/finance-tool.ts - stock price & valuation ratio fetcher
📰 News Agent Akshata GitHub LinkedIn lib/tools/news-tool.ts - web search & news headline fetcher
🧩 Agent Orchestrator Shashwat GitHub LinkedIn app/api/market-agent/route.ts - multi-agent API route via Vercel AI SDK
🔍 Search UI Mobashshir GitHub LinkedIn components/SearchForm.tsx - search bar, ticker shortcuts, loading states
📈 Dashboard UI Nikhil GitHub LinkedIn components/MarketDashboard.tsx - metrics cards, Bull/Bear cards, risk badges

License

This project is licensed under the MIT License - free to use for educational, research, and hackathon purposes.


About

MarketLoom is an autonomous multi-agent intelligence platform that seamlessly weaves live quantitative financial metrics with real-time web news sentiment. By pairing Yahoo Finance stock data with live web research, it synthesizes instant Bull vs. Bear risk reports to give investors and founders a complete 360° market briefing in seconds.

Resources

Stars

Watchers

Forks

Contributors

Languages