Trade Today is an Indian equity analysis app built around two execution paths:
LangGraphfor single-stock analysis such asShould I buy RELIANCE.NS today?CrewAIfor multi-stock workflows such as stock comparison and portfolio analysis
The current implementation also exposes a watchlist-scan API for scheduled automation and includes local n8n in Docker Compose for workflow orchestration.
Implemented in the repo today:
- Single-stock multi-agent analysis with supervisor -> technical, fundamental, sentiment, risk -> judge
- Intent-aware routing between LangGraph and CrewAI
- CrewAI compare and portfolio flows for queries that explicitly mention stocks
- FastAPI endpoints for health, legacy single-stock analysis, smart routing, and watchlist scans
- Streamlit chat UI
- Docker Compose for API, frontend, and n8n
In the architecture docs but not yet wired into the runtime as first-class app features:
- MCP-backed persistence and spreadsheet integrations
- Deeper n8n-driven reporting workflows beyond the current watchlist scan endpoint
The latest architecture reference is docs/architecture_flowchart.html. It reflects the current direction of the system; a few automation and MCP boxes are still roadmap items rather than fully integrated runtime paths.
For prompts such as Analyze INFY or Should I buy RELIANCE.NS?, the app uses the LangGraph pipeline:
supervisor_nodeextracts the ticker- Four analysts run in parallel:
- Technical
- Fundamental
- Sentiment
- Risk
- The judge synthesizes the reports into a final
BUY,HOLD, orSELL
For prompts such as Compare RELIANCE and TATAMOTORS or Analyse my portfolio of RELIANCE, INFY, TCS, the app:
- Classifies the query intent
- Extracts tickers
- Routes to a CrewAI workflow
- Uses CrewAI agents to:
- score each stock
- analyze correlation and diversification
- synthesize a compare/portfolio recommendation
The FastAPI app exposes POST /watchlist-scan, which is intended for scheduled jobs such as daily pre-market scans from n8n.
LangGraphfor deterministic single-stock orchestrationCrewAIfor multi-stock workflowsGoogle Geminifor LLM reasoningyfinancefor OHLCV and financial metricsduckduckgo-searchfor news lookupFastAPIfor APIsStreamlitfor chat UIDocker Composefor local multi-service setupn8nfor workflow automation
Should I buy RELIANCE.NS today?Analyze TCSHow is HDFCBANK today?
Compare RELIANCE and TATAMOTORSWhich is better, INFY or WIPRO?Analyse my portfolio of TATAMOTORS, RELIANCE, INFYAllocate 5L across RELIANCE, TCS and INFY
Note: the current CrewAI routing expects explicit stock mentions in the query. Sector-only allocation prompts are part of the target architecture but are not fully supported by the current router.
.
|-- agents/ # LangGraph analyst and judge nodes
|-- core/
| |-- classifier.py # Intent classification and ticker extraction
| `-- router.py # LangGraph vs CrewAI routing
|-- crew/
| `-- portfolio_crew.py # CrewAI agents, tools, and runners
|-- docs/
| |-- architecture.md
| |-- data_flow.md
| |-- agent_tool_flow.md
| `-- architecture_flowchart.html
|-- graph/
| `-- workflow.py # LangGraph graph builder
|-- tools/
| |-- market_data.py
| |-- technical_ind.py
| |-- search.py
| `-- correlation.py
|-- api.py # FastAPI app
|-- app.py # Streamlit app
|-- docker-compose.yml
`-- requirements.txt
pip install -r requirements.txtCreate a .env file in the project root:
GEMINI_API_KEY=your_gemini_api_keyuvicorn api:app --reload --port 8000streamlit run app.pydocker compose up --buildServices:
- FastAPI:
http://localhost:8000 - Streamlit:
http://localhost:8501 - n8n:
http://localhost:5678
curl http://localhost:8000/healthcurl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"query": "Should I buy RELIANCE.NS today?"}'curl -X POST http://localhost:8000/smart-analyze \
-H "Content-Type: application/json" \
-d '{"query": "Compare RELIANCE and TATAMOTORS"}'curl -X POST http://localhost:8000/watchlist-scan \
-H "Content-Type: application/json" \
-d '{
"tickers": ["RELIANCE.NS", "TCS.NS", "INFY.NS"],
"signal_filter": "BUY"
}'n8nis included in Docker Compose and is the intended automation layer for scheduled watchlist scans, notifications, and future reporting flows.MCPappears in the architecture flowchart as the planned integration layer for persistence and spreadsheet-style tooling, but the current Python runtime does not yet consume MCP servers directly.
- Use
api.pyas the FastAPI entrypoint. main.pyis legacy and should not be treated as the primary API surface.- Existing unit tests focus on agents and tools; routing and CrewAI paths still need broader automated coverage.