AI-Powered Stock Analysis & Paper Trading Platform
A professional trading platform combining real-time market data, AI-powered analysis, and paper trading in a sleek, modern interface. Built with Flask, powered by Gemini AI, and deployed for free on Render. A personal full-stack financial engineering project demonstrating Cloud Architecture, Python, and Generative AI.
DISCLAIMER: This is an educational project for portfolio demonstration purposes. Not financial advice. See DISCLAIMER.md for full details.
- Live stock quotes and price tracking
- Technical indicators (RSI, MACD, Bollinger Bands)
- Volume analysis and market trends
- Multiple timeframe charts (1D, 5D, 1M, 6M, 1Y)
- Oracle Score™ - Proprietary 15-factor technical analysis system
- Trading Profile - Set your style (Day / Swing / Long-Term) and every AI output adapts:
- Deep-dive analysis, Oracle factor interpretations, email recommendations, backtesting defaults, and rebalancer thresholds all adjust to your horizon
- AI Market Intelligence - Automated hourly email alerts with:
- Gemini 2.0 Flash AI with Google Search grounding
- Personalized stock recommendations (BUY/HOLD/SELL) with confidence scores, locked to your trading-style timeframe
- Portfolio impact analysis with Oracle-based stop-loss suggestions
- Market catalysts with clickable source links
- Watchlist generation for emerging opportunities
- TL;DR summaries and portfolio health metrics
- Customizable frequency (hourly/daily/weekly)
- Market Preview — Pre-market heads-up every weekday at 9 AM
- Market Close Summary — End-of-day recap at 5 PM (Mon-Fri)
- Sentiment analysis from news and social media
- Pattern recognition and trend prediction
- Risk-free practice trading with Alpaca
- Real-time portfolio tracking
- P&L analysis and performance metrics
- Order history and transaction logs
- Price alerts (above/below thresholds)
- Percentage change notifications
- Technical indicator triggers
- Email and in-app notifications
- Pre-configured industry watchlists (Tech Giants, EV, AI, Crypto)
- Custom watchlist creation
- Real-time tracking of multiple stocks
- Quick access to favorite symbols
- BYOK (Bring Your Own Keys) - Each user uses their own API keys
- End-to-end encryption for API credentials
- Secure session management
- No shared rate limits between users
| Feature | Silicon Oracle | Traditional Platforms |
|---|---|---|
| Cost | 100% Free | $10-50/month |
| Setup | 15 minutes | Hours of configuration |
| API Keys | Your own (BYOK) | Shared (rate limited) |
| AI Analysis | Gemini AI included | Extra cost or unavailable |
| Deployment | One-click cloud | Complex self-hosting |
| Multi-User | Built-in support | Usually single-user |
| Mobile | Responsive PWA | Native app required |
-
Fork this repository
# Or clone it git clone https://github.com/HarshShroff/Silicon-Oracle.git cd Silicon-Oracle
-
Push to your GitHub
git remote set-url origin https://github.com/YOUR_USERNAME/silicon-oracle.git git push -u origin main
-
Set up Supabase Database (REQUIRED for production)
- Go to supabase.com and create free account
- Create new project (takes ~2 minutes to provision)
- Go to Settings → Database → Copy the URI connection string
- It looks like:
postgresql://postgres:[PASSWORD]@db.[PROJECT].supabase.co:5432/postgres
-
Deploy on Render
- Go to dashboard.render.com
- Click "New +" → "Blueprint"
- Connect your GitHub repo
- Click "Apply"
- CRITICAL: Add environment variable:
DATABASE_URL=<your-supabase-connection-string> - Wait 5-10 minutes
-
Done! Visit your URL and sign up
Important: Without Supabase, your data will be lost on every deploy/restart!
Detailed Deployment Guide | Quick Start
Your app, your keys! Silicon Oracle uses a unique BYOK (Bring Your Own Keys) architecture:
- Deploy the app (no API keys needed during deployment)
- Users sign up for their own accounts
- Each user adds their own API keys in Settings
- Keys are encrypted and stored per-user in database
- Everyone has independent rate limits and usage
No shared rate limits - Your keys, your quota More secure - Keys encrypted per-user Cost-effective - App owner doesn't pay for everyone Scalable - Add unlimited users Transparent - Users control their own API usage
| Service | Purpose | Free Tier | Get It |
|---|---|---|---|
| Finnhub | Market data | 60 calls/min | finnhub.io |
| Alpaca | Paper trading | Unlimited paper trading | alpaca.markets |
| Gemini | AI analysis & market intelligence | 60 requests/min | ai.google.dev |
| Gmail | Email alerts (optional) | Free | Use your Gmail + App Password |
| Job | When | What |
|---|---|---|
| Market Preview | 9:00 AM | Pre-market heads-up & portfolio impact |
| Sentinel Monitor | Every 5 min, 9 AM – 4 PM | Real-time position alerts |
| AI Market Intelligence | Every hour, 10 AM – 4 PM | Personalized stock picks via Gemini |
| Market Close Summary | 5:00 PM | Today's performance recap |
| Daily Digest | 5:30 PM | Full portfolio summary + top opportunities |
All jobs respect your per-user notification preferences (toggle in Settings → Email). Any job can be triggered manually from the browser console — see API docs.
- Python 3.11+
- Node.js (for Tailwind CSS)
- Git
-
Clone the repository
git clone https://github.com/HarshShroff/Silicon-Oracle.git cd Silicon-Oracle -
Install Python dependencies
pip install -r requirements.txt
-
Install Node dependencies (for Tailwind CSS)
npm install
-
Build Tailwind CSS
npm run build:css # Or for watch mode: # npm run build:css -- --watch
-
Set up secrets (optional)
mkdir -p .streamlit cp .streamlit/secrets.toml.example .streamlit/secrets.toml # Edit .streamlit/secrets.toml with your keys -
Run the app
python run_flask.py
-
Open your browser
http://localhost:5001
Frontend (Jinja2)
Analysis Portfolio Watchlist
Page Page Page
Flask Backend (Python)
Routes (main, api, auth, sentinel)
Services Layer
• StockService (market data)
• OracleService (AI scoring)
• TradingService (Alpaca)
• PortfolioService (tracking)
• AlertEngine (notifications)
External Services
• Finnhub API (market data)
• Alpaca API (paper trading)
• Gemini API (AI analysis)
• News APIs (sentiment)
Silicon-Oracle/
flask_app/ # Main Flask application
routes/ # URL routes (main, api, auth, sentinel)
services/ # Business logic services
templates/ # Jinja2 HTML templates
static/ # CSS, JS, images
models/ # Data models
utils/ # Utility modules
database.py # Database operations
encryption.py # API key encryption
alpaca.py # Trading integration
gemini.py # AI integration
run_flask.py # Application entry point
requirements.txt # Python dependencies
render.yaml # Render deployment config
Dockerfile # Docker configuration
- Flask - Web framework
- Gunicorn - WSGI server
- APScheduler - Background tasks
- PostgreSQL - Database (Supabase recommended)
- SQLite - Local development only
- Cryptography - Encryption
- Jinja2 - Templating
- Tailwind CSS - Styling
- Alpine.js - Interactivity
- Chart.js - Visualizations
- Finnhub - Market data
- Alpaca - Paper trading
- Google Gemini - AI analysis
- yfinance - Historical data
- Render/Railway/Fly.io - Hosting
- GitHub Actions - CI/CD (optional)
- Docker - Containerization
Encryption at Rest - API keys encrypted with Fernet Secure Sessions - HTTPOnly, Secure cookies CSRF Protection - Flask-WTF enabled Environment Variables - No secrets in code HTTPS Enforced - Automatic on cloud platforms Input Validation - All user inputs sanitized Rate Limiting - Per-user API quotas
| Metric | Value |
|---|---|
| Response Time | <500ms average |
| Cold Start | ~30s (free tier) |
| Concurrent Users | 100+ (scales automatically) |
| API Calls/min | Unlimited (per-user keys) |
| Database | PostgreSQL (Supabase free: 500MB) |
| Build Time | 5-10 minutes |
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Commit with clear messages
git commit -m "Add amazing feature" - Push to your fork
git push origin feature/amazing-feature
- Open a Pull Request
- Follow PEP 8 for Python code
- Add tests for new features
- Update documentation
- Keep commits atomic and well-described
This project is licensed under the MIT License - see the LICENSE file for details.
- Finnhub for excellent market data API
- Alpaca for free paper trading
- Google for Gemini AI access
- Render for free hosting
- Flask community for amazing framework
- Full Docs (pages, APIs, architecture): DOCS.md
- Deployment Guide: DEPLOYMENT.md
- Quick Start: QUICKSTART.md
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Real-time stock analysis
- AI-powered Oracle scoring (15-factor system)
- Trading Profile (Day / Swing / Long-Term) — AI adapts everywhere
- AI Market Intelligence with automated email alerts
- Market Preview (pre-market) & Close Summary (post-market) emails
- Paper trading with Alpaca
- Multi-user BYOK system
- Watchlists and smart alerts
- Portfolio Sentinel monitoring with shadow positions
- Portfolio rebalancer with style-aware thresholds
- Backtesting engine with style-matched defaults
- Manual email-job trigger endpoint for testing
- Responsive design
- Options trading analysis
- Crypto support
- Advanced charting (TradingView integration)
- Portfolio backtesting
- Mobile app (React Native)
- Social features (share trades, strategies)
- Custom indicators and strategies
- Machine learning models
- Automated trading bots
- API for developers
- Active Deployments: Growing daily
- GitHub Stars: Star us if you find this useful!
- Contributors: Open to contributions
- License: MIT - Use freely