Skip to content

About

AI-powered Indian stock market platform — real-time NSE data, sector screener, news, commodity insights, and an in-app AI assistant (Stockie)

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

NammaStocks

An AI-powered Indian stock market platform — real-time NSE data, screener, blogs, news ,commodity insights and our AI agent (Stockie)


Overview

NammaStocks is an AI-powered platform for Indian equity investors. The Dashboard surfaces live NIFTY 50, SENSEX, BANK NIFTY, and VIX data alongside a sector heatmap, top movers, and a curated watchlist. The Screener helps filter NSE stocks by metrics and jump straight into side-by-side comparisons. Commodity Insights delivers driver attribution, regime classification, and volatility forecasts for key commodities. The News page aggregates the latest market headlines, while the Blog hosts community commentary. Stockie, the built-in AI assistant, answers market questions with live price and news context right in a chat sidebar.

Screenshots

Login Page

Login Page

Dashboard

Dashboard

Screener

Screener

AI Agent — Stockie

AI Agent

news

News



Prerequisites

Tool Version
Python 3.10+
Node.js 18+
PostgreSQL 15+
Docker + Docker Compose latest
Ollama (optional, for local LLM) latest

Running with Docker Compose (Recommended)

# 1. Clone the repo
git clone https://github.com/your-org/NammaStocks.git
cd NammaStocks

# 2. Set up environment
cp Backend/.env.example Backend/.env
# Edit Backend/.env — fill in CLERK_JWKS_URL, CLERK_ISSUER, and any LLM keys

# 3. Start everything
docker compose up --build
Service URL
Frontend http://localhost:5173
Backend API http://localhost:8000
Swagger Docs http://localhost:8000/docs

Running Locally

Backend

cd Backend

python -m venv .venv
source .venv/bin/activate       # Windows: .venv\Scripts\activate

pip install -r requirements.txt

cp .env.example .env
# Edit .env — fill in DATABASE_URL, CLERK_JWKS_URL, CLERK_ISSUER

uvicorn src.main:app --reload --host 0.0.0.0 --port 8000

Frontend

cd Frontend

npm install

# Create a .env file
echo "VITE_API_URL=http://localhost:8000/v1" > .env
echo "VITE_CLERK_PUBLISHABLE_KEY=pk_test_..." >> .env

npm run dev

Environment Variables

Backend (Backend/.env)

DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/nammastocks

CLERK_JWKS_URL=https://xxx.clerk.accounts.dev/.well-known/jwks.json
CLERK_ISSUER=https://xxx.clerk.accounts.dev
CLERK_SECRET_KEY=sk_test_...

LLM_PROVIDER=ollama          # ollama | openai | gemini | anthropic
LLM_MODEL=mistral
LLM_API_KEY=                 # only needed for cloud providers
OLLAMA_HOST=http://localhost:11434

Database on Supabase (hosted Postgres)

The backend only needs a Postgres URL, so Supabase works without code changes. Tables are created at startup (init_db, SQLModel create_all).

  1. Create a project at supabase.com (free plan is enough) and note the database password.
  2. In the project, open Connect, then Direct, then Session pooler (it works over IPv4, which many home networks need).
  3. Put the string in Backend/.env with the postgresql+asyncpg:// scheme and ?ssl=require. Percent-encode special characters in the password:
DATABASE_URL=postgresql+asyncpg://postgres.<project-ref>:<password>@aws-1-<region>.pooler.supabase.com:5432/postgres?ssl=require
  1. Check the connection and table creation without starting the app:
cd Backend
python -m scripts.check_db

It prints the host, server version and tables, never the password. Use the session pooler (port 5432). The transaction pooler (port 6543) does not support asyncpg prepared statements unless they are disabled.

Frontend (Frontend/.env)

VITE_API_URL=http://localhost:8000/v1
VITE_CLERK_PUBLISHABLE_KEY=pk_test_...

LLM Provider

Provider LLM_PROVIDER value Notes
Ollama (default) ollama Run ollama pull mistral locally
OpenAI openai Set LLM_API_KEY=sk-…
Google Gemini gemini Set LLM_API_KEY=AI…
Anthropic anthropic Set LLM_API_KEY=sk-ant-…

Built with ❤️ for Indian equity traders and investors.


Tests

cd Backend
pip install -r requirements.txt pytest pytest-asyncio
pytest        # 25 tests, offline: the LLM, yfinance and the news feeds are faked

They cover the AI agent layer (slash commands, symbol extraction, LLM fallback, streaming errors, RAG degradation). CI runs them on every push that touches Backend/ (.github/workflows/backend-tests.yml). The scripts named Backend/test_*.py are manual probes against live services, not part of the suite. The frontend and the database, auth and dashboard routes have no automated tests yet.

Failure handling (AI agent)

situation behavior
message starts with / handled deterministically (/compare, /timetravel, /time-travel, /rebalance); the LLM and market-data lookups are never called; wrong argument counts and unknown commands return a usage message
primary Ollama host unreachable retried once against http://localhost:11434 (Ollama provider only)
every LLM host fails HTTP 200 with a friendly "trouble connecting" message and model_used: null; no stack trace reaches the user
model returns an empty answer a default "could not generate a response" message
provider returns content blocks (for example Gemini thinking models) text blocks are joined; reasoning blocks are dropped
streaming call fails mid-way the stream ends with an apology chunk and a done frame, so the client never hangs
yfinance fails for one symbol that symbol shows (Data unavailable) and the answer is built from the rest
the market-data fetch raises for a symbol that symbol is skipped; the others are kept
RAG_ENABLED=false or no ticker in the message no market context is injected
more than 5 tickers in a message only the first 5 are fetched

Known limits: a message typed entirely in capitals can still be read as tickers, an unknown lowercase ticker is not detected (known company names are matched case-insensitively), and only the Ollama provider has a host fallback. A bug found while writing these tests is fixed: the extractor used to uppercase the whole message first, so every ordinary word ("hello", "today") was treated as a ticker and looked up on yfinance.

About

AI-powered Indian stock market platform — real-time NSE data, sector screener, news, commodity insights, and an in-app AI assistant (Stockie)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages