# Copilot Instructions for MarketScanner ## Project Overview MarketScanner is a "fear-to-fortune" trading intelligence system that identifies buying opportunities by analyzing how stocks historically respond to panic-inducing news. ## Tech Stack - **Backend**: Python 3.12 + FastAPI + Celery + PostgreSQL/TimescaleDB + Redis - **Frontend**: React 18 + TypeScript + TailwindCSS + Vite - **Infrastructure**: Docker + Docker Compose ## Key Concepts 1. **Panic Detection**: Monitor news sentiment and price drops to identify panic events 2. **Pattern Matching**: Match current panic against historical recovery patterns 3. **Confidence Scoring**: Calculate buy signal confidence based on historical success rates 4. **Real-time Monitoring**: Continuous news and price data fetching via Celery workers ## Code Style - Python: Follow PEP 8, use type hints, async/await for database operations - TypeScript: Strict mode, functional components with hooks - Use structured logging (structlog) - Prefer composition over inheritance ## Database - TimescaleDB hypertables for time-series data (stock_prices) - UUID primary keys - Soft deletes where appropriate ## API Design - RESTful endpoints under `/api/v1/` - Pydantic schemas for validation - Pagination with skip/limit ## Testing - pytest for Python - Mock external APIs in tests - Test critical business logic (pattern matching, confidence scoring)