π Market-Rover - AI Stock Intelligence Platform for Indian Markets - Your personal quant researcher
Multi-agent AI that reads your Indian equity portfolio like a research desk β portfolios, heatmaps, institutional flows, and forecasts in one place. Your complete toolkit for smart investing decisions powered by cutting-edge AI
- Built for Indian markets: Nifty, Sensex, sector indices, NSE symbols, and block deals β not generic US-only tooling.
- Multi-agent CrewAI + Gemini brain: 5+ specialized agents for news, sentiment, seasonality, portfolio optimization, and βshadowβ institutional flows.
- Production-ready Streamlit app with authentication, rate limiting, logging, and PDF/HTML report exports.
- Runs comfortably on the free tier β Streamlit Cloud + Gemini 1.5/2.0 free limits are enough for normal usage.
π Live App: https://market-rover.streamlit.app/
- Python 3.13 (Strict requirement for CrewAI compatibility)
- Google Gemini API key (Get free key)
# 1. Clone repository
cd Market-Rover
# 2. Install dependencies
pip install -r requirements.txt
# 3. Set up environment
copy .env.example .env
# Edit .env and add: GOOGLE_API_KEY=your_key_here
# 4. Run the app
streamlit run app.py
# Opens at http://localhost:8501Market-Rover is an AI-powered platform with a comprehensive suite of intelligence tools:
| Feature | Description | Tech Highlights |
|---|---|---|
| π€ Portfolio Analysis | AI-driven multi-stock analysis with news & sentiment | CrewAI, Gemini, Parallel Processing |
| π Market Visualizer | High-fidelity dashboards & Monthly Heatmaps | Plotly, PNG export, IQR Filtering |
| π Market Analysis | Benchmark Deep-dives (Nifty, Sensex, Bank Nifty) | Shared Analysis Pipe, st.pills |
| βοΈ Smart Rebalancer | Growth vs Safety modes with Corporate Action Auto-Fix | Sharpe Ratio, Risk Parity |
| π΅οΈ Shadow Tracker | Real Institutional Data (Block Deals, FII Traps) | nselib, Real-time NSE Data |
| π― Forecast Tracker | Real-time tracking & management of AI results | yfinance, Interactive st.data_editor |
| π€ Investor Profiler | Model Portfolio Generator with "Sleep Test" | Asset Allocation, Composite Benchmarking |
| π§ Agent Brain | Agent Observability (Memory, Logic, Pivots) | JSON Ledger, Autonomy Logger |
| π’ Automated Intel | Daily Markets & Weekly Backtests (Discussions) | GitHub Actions, gh-cli, Dependabot |
(Sidebar Menu: Portfolio Analysis)
Upload your portfolio and get comprehensive AI-powered insights:
- β Multi-Stock Analysis - Process multiple stocks simultaneously (5x faster with parallel processing)
- β News Scraping - Auto-scrape latest news from Moneycontrol using Newspaper3k
- β Sentiment Analysis - AI-powered classification (Positive/Negative/Neutral)
- β Market Context - Analyze Nifty 50 and sector trends
- β Weekly Intelligence Reports - Comprehensive briefings with risk highlights
- β View Report History - Browse, search, and download past analyses
- β Export Options - HTML format
Generate professional market snapshots for sharing:
- β Price Charts - Real-time stock price movements with volatility bands
- β Scenario Targets - Bull/Bear/Neutral price predictions
- β Monthly Heatmap - Historical performance view
- β AI-Powered Insights - Gemini-generated market analysis
- β PNG Export - Download professional high-res composite dashboard
Security: Input sanitization, rate limiting (30 req/min)
Deep-dive into historical patterns and future predictions for individual stocks:
- β Stock Selection Filters - Instantly filter lists by Nifty 50, Sensex, or Bank Nifty
- β Centered Heatmap - Balanced Green-Red color scale for instant pattern recognition
- β π« Outlier Filter - Exclude extreme market anomalies (>1.5x IQR) for trend accuracy
- β Interactive Heatmap - Monthly returns (Year Γ Month) since IPO
- β Seasonality Analysis - Identify best/worst months with Win Rate %
- β 3 Forecast Scenarios - Conservative, Baseline, Aggressive 2026 projections
- β Iterative Monthly Forecasting - AI applies strategy month-by-month for granularity.
- β Continuous Forecast Paths - Seamless projection from history to current date to 2026 target.
Specialized focus on major market indices:
- β Index Deep-Dive - Analyze Nifty 50, Sensex, Bank Nifty, and Sector Indices
- β Consolidated Logic - Uses the same high-fidelity analysis as individual stocks
- β Market Sentiment - Assess broader market trends before stock picking
Advanced optimization engine to balance Risk and Reward:
- β
Dual Strategy Modes:
- Safe Mode π‘οΈ: Risk Parity (Inverse Volatility) for steady growth.
- Growth Mode π: Sharpe Ratio Optimization (Risk-Adjusted Return) for maximum alpha.
- β Auto-Correction π§ : Automatically detects and fixes price anomalies like Corporate Actions/Demergers (e.g., ABFRL).
- β
Intelligent Grading:
- Overweight/Underweight: Exact percentage drift calculation.
- Actionable Advice: "Buy", "Sell", or "Hold" with transparent "Why?" comments.
- β Resilience: Handles missing data, new IPOs, and negative return assets gracefully.
Track the "Smart Money" with Real Market Data:
- β Whale Alerts π - Live feed of Block Deals (> βΉ1 Crore) fetched directly from NSE.
- β Bull/Bear Trap Detector πͺ€ - Analyzes FII Index Futures Long/Short ratios to detect market euphoria or panic.
- β Silent Accumulation - Identifies stocks with low volatility + high delivery volume (Pre-breakout signals).
- β Sector Rotation - Tracks changes in sector momentum over 1W/1M periods.
- Tech: Powered by
nselibfor direct NSE connectivity.
Monitor your predictions against real market movement:
- β
Live Tracking - Real-time price updates via
yfinance - β Entry vs. Current - Automatic calculation of % gains/losses
- β Portfolio Metrics - Instant average performance across all saved forecasts
- β ποΈ Deletion Capability - Clean up old or inaccurate forecasts through an interactive editor
(Sidebar Menu: Investor Profile)
Scientific asset allocation based on your psychological risk tolerance:
- β The "Sleep Test" - 3-step psychometric quiz to determine your Investor Persona (Conservative/Moderate/Aggressive).
- β Asset Allocation Engine - Suggests exact % split between Equity (Large/Mid/Small), Debt, and Gold.
- β π€ Model Portfolio Generator - Auto-generates a high-quality stock list matching your allocated percentages.
- β π Comparison Simulation - Backtests your generated model portfolio against a Composite Benchmark (weighted average of Nifty/Gold/Bonds) to prove Alpha.
Monitor the efficiency of the development cycle itself:
- β Cycle Time Tracking - Measure how long features take to build.
- β Exception Audit - Track every "Emergency Override" or broken rule.
- β Stability Score - Dynamic score based on protocol adherence.
(Sidebar Menu: Agent Brain)
Visualize the internal thought process of your AI agents:
- β Active Memory Viewer - See the exact "Past Predictions" the agents are recalling.
- β Autonomy Event Stream - Track real-time decisions like "Regime Changes" and "Tool Pivots".
- β Live Logic Matrix - Understand WHY the agent switched to "Defensive Mode".
Security: Input sanitization, rate limiting (20 req/min), persistent session state.
Market-Rover uses 5 specialized AI agents orchestrated by CrewAI:
graph TD
User((User)) -->|Uploads Portfolio| A[Portfolio Manager]
subgraph "Hybrid Intelligence Funnel"
A -->|Validated Tickers| B[Market Strategist]
B -.->|Calls Integrity Shield| B1[Forensic Check]
B -->|Macro & News Context| C[Sentiment Analyzer]
A -->|Tickers| D[Technical Analyst]
B -->|Strategic Report| E[Report Generator]
C -->|Sentiment Flags| G[Shadow Analyst]
D -->|Trend & Levels| G
G -->|Trap Signals| E
D -->|Technical Report| E
C -->|Sentiment Report| E
end
subgraph "Visualizers"
User -->|Request Snapshot| F[Data Visualizer]
end
E -->|Final Intelligence Report| User
F -->|Visual Dashboard| User
Key Technologies:
- CrewAI: Multi-agent orchestration
- Google Gemini 1.5 Flash: LLM for reasoning & analysis
- yfinance: Free NSE/BSE stock data
- Newspaper3k: Web scraping engine
- Streamlit + Plotly: Interactive web UI
-
Upload Portfolio CSV
Symbol,Company Name,Quantity,Average Price RELIANCE,Reliance Industries Ltd,10,2450.50 TCS,Tata Consultancy Services,5,3550.00 INFY,Infosys Ltd,15,1450.75
-
Click "Analyze Portfolio"
- AI agents scrape news, analyze sentiment
- Generate comprehensive intelligence report
- View charts and download results
-
Browse Previous Reports
- Scroll down to see report history
- Filter and search
- Download in multiple formats
- Enter stock ticker (e.g.,
SBIN,TCS,RELIANCE) - Click "Generate Snapshot"
- Wait ~30 seconds for the high-fidelity composite image
- Download PNG to share with colleagues or save for records
- Select/Search for a stock or enter a custom ticker
- Filter by Index: Use "Nifty 50" or "Bank Nifty" to narrow down major stocks
- Click "π Analyze"
- Explore interactive Plotly charts:
- Outlier Filtering: Toggle "Exclude Outliers" to strip anomalies
- Centered Heatmap: Unified color scale for gains vs losses
- 2026 Forecast: AI predicts 3 scenarios (Conservative/Baseline/Aggressive)
- Save Forecast: Click "Save" to track performance in Forecast Tracker
- Select a major index (Nifty 50, Sensex, Bank Nifty, etc.)
- Click "π Analyze Index"
- View high-level market sentiment and seasonal trends
- Monitor your saved predictions against live market prices
- ποΈ Manage List: Use checkboxes and the "Delete Selected" button to clean up your dashboard
Market-Rover includes enterprise-grade security:
| Feature | Implementation | Status |
|---|---|---|
| Input Sanitization | Regex validation, injection prevention | β Active |
| Rate Limiting | 20-30 requests/minute per features | β Active |
| Investment Disclaimer | Bottom status bar, always visible | β Active |
| Secure API Keys | Environment variables, Streamlit secrets | β Active |
| Timezone Handling | Project-wide timezone-aware operations | β Active |
Security Score: 100/100 π’
Why 100%? We have now implemented User Authentication (Login), strong internal defenses, and Automated Security CI/CD Pipelines (Safety Check).
| Feature | Status |
|---|---|
| User Authentication | β Active (Login Required) |
| Input Sanitization | β Active |
| Rate Limiting | β Active |
| Investment Disclaimer | β Active |
| Service | Usage | Monthly Cost |
|---|---|---|
| Streamlit Cloud | Hosting | $0 |
| Gemini 1.5 Flash | <400K tokens/day | $0 |
| yfinance | Stock data | $0 |
| Newspaper3k | News scraping | $0 |
| Total | $0/month β |
Expected Usage (Free Tier):
- ~10-20 analyses/day
- ~5,000-10,000 tokens/day
- Well within limits β
If Exceeding Free Tier:
- Gemini Paid: ~$1-5/month (500K+ tokens/day)
- Streamlit Team: $20/month (more resources)
- CrewAI - Multi-agent orchestration
- Google Gemini 2.0-flash - Latest LLM reasoning engine
- langchain-google-genai - LLM integration
- yfinance - Stock
- Pandas / Numpy - Data manipulation (IQR statistical filtering)
- Streamlit - Interactive web framework (
st.data_editor,st.pills,st.session_state) - Plotly - High-fidelity interactive charts
- Matplotlib/Pillow - Image generation for snapshots
- Input validation - Custom regex sanitization
- Rate limiting - Time-window based throttling
- Persistent Tracker - JSON-based forecast history management
Market-Rover/
βββ app.py # Main Streamlit app
βββ main.py # CLI entry point
βββ agents.py # AI agent definitions
βββ tasks.py # Agent task definitions
βββ crew.py # Crew orchestration
βββ config.py # Configuration
βββ requirements.txt # Python dependencies
βββ .env.example # Environment template
β
βββ tools/ # Analysis tools
β βββ market_data.py # Stock & Option data fetcher
β βββ news_scraper.py # Moneycontrol web scraper
β βββ sentiment_analyzer.py # Gemini-powered classification
β βββ market_analytics.py # Seasonal patterns & iterative forecasting
β βββ ticker_resources.py # Categorized stock indices (Nifty/Sensex)
β βββ visualizer_tool.py # Chart generation
β
βββ utils/ # Utilities
β βββ forecast_tracker.py # Persistence logic for Forecast Tracker
β βββ security.py # Input sanitization, rate limiting
β βββ report_visualizer.py # Portfolio charts
β βββ visualizer_interface.py # Market snapshot generator
β βββ llm_interface.py # Gemini integration
β βββ job_manager.py # Async job tracking
β βββ mock_data.py # Test data generator
β βββ logger.py # Logging system
β βββ metrics.py # Performance tracking
β
βββ output/ # Generated snapshots
βββ reports/ # Intelligence reports
βββ logs/ # Application logs
βββ metrics/ # Performance metrics
# Required
GOOGLE_API_KEY=your_gemini_api_key_here
# Optional
MAX_PARALLEL_STOCKS=5 # Concurrent analysis
LOOKBACK_DAYS=7 # News lookback period
CONVERT_TO_CRORES=true # Currency formatting
MAX_ITERATIONS=5 # Max agent reasoning loops
PORTFOLIO_FILE=Portfolio.csv # Default portfolio filename
RATE_LIMIT_DELAY=1.0 # Delay between API calls
WEB_PORT=8501 # Streamlit port
WEB_HOST=0.0.0.0 # Streamlit hostTo enable Social Login (Google), add the following to your .streamlit/secrets.toml:
[oauth.google]
client_id = "your-google-client-id"
client_secret = "your-google-client-secret"
authorize_endpoint = "https://accounts.google.com/o/oauth2/v2/auth"
token_endpoint = "https://oauth2.googleapis.com/token"
user_info_endpoint = "https://www.googleapis.com/oauth2/v3/userinfo"
redirect_uri = "https://market-rover.streamlit.app"- Daily Report: The system generates a comprehensive market report every day at 00:00 UTC and posts it to GitHub Discussions.
- Weekly Backtest: Every Sunday, it backtests strategy performance and posts a Summary Report to Discussions.
- Failures: Critical system failures are still logged as Issues.
GOOGLE_API_KEY = "your-key-here"-
Weekly Portfolio Review
- Upload portfolio every Monday
- Review AI-generated intelligence
- Track sentiment trends
-
Pre-Earnings Analysis
- Generate market snapshot before earnings
- Assess bull/bear scenarios
-
Historical Pattern Analysis
- Use monthly heatmap for seasonality
- Identify best months for specific stocks
- Plan entry/exit based on trends
-
2026 Planning
- View AI-powered price forecasts
- Compare conservative vs aggressive scenarios
- Make informed long-term decisions
"No module named 'crewai'"
pip install -r requirements.txt"GOOGLE_API_KEY not found"
- Create
.envfile in project root - Add:
GOOGLE_API_KEY=your_key_here - Get free key: https://makersuite.google.com/app/apikey
"Invalid ticker format"
- Use NSE symbols:
SBIN,TCS,RELIANCE(without .NS) - System auto-adds .NS suffix
"Rate limit exceeded"
- Market Snapshot: Wait 60 seconds (30 req/min limit)
- Monthly Heatmap: Wait 60 seconds (20 req/min limit)
News scraping fails (Windows)
pip install lxml lxml_html_cleanDEPLOYMENT.md- Streamlit Cloud deployment guideSECURITY_FIXES_SUMMARY.md- Security implementation detailsSESSION_SUMMARY_DEC22.md- Latest development sessionFINAL_AUDIT_CHECKLIST.md- Comprehensive audit reportAI_AGENTS.md- Detailed Agentic AI Architecture & Roles
- π« Filter Anomalies: Use the "Exclude Outliers" toggle for stocks with a history of extreme spikes (e.g. IPO years or black-swan events) to see the true seasonal trend.
- π Use Index Filters: Start with "Nifty 50" or "Bank Nifty" pills to find liquid stocks before moving to custom tickers.
- π Benchmark First: Always analyze the Benchmark Index before individual stocks to understand overall market direction.
- π Check Confidence: Look for "High Confidence" (3+ years data) before trusting a 2026 forecast.
- β³ Save Iteratively: Save forecasts for multiple stocks to look for sector-wide performance trends.
- ποΈ Audit Weekly: Use the Deletion Capability to remove "noise" and focus on your highest-conviction predictions.
- π Veracity Check: Compare Entry vs. Current price regularly to see which AI strategy (Median vs Std Dev) is winning.
streamlit run app.py- Push code to GitHub
- Go to https://share.streamlit.io
- Create new app β Select repository
- Add secrets (Gemini API key)
- Auto-deploy enabled! (push β deploy in 2-5 min)
Current Production: https://market-rover.streamlit.app/
This is a personal project, but feel free to:
- Fork for your own use
- Report issues on GitHub
- Sort pull requests
Market-Rover is for informational purposes only. Not financial advice. Past performance β future results. Consult a qualified advisor. No liability for losses. By using this app, you accept these terms.
Personal use. Ensure compliance with data source terms of service:
- yfinance: Check Yahoo Finance TOS
- Newspaper3k: Respect robots.txt
- NSE data: For informational purposes
Built with:
- CrewAI - Multi-agent framework
- Google Gemini - Large language model
- Streamlit - Web framework
- Plotly - Visualization library
- yfinance - Financial data
- Newspaper3k - News scraping
Market-Rover - Your intelligent stock companion π
Last Updated: January 25, 2026
Market-Rover is for informational and educational purposes only.
- This application does NOT provide investment, financial, legal, or tax advice.
- All analyses, forecasts, and recommendations are automated and may be inaccurate.
- Past performance does not guarantee future results.
- You should consult with a qualified financial advisor before making investment decisions.
- The creators of Market-Rover assume no liability for financial losses.
- By using this application, you acknowledge these risks and agree to use at your own discretion.
NSE Data Disclaimer: This application uses publicly available data from NSE and Yahoo Finance. We do not guarantee the accuracy, completeness, or timeliness of this data.