Overview

High-level introduction, core capabilities, architecture, and tech stack of the DepthSight platform.

⏱️ 11 min read📊 Level: Beginner

DepthSight is an enterprise-grade, open-source platform for algorithmic cryptocurrency trading — packaged as a complete SaaS-in-a-box. It provides every layer you need to launch a multi-user trading platform (similar to 3Commas or Veles) out of the box: a drag-and-drop strategy builder, an AI-powered co-pilot, a dual backtesting engine, dynamic risk management, multi-exchange execution, real-time dashboards, and a mobile PWA — all wired together through a distributed architecture of containerized services.

DepthSight Logo

Visual Strategy Builder Demo
The visual strategy builder in action — describe your idea in plain language and AI assembles a complete multi-stage trading strategy.

Sources: Sources:

What DepthSight Does

At its core, DepthSight automates the full lifecycle of crypto trading: analyze market data → evaluate strategy conditions → manage risk → execute orders → log and report. What distinguishes it from a simple trading bot framework is its multi-tenant architecture — every component is designed so that hundreds of users can run independent strategies on isolated accounts, all sharing the same infrastructure. The platform enforces per-user quotas, plan-based permissions, and fully separated execution environments, making it production-ready for commercial SaaS deployments.

The platform currently targets cryptocurrency markets with native support for Binance and Bybit (fully tested and stable), with Bitget, OKX, Gate.io, and BingX in active development. All exchange communication flows through CCXT-based executors behind a unified abstraction, so adding new exchanges requires implementing a single adapter rather than rewriting trading logic.

Sources: Sources:

Core Capabilities at a Glance

CapabilityDescriptionKey Module
Visual Strategy BuilderDrag-and-drop node graph with 40+ logic blocks; cross-referencing nodes for dynamic stop-loss placementfrontend/src/components/strategy-editor/
AI Co-PilotGenerate strategies from text prompts or chart screenshots; analyze live trades and backtestsapi/ai_assistant.py
Weighted FoundationsProbability-based entry system — trades execute only when weighted condition confidence exceeds a thresholdbot_module/strategy.py
Dynamic Risk ManagementAdaptive position sizing and risk parameters that respond per-pair to real-time performancebot_module/risk_manager.py
Dual BacktestingFast vector engine for prototyping + candle/tick-level engine for precise execution simulationbot_module/fast_vector_backtester.py, bot_module/depthsight_backtester.py
Genetic OptimizationEvolve strategy parameters through genetic algorithms with a dynamic gene poolbot_module/genetic_strategy_finder.py
ML PipelineOnline learning (River) + batch models (scikit-learn, XGBoost, LightGBM) for signal confirmationbot_module/model_pipeline.py, bot_module/ml_strategy.py
Discovery HubCommunity repository for sharing strategy templates, trading ideas with KPIs, and federated node topologyapi/hub_router.py
Trade MiningEarn $DEPTH by submitting anonymous trade telemetry — verified trades mint daily token rewards with referrals, welcome bonuses and halvingapi/hub_router.py, bot_module/controller.py, tasks.py
Multi-Tenant SaaSJWT auth, Redis quotas, plan-based permissions, isolated execution per user accountapi/security.py, api/quota_manager.py
Sources: Sources:

System Architecture

DepthSight is a distributed system of 8 containerized services orchestrated by Docker Compose, communicating through Redis (messaging, state, fan-out) and PostgreSQL (persistence). The following diagram illustrates the high-level component topology and data flows:

Rendering diagram...

The architecture follows a fan-out consumption pattern for market data: the Market Data Service maintains a single WebSocket connection per exchange stream, then replicates data to all interested bot workers through Redis Pub/Sub. This means 100 users trading BTCUSDT share one upstream connection rather than opening 100 separate streams — a critical efficiency for scaling.

Sources: Sources: Sources:

Service Map and Ports

Every service runs in its own Docker container with isolated Redis ACL credentials. The following table summarizes the service topology:

ServiceDefault PortRoleKey Technology
PostgreSQL5432Persistent storage (users, strategies, trades, backtests)PostgreSQL 15 Alpine
RedisinternalCache, state, Pub/Sub, Celery broker, command busRedis 7.2 Alpine
Redis MarketinternalHigh-throughput HFT market data fan-out (no persistence)Redis 7.2 Alpine
API8000REST API, auth, strategy CRUD, adminFastAPI + Uvicorn
WebSocket8765Real-time event streaming to frontendsUvicorn + Gunicorn
Frontend5173Web dashboardReact + Vite + shadcn/ui
PWA5174Mobile-optimized clientReact + Vite
Botn/aTrading engine runtimePython async
Market Datan/aCentral exchange stream ingestion + fan-outPython async + aiohttp
Celery Workern/aBackground jobs (backtests, genetic opt, analytics)Celery 5.5 + prefork

[!TIP] Redis is never exposed on the host — each container authenticates with its own ACL user (api, websocket, bot, celery, market_data), enforcing least-privilege access at the data layer.

Sources: Sources:

Data and Control Flow Summary

Understanding how data moves through DepthSight is essential for working with the codebase. There are six primary flow paths:

FlowPathPurpose
ConfigurationFrontend → REST API → PostgreSQLUser saves strategy settings, API keys, preferences
ControlFrontend → REST API → Redis Command Bus → Bot Runner → TradingControllerStart/stop strategies, modify positions
Market DataExchange WS → Market Data Service → Redis Fan-out → Bot (DataConsumer)Real-time klines, order books, trades
ExecutionProcessed Data → Controller → Strategy → RiskManager → Executor → Exchange APISignal generation through order placement
ObservationBot → Redis Pub/Sub → WebSocket Server → Frontend DashboardLive logs, position updates, signal alerts
AnalyticsBot → PostgreSQL → Celery Task → Analytics → PostgreSQLPost-trade analytics, backtest results

The Control Flow is particularly important: the API never directly calls the trading engine. Instead, it publishes commands to Redis channels, and the bot runner polls those channels asynchronously. This decoupling means the API can restart without disrupting active trades.

Sources:

Project Structure

The repository is organized into clearly separated domains. Here is a visual map of the top-level layout with the purpose of each directory:

DepthSight/
├── api/                  │   ├── routes/           # Modular route files (auth, strategies, backtests, admin, ...)
│   ├── depthsight_api.py # Main FastAPI application entry point
│   ├── models.py         # SQLAlchemy database models
│   ├── schemas.py        # Pydantic request/response schemas
│   ├── security.py       # JWT, password hashing, encryption
│   ├── crud.py           # Database CRUD operations
│   └── ...
├── bot_module/           # Trading engine — strategies, execution, backtesting
│   ├── controller.py     # TradingController — the heartbeat of live trading
│   ├── strategy.py       # Strategy framework + built-in strategy definitions
│   ├── fast_vector_backtester.py   # High-speed vector backtester
│   ├── depthsight_backtester.py    # Candle/tick-level simulation backtester
│   ├── risk_manager.py   # Dynamic risk management engine
│   ├── executor.py       # Exchange order execution (CCXT)
│   ├── genetic_strategy_finder.py  # Genetic optimization
│   ├── model_pipeline.py # ML inference pipeline
│   └── exchanges/        # Exchange-specific adapters
├── frontend/             # React web dashboard (Vite + shadcn/ui + Tailwind)
│   └── src/
│       ├── components/   # UI components (strategy-editor, analytics, positions, ...)
│       ├── pages/        # Route pages (Strategies, Analytics, CommunityHub, ...)
│       └── context/      # React contexts (Auth, WebSocket, Theme, ...)
├── pwa/                  # Mobile-optimized Progressive Web App
│   └── src/              # Screens, components, i18n locales (en/ru)
├── tests/                # Comprehensive test suite (100+ test files)
├── alembic/              # Database migration scripts
├── scripts/              # Utility scripts (data pipeline, diagnostics)
├── docs/                 # Public documentation and assets
├── market_data_service.py # Centralized market data fan-out service
├── bot_runner.py         # Multi-user bot process entry point
├── tasks.py              # Celery task definitions
├── docker-compose.yml    # Service orchestration
└── requirements.txt      # Python dependencies

The largest code concentrations are bot_module/strategy.py (~12,700 LOC) containing the full strategy framework and condition system, and bot_module/controller.py (~13,800 LOC) orchestrating the trading lifecycle. The frontend strategy editor (frontend/src/components/strategy-editor/) implements the drag-and-drop visual builder.

Sources: Sources: Sources:

Technology Stack

DepthSight's stack is deliberately chosen for real-time performance, observability, and production reliability:

LayerTechnologyRationale
Backend APIFastAPI + Uvicorn + GunicornAsync-first, automatic OpenAPI docs, high throughput
Trading EnginePython 3.11+ asyncioNative async I/O for concurrent exchange operations
DatabasePostgreSQL 15 + SQLAlchemy + AlembicACID compliance, migrations, relational integrity
Cache / MessagingRedis 7.2 (2 instances)Pub/Sub for real-time events; separate instance for HFT data
Task QueueCelery 5.5 + preforkCPU-bound backtests and genetic optimization off the main loop
ML / AIRiver, scikit-learn, XGBoost, LightGBM, Google GeminiOnline learning + batch inference + LLM co-pilot
FrontendReact 19 + Vite + shadcn/ui + Tailwind CSSComponent-driven UI with drag-and-drop (dnd-kit)
MobileReact 19 + Vite PWAInstallable, offline-capable mobile experience
ExchangeCCXT 4.4Unified API across 6+ exchanges
OptimizationDEAP (genetic) + Optuna (Bayesian) + Numba (JIT)Multi-strategy parameter search with compiled hot paths
InfrastructureDocker Compose + CaddyOne-click deploy with auto-SSL, PgBouncer-ready

Two separate Redis instances are intentional: the primary Redis handles persistent state (JWT sessions, rate limits, Celery broker), while redis-market is a volatile, no-persistence instance dedicated to high-frequency market data fan-out — preventing HFT data volume from evicting critical system state.

Sources: Sources: Sources:

Deployment Model

DepthSight ships with a one-click deployment model designed for Ubuntu 22.04+ servers with a minimum of 6 CPU cores and 16 GB RAM. A single shell script handles everything: Docker installation, secret generation, firewall configuration, and service startup:

curl -sL "https://raw.githubusercontent.com/DepthSight-Pro/DepthSight/main/deploy.sh" | sudo bash

The platform also supports a secure container-to-host auto-update mechanism: clicking "Update" in the admin UI writes a trigger file to a shared volume, which a host-side cron job detects and executes — enabling zero-downtime updates without granting root privileges to the container.

For local development, the standard Docker Compose workflow applies:

cp .env.example .env          # Replace all change_me_* secrets!
docker compose up -d --build

After startup, the interactive API documentation is available at http://localhost:8000/docs, the web dashboard at http://localhost:5173, and the PWA at http://localhost:5174.

Sources: Sources:

Where to Go Next

Now that you have a high-level understanding of DepthSight's purpose and architecture, here is a recommended reading path through the documentation:

  • Quick Start — Get a local instance running and place your first paper trade.
  • Architecture Overview — Deep dive into how the 8 services communicate and scale.

Then explore based on your interest:

If you want to understand...Read
How strategies generate signalsStrategy and Signal System
The lifecycle of a trade from signal to executionTrading Controller Lifecycle
Adaptive risk management mechanicsDynamic Risk Management
Fast prototyping vs. precise simulationDual Backtesting Engines
Evolving strategies with genetic algorithmsGenetic Strategy Optimization
How market data flows from exchanges to botsCentralized Market Data Service → Redis Fan-Out and Data Consumer
REST API design and route organizationFastAPI REST Routes
Multi-tenant auth, quotas, and billingMulti-Tenant Auth and Quotas
Real-time event streaming architectureWebSocket Real-Time Events
AI strategy generation and trade analysisAI Co-Pilot Assistant
ML models, Compass strategy, online learningML Pipeline and Compass Strategy
Visual strategy builder and dashboard UIReact Dashboard and Strategy Editor
Mobile trading experienceMobile PWA Client