# Current Implementation Snapshot This document summarizes the code that exists now, not the original plan. ## Runtime - FastAPI app starts from [src/arbitrade/api/app.py](../../src/arbitrade/api/app.py). - Settings come from `pydantic-settings` in [src/arbitrade/config/settings.py](../../src/arbitrade/config/settings.py). - DuckDB is initialized and migrated on startup. - Runtime recovery persists and restores control state and snapshots. ## Market Data and Detection - Kraken market data is handled by native WS and thin REST code. - Incremental triangular detector is implemented in [src/arbitrade/detection/engine.py](../../src/arbitrade/detection/engine.py). - Currency graph and cycle indexing live in [src/arbitrade/detection/graph.py](../../src/arbitrade/detection/graph.py). ## Execution and Risk - Multi-leg execution sequencer exists for triangular cycles. - Pre-trade validation and trade-limit guards are wired into execution flow. - Kill switch and stop conditions are supported. ## Dashboard - Server-rendered dashboard uses FastAPI + Jinja2 + HTMX. - Live metrics, overview, controls, charts, and audit fragments are exposed as separate endpoints. - Dedicated backtesting page exists at `/dashboard/backtesting`. ## Backtesting - Replay engine lives in [src/arbitrade/backtesting/replay.py](../../src/arbitrade/backtesting/replay.py). - Parameter sweep runner lives in [src/arbitrade/backtesting/sweep.py](../../src/arbitrade/backtesting/sweep.py). - Backtesting UI runs replay from a JSONL file, stores recent reports in app state, and exposes a recent-reports API. - Experimental stat-arb scaffold lives in [src/arbitrade/strategy/stat_arb.py](../../src/arbitrade/strategy/stat_arb.py) and is gated by feature flag. ## Deployment - Dockerfile installs runtime dependencies from `requirements/latest-runtime.in`. - CI publishes `git.allucanget.biz/allucanget/arbitrade:latest`. - Coolify deploys the prebuilt image and owns runtime env vars and persistent storage. ## Current Gaps - Cross-exchange arbitrage remains deferred. - Stat-arb is experimental, not part of default live strategy. - Backtesting UI is functional but still a single-run/report workflow, not a full job queue.