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.
Overview · Features · How It Works · Architecture · Team ·
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.
- 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) andgenerateObjectwith 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.
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"]
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.
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
| 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) |
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
- Node.js 18+ and npm
- A Google Gemini API Key (
GOOGLE_GENERATIVE_AI_API_KEY) - Git
git clone [https://github.com/calsify/MarketLoom.git](https://github.com/calsify/MarketLoom.git)
cd MarketLoom
npm install
Create a .env.local file at the project root:
GOOGLE_GENERATIVE_AI_API_KEY=your-gemini-api-key-here
npm run dev
Open http://localhost:3000 to see MarketLoom running.
- Type a ticker (
TCS.NS,RELIANCE) or company name (Tata Consultancy Services) into the search bar - or click one of the popular ticker shortcuts - Hit Analyze (or press Enter)
- The Financial Agent and News Agent fetch data in parallel
- The LLM synthesizes both into one structured briefing
- 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
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 |
- 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
This project is licensed under the MIT License - free to use for educational, research, and hackathon purposes.