A self-improving equity recommender that scans global markets, scores stocks across multiple dimensions, generates multi-horizon buy/sell signals with confidence scores, and manages a simulated portfolio with realistic costs — all running autonomously with built-in safeguards.
-
Scans — Pulls daily OHLCV, fundamentals, insider deals, and institutional flows from multiple data sources. Runs configurable screener presets (Minervini trend template, CANSLIM, momentum breakout, deep value).
-
Analyzes — Computes 50+ technical indicators, momentum/quality/value factor scores, FinBERT news sentiment, and ML-based return predictions. Combines everything into a weighted composite score with decorrelation checks.
-
Recommends — Generates BUY/SELL/HOLD signals across 5 time horizons (1 day → 3 months) with calibrated confidence. For top picks, runs a Bull/Bear LLM debate and generates an investment thesis.
-
Simulates — Executes recommendations in a paper portfolio with India-specific transaction costs (STT, stamp duty, GST), volume-aware slippage, and capital gains tax modelling (STCG 20%, LTCG 12.5% above ₹1.25L).
-
Protects — A four-level circuit breaker (GREEN → AMBER → RED → BLACK) monitors accuracy and drawdown, automatically reducing position sizes or pausing trading when performance degrades.
-
Self-Improves — Bayesian weight adjustment tunes composite scoring weights based on actual outcomes, validated through shadow A/B testing before deployment.
┌─────────────────────────────────────────────────────────────┐
│ React Frontend (Vite) │
│ Command Center │ Scanner │ Recommendations │ Portfolio │
└───────────────────────┬─────────────────────────────────────┘
│ REST + SSE
┌───────────────────────┴─────────────────────────────────────┐
│ FastAPI Backend │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Market │ │ Analysis │ │ Recommend│ │ Portfolio│ │
│ │ Data │ │ Domain │ │ Domain │ │ Domain │ │
│ │ Domain │ │ │ │ │ │ │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
│ │ Ports │ │ │ │
│ ┌────┴─────────────┴────────────┴────────────┴─────┐ │
│ │ Infrastructure Layer │ │
│ │ yfinance │ nselib │ FinBERT │ Redis │ Postgres │ │
│ └──────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Pattern: Hexagonal Architecture (Ports & Adapters) with DDD Bounded Contexts. Domain logic has zero external dependencies — all I/O goes through abstract ports.
# Clone and enter
git clone https://github.com/anmolg1997/EquityOracle.git
cd EquityOracle
# Option A: Docker (recommended)
cp .env.example .env
docker compose up -d
# Option B: Local development
cd backend && python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/ # 300 tests, <1s
cd ../frontend && npm install
npm run dev # http://localhost:5173See wiki/01-getting-started.md for detailed setup.
| Layer | Technology |
|---|---|
| Backend | Python 3.12+, FastAPI, Pydantic v2, SQLAlchemy 2.0 (async) |
| Database | PostgreSQL 16 + TimescaleDB (time-series), Redis 7 (cache + pub/sub) |
| ML | XGBoost, PyTorch (LSTM), scikit-learn, FinBERT (local sentiment) |
| LLM | litellm gateway → Gemini / Ollama / Claude (with daily budget cap) |
| Data Sources | yfinance, nselib, TradingView-Screener, NewsAPI, Alpha Vantage |
| Frontend | React 18, TypeScript 5, Vite 6, Tailwind CSS, TradingView Charts |
| Infra | Docker Compose, OpenTelemetry, structlog |
| Market | Data Source | Transaction Costs | Status |
|---|---|---|---|
| India (NSE/BSE) | yfinance + nselib | STT, stamp duty, GST, SEBI fee | Primary |
| US (NYSE/NASDAQ) | yfinance + Alpha Vantage | SEC fee, TAF, brokerage | Adapter ready |
| Global | TradingView-Screener | Configurable | Adapter ready |
EquityOracle/
├── backend/
│ ├── app/
│ │ ├── core/ # Events, logging, types, observability
│ │ ├── domain/ # Pure business logic (zero I/O)
│ │ │ ├── market_data/ # OHLCV, quality gates, liquidity
│ │ │ ├── analysis/ # Technical, factors, composite scoring
│ │ │ ├── recommendation/ # Signals, exit rules, thesis
│ │ │ ├── portfolio/ # Engine, costs, sizing
│ │ │ └── risk/ # Circuit breaker, regime, drawdown
│ │ ├── ml/ # Feature engineering, models, safeguards
│ │ ├── application/ # Use cases (scanner, recommender, autonomy)
│ │ ├── infrastructure/ # Adapters (DB, APIs, cache, LLM)
│ │ └── api/ # REST + SSE endpoints, middleware
│ └── tests/ # 300 tests (unit + integration)
├── frontend/src/
│ ├── features/ # Page-level components
│ └── shared/ # API client, hooks, stores
├── configs/ # YAML: markets, risk, scanners, weights
├── wiki/ # Full documentation
└── docker-compose.yml
Start here, in order:
| Doc | What You'll Learn |
|---|---|
| Getting Started | Prerequisites, setup, first run |
| How It Works | End-to-end flow: data in → recommendation out |
| Architecture Overview | Hexagonal architecture, bounded contexts, event bus |
| Design Decisions | Why we chose each pattern and technology |
| Market Data | Data sources, quality gates, liquidity scoring |
| Analysis Engine | Technical indicators, factor model, composite scoring |
| Recommendation Engine | Signal generation, exit rules, LLM debate |
| Portfolio Simulator | Paper trading, realistic costs, position sizing |
| Risk Management | Circuit breaker, regime detection, position limits |
| ML Pipeline | Features, models, overfitting safeguards |
| Autonomy System | Self-improvement, A/B testing, automation levels |
| Frontend Guide | UI architecture, pages, real-time updates |
| Testing Guide | Test structure, running tests, coverage |
| Glossary | Finance + tech terms explained for developers |
cd backend
source .venv/bin/activate
pytest tests/ -v # All 300 tests
pytest tests/unit/domain/ -v # Domain logic only (103 tests)
pytest tests/integration/ -v # Cross-domain flows (20 tests)
pytest tests/ --cov=app --cov-report=html # Coverage reportMIT