๐Ÿ† Claude Certified Architect โ€” Portfolio Project

Deep Agentic AI for
Indian Stock Analysis

8 specialized AI agents orchestrated via LangGraph. Works with Groq (free), Ollama (local), or Claude Sonnet. Institutional-grade equity research for NSE/BSE stocks โ€” run locally with your own API key.

โญ View on GitHub ๐Ÿš€ Run Locally
Python 3.11+
Claude Sonnet 4.6
LangGraph
LangChain
Streamlit
yfinance NSE/BSE Data
Plotly Charts
scipy Portfolio Optimization
ta Technical Indicators

๐ŸŽฏ What you can ask

Natural language queries โ€” the orchestrator routes to the right agents automatically

Full analysis of RELIANCE Screen IT stocks with P/E < 25 & ROE > 15% DCF valuation for TCS at 12% growth Risk analysis for HDFCBANK Build a โ‚น5L diversified portfolio High dividend yield stocks โ€” NSE INFY technical analysis โ€” buy or sell? HINDUNILVR competitive moat vs peers

8 Specialized AI Agents

Each agent is a LangChain tool-calling agent with a focused system prompt and dedicated tools

๐Ÿ”
Stock Screener
Filters 30+ NSE large-caps by P/E, ROE, market cap, debt, dividend yield, and sector.
๐Ÿ’ฐ
DCF Valuation
Discounted Cash Flow with base/bull/bear scenarios, margin of safety, and intrinsic value per share.
โš ๏ธ
Risk Analysis
Beta, alpha, Sharpe ratio, VaR (95%/99%), CVaR, max drawdown vs Nifty 50 benchmark.
๐Ÿ“Š
Earnings Breakdown
Quarterly EPS actuals vs estimates, revenue trend, margin expansion/compression, beat/miss history.
๐Ÿ—‚๏ธ
Portfolio Builder
Markowitz mean-variance optimization, optimal weights, expected return/volatility, sector diversification.
๐Ÿ“‰
Technical Analysis
RSI, MACD, Bollinger Bands, EMA/SMA crossovers, ADX, Stochastic, ATR, OBV โ€” buy/sell signals.
๐Ÿ’ธ
Dividend Strategy
Dividend yield, payout ratio, FCF coverage, multi-year growth history, consistency scoring.
๐Ÿ†
Competitive Advantage
Economic moat analysis, Porter's Five Forces, peer comparison, moat durability rating (Wide/Narrow/None).

Multi-Agent Architecture

LangGraph StateGraph with supervisor routing and parallel agent execution

User Query (natural language)
        โ”‚
        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Supervisor Node    โ”‚  โ”€โ”€โ”€ keyword routing + ticker extraction
โ”‚   (LangGraph)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚  parallel dispatch to relevant agents
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ–ผ        โ–ผ        โ–ผ        โ–ผ       โ–ผ       โ–ผ        โ–ผ       โ–ผ
[Screener] [DCF]  [Risk]  [Earnings] [Portf.] [Tech.] [Div.] [Comp.]
    โ”‚        โ”‚        โ”‚        โ”‚       โ”‚       โ”‚        โ”‚       โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                              โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  Synthesis Node  โ”‚  โ”€โ”€โ”€ progressive summarization
                    โ”‚  (Claude Sonnet) โ”‚       context positioning
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                             โ–ผ
                    Final Investment Report
                    (BUY/HOLD/SELL + rationale)

Claude Certified Architect Concepts

Applied concepts from the 5 exam domains

Domain 1
Agentic Architecture & Orchestration
LangGraph StateGraph Supervisor routing Agentic loop Task decomposition Multi-agent coordination
Domain 2
Tool Design & MCP Integration
Custom @tool decorators Descriptive tool docstrings JSON-only returns Error status fields
Domain 3
Claude Code Configuration
CLAUDE.md hierarchy Dev conventions Tool routing rules
Domain 4
Prompt Engineering & Structured Output
Explicit JSON schema Few-shot examples Per-agent system prompts Validation-retry loop
Domain 5
Context Management & Reliability
Progressive summarization Context positioning Error propagation Status fields vs exceptions

Setup & Run Locally

You need an Anthropic API key. No deployment costs โ€” runs entirely on your machine.

Clone the repository

git clone https://github.com/PritamSonawane7798/india-stock-ai.git
cd india-stock-ai

Create a virtual environment and install dependencies

python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt

Add your Anthropic API key

cp .env.example .env
# Edit .env and set:
ANTHROPIC_API_KEY=sk-ant-...

Get your API key at console.anthropic.com. The app uses Claude Sonnet โ€” check current pricing there.

Launch the Streamlit app

streamlit run src/app.py

Opens at http://localhost:8501

Or run the demo script (CLI)

python examples/demo_analysis.py