Skip to content

ridash2005/AlphaStream_Final

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

146 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AlphaStream India

FastAPI React Gemini LangChain Pathway DuckDB Tailwind CSS

AI-Powered Investment Intelligence for the Indian Investor

14 crore+ demat accounts. Most retail investors flying blind. AlphaStream India turns ET Markets data into actionable, money-making decisions.

Built for ET AI Hackathon 2026 - Problem Statement 6: AI for the Indian Investor.


What It Does

AlphaStream India is a real-time investment intelligence terminal that combines multi-agent signal detection, technical analysis overlays, NLQ analytics, and global market intelligence to surface opportunities other investors miss.

Core Features

Feature Description
Tabbed Bloomberg Terminal 5-tab layout: Overview Β· Signals Β· Global Intel Β· Company Β· Portfolio - each focused on a different investor workflow
Opportunity Radar AI monitors NSE/BSE filings, insider trades, FII/DII flows, chart patterns - surfaces signals with Alpha Score (0-100)
Technical Indicator Overlays RSI(14) sub-chart + SMA20/SMA50 line overlays on TradingView candlestick, togglable per ticker
Fundamentals Panel PE, PB, ROE, Dividend Yield, Market Cap, 52-week H/L from Groww API - wired live
Stock Screener Filter Nifty 50 universe by sector, signal direction, and alpha score using DuckDB v_stock_screener view
Portfolio Manager Add/remove NSE holdings, track real-time P&L, β‚Ή totals, horizontal bar chart by ticker
Watchlist Persistent (localStorage) watchlist of up to 20 NSE tickers with live sentiment scores
Corporate Filings BSE announcements (dividends, results, board meetings) per ticker - 7/30/90-day view
Anomaly Detection Online ML (River HalfSpaceTrees) flags price/volume anomalies fed from 3mo NSE OHLCV
Global Market Intelligence Crypto (BTC/ETH/SOL/XRP) + Currencies (INR/USD, DXY) + US Sector ETFs - India-impact annotated
Threat-aware News Articles sorted by threat level (critical/warning/info) with sentiment distribution donut chart
Market ChatGPT Next Gen NLQ agent with Text2SQL pipeline - grounded answers from real data, portfolio-aware, source-cited

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Indian Data Sources                                                 β”‚
β”‚  NSE API Β· BSE API Β· FII/DII (NSDL) Β· Groww API Β· ET Markets RSS   β”‚
β”‚  FRED (macro) Β· WorldMonitor (global indices/commodities/crypto/FX)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Pathway Streaming Engine (Real-time <2s)                            β”‚
β”‚  News ingestion β†’ Chunking β†’ Embedding β†’ Adaptive RAG               β”‚
β”‚  Threat classification (critical/warning/info) β†’ DuckDB persist      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Multi-Agent System (13 agents)                                      β”‚
β”‚  Sentiment Β· Technical Β· Risk Β· Decision Β· Pattern Β· Backtest        β”‚
β”‚  Filing Β· Flow Β· Insider Β· Chart Β· Report Β· Search Β· Anomaly         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Analytics Layer (DuckDB)                                            β”‚
β”‚  fact_articles Β· fact_signals Β· fact_insider_trades Β· fact_filings   β”‚
β”‚  fact_fii_dii_flows Β· dim_stocks (Nifty 50)                         β”‚
β”‚  Views: v_stock_screener Β· v_signal_summary Β· v_sector_heatmap       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  NLQ Agent (LangGraph 7-node)                                        β”‚
β”‚  Guardrail β†’ Enrich (web search) β†’ Route β†’ Text2SQL β†’ Narrate        β”‚
β”‚  MCP Servers: market_data Β· signals Β· portfolio Β· search             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  React Terminal (5 tabs)                                             β”‚
β”‚  Overview: Candlestick+RSI/SMA Β· Recommendation Β· Fundamentals       β”‚
β”‚  Signals:  Screener Β· Opportunity Radar Β· Flow Chart                 β”‚
β”‚  Global:   Crypto/FX/Sectors Β· Fear&Greed Β· Macro Β· Commodities      β”‚
β”‚  Company:  Filings Β· News+Threat Badges Β· Watchlist                  β”‚
β”‚  Portfolio: Holdings Β· P&L Chart Β· Sector Allocation                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

Layer Technology
Streaming Pathway (real-time RAG, <2s latency)
LLM Gemini 2.0 Flash (Vertex AI) + OpenRouter
Agents LangChain + LangGraph (multi-agent orchestration)
NLQ Text2SQL pipeline with guardrails + correction loop
MCP FastMCP servers (market data, signals, portfolio)
Database DuckDB (analytics), ChromaDB (vector search)
Backend FastAPI + WebSocket + SSE streaming
Frontend React 19, Zustand, Tailwind, Recharts, Framer Motion
Market Data NSE API, BSE API, Groww API (TOTP), yfinance, ET Markets RSS

Quick Start

Prerequisites

  • Python 3.11+ β€” backend runtime
  • Node.js 18+ β€” frontend build tooling
  • Google Cloud account with Vertex AI enabled (for Gemini LLM)
  • API keys needed: NEWS_API_KEY from newsapi.org (required), GROWW_API_TOKEN (optional)
  • Hardware: 4 GB+ RAM recommended

Step-by-Step Setup

Step 1: Clone & configure

git clone https://github.com/ridash2005/AlphaStream_Final.git
cd AlphaStream_India

Step 2: Backend setup

cd backend
uv sync
cp .env.example .env
# Edit .env β€” set GOOGLE_APPLICATION_CREDENTIALS, GCP_PROJECT_ID, and NEWS_API_KEY at minimum

Step 3: Initialize database & start backend

# Initialize DuckDB with Nifty 50 data
.venv/bin/python -m src.data.market_schema

# Start backend (cold start ~75s, then ready)
.venv/bin/python -m uvicorn src.api.app:app --host 0.0.0.0 --port 8000

Step 4: Frontend setup

cd ../frontend
npm install

Step 5: Start frontend

npm run dev

Step 6: Open the dashboard

Navigate to http://localhost:5173

Minimal Mode (No API Keys)

If you don't have API keys yet, AlphaStream still runs using cached/mock data. Set in backend/.env:

ENABLE_PATHWAY=false
NEWS_API_KEY=
GCP_PROJECT_ID=

The UI loads with cached article data and pre-computed recommendations β€” sufficient to evaluate the dashboard, agent outputs, and PDF report generation.

Environment Variables

See backend/.env.example for the full reference. Key variables:

# Required - GCP / Vertex AI (all LLM calls go through Gemini)
GOOGLE_APPLICATION_CREDENTIALS=./service-account.json
GCP_PROJECT_ID=your-project

# News APIs
NEWS_API_KEY=...

# Optional - Indian market data (enables fundamentals panel)
GROWW_API_TOKEN=...
GROWW_TOTP_SECRET=...

# Optional - enable Pathway streaming (adds 45s to startup)
ENABLE_PATHWAY=false

Troubleshooting

ImportError: No module named 'pathway' β€” Set ENABLE_PATHWAY=false in backend/.env. The system runs without Pathway using a synchronous fallback.

Port 8000 already in use β€” Run uvicorn src.api.app:app --port 8001 then set VITE_API_URL=http://localhost:8001 in frontend/.env.

Frontend loads blank β€” Check VITE_API_URL in frontend/.env points to the running backend (default: http://localhost:8000).

DuckDB error on startup β€” Run .venv/bin/python -m src.data.market_schema from the backend/ directory to initialise the database.


API Endpoints

Market Intelligence

Endpoint Method Description
/api/ohlcv/{ticker} GET OHLCV + optional RSI/SMA20/SMA50 (?indicators=true)
/api/fundamentals/{ticker} GET PE, PB, ROE, Div Yield, 52w H/L (Groww API)
/api/radar GET Top signals by Alpha Score
/api/screener GET Filter stocks by sector/direction/alpha (DuckDB view)
/api/patterns/{ticker} GET Chart pattern detection
/api/backtest/{ticker}/{pattern} GET Historical backtest (5yr)
/api/flows GET FII/DII flow analysis
/api/anomalies/{ticker} GET Price/volume anomaly detection (River ML)
/api/filings/{ticker} GET BSE corporate announcements
/api/portfolio POST Set user portfolio holdings
/api/portfolio/summary GET Live P&L summary

Global Market (WorldMonitor)

Endpoint Method Description
/api/global/indices GET NIFTY, SENSEX, S&P 500, DOW, etc.
/api/global/commodities GET Gold, Crude, Silver, Copper, etc.
/api/global/crypto GET BTC, ETH, SOL, XRP
/api/global/currencies GET INR/USD, DXY
/api/global/sectors GET 12 US sector ETF returns
/api/global/fear-greed GET CNN Fear & Greed index
/api/global/macro GET FRED macro signals + verdict
/api/global/vix GET VIX volatility index
/api/global/geo-risk GET India geopolitical risk score

NLQ & Core

Endpoint Method Description
/api/nlq POST Natural language query (blocking)
/api/nlq/stream GET/POST NLQ with SSE streaming
/api/insights GET Ambient AI alerts
/recommend POST Full multi-agent recommendation
/ws/stream/{ticker} WS Real-time updates (rec, market, global)

Signal Types

Signal Detection Method Backtest Available
RSI Divergence Price vs RSI direction mismatch Yes (5yr)
MACD Crossover Signal line cross + histogram Yes (5yr)
Bollinger Breakout Squeeze β†’ expansion Yes (5yr)
Volume Breakout >2x 20-day average Yes (5yr)
Golden/Death Cross 50 SMA vs 200 SMA Yes (5yr)
Insider Buying NSE SAST/PIT cluster detection N/A
FII Streak 5+ day consecutive net buying N/A
Material Filing LLM classification of BSE/NSE filings N/A

Author

Rickarya Das β€” @ridash2005

Built for ET AI Hackathon 2026 - Problem Statement 6


License

MIT

About

AlphaStream India is a production-grade, real-time investment intelligence terminal designed to empower Indian retail investors. Featuring a Bloomberg-style terminal UI, it integrates Gemini 2.0 Flash, FastAPI, and React 19 to deliver grounded, backtested, and high-alpha investment signals.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors