StockSage Architecture
Runtime Flow
src/app/main.py receives /stream?symbol=... request.
src/core/processing/processor.py executes validate → download → analyze.
src/core/processing/download_pipeline.py fetches data and persists CSV files.
src/crew/pipeline.py runs CrewAI tasks and merges deterministic facts.
src/app/utils/formatters/ converts log entries into UI-safe HTML blocks (one module per analysis card).
- SSE stream pushes entries to browser (
src/app/static/js/main.js).
Module Boundaries
src/app: web layer (FastAPI, templates, static assets, formatting).
src/core: config, validation, data fetching/storage, processing orchestration.
src/crew: CrewAI definitions, tools, facts, output validation/serialization.
Persistence Contract
- Data root:
.market_data/<SYMBOL>/
- Contract constants:
src/core/config/data_contracts.py
- Storage implementation:
src/core/market/storage.py
Operational Notes
- Non-critical download failures (e.g., news/trends) are logged and flow continues.
- Analysis failures are surfaced through stage failure entries and SSE termination event.