Skip to content

72. Complete System Architecture Diagram (v1)

1. External Access Layer

  • User Browser
  • ↓ (HTTPS)
  • Next.js / React Frontend
  • ↓ (REST API / WebSocket)
  • FastAPI API Gateway

Tech Stack: - Frontend: Next.js + TailwindCSS + TypeScript - API Gateway: FastAPI - Protocols: HTTPS / REST / WebSocket


2. Microservice Application Layer

Each function is an independently deployed microservice.

Module Tech Stack Communication
Strategy Management Center FastAPI + PostgreSQL gRPC/REST
Signal Aggregation Center FastAPI + gRPC gRPC + NATS
Ultra-Fast Backtest Center Rust + FastAPI gRPC
Ultra-Fast Match Sim Center Rust gRPC
Capital Allocation Center FastAPI gRPC
Cross-Exchange Arbitrage Center Rust + FastAPI gRPC + NATS
Strategy Evolution Center Python (Genetic Algorithm libs) + FastAPI gRPC
Liquidity Warning Center Python + FastAPI NATS
Risk Rules Center Python + FastAPI NATS
Scheduler Center Python + APScheduler + FastAPI NATS
Disaster Recovery Center Rust/Python + FastAPI REST + gRPC

Key Software: - FastAPI (lightweight microservice framework) - Rust (ultra-high-performance modules) - PostgreSQL (persistent storage) - Redis (cache, queue) - NATS (global async message streaming) - Protobuf (gRPC message schema)


3. Communication Layer

Type Software Protocol
Synchronous RPC gRPC HTTP/2 + Protobuf
Async Streaming NATS Streaming NATS protocol
Task Scheduling NATS + CronTask Event Bus

Details: - Direct gRPC for low-latency microservice calls - High-frequency data via NATS pub/sub


4. Data Storage Layer

Data Type Storage Solution
Real-time Market Data InfluxDB / TimescaleDB
Backtest Data Lake Parquet + MinIO Object Storage
Strategy Gene/History PostgreSQL
Capital Flow Logs PostgreSQL
Anomaly Logs Elasticsearch (optional)
Config Data Redis (hot cache)

Software: - TimescaleDB (time-series DB) - MinIO (S3-compatible object storage) - PostgreSQL (transactional data) - Redis (cache)


5. Infrastructure Layer

Component Software/Platform
Service Orchestration Kubernetes (K8s)
Image Build Docker
Log Collection Loki + Promtail
Monitoring/Alert Prometheus + Grafana
Load Balancing Traefik / Nginx
Security Gateway OAuth2 + Keycloak (opt.)
  • All microservices are Dockerized and orchestrated by K8s for dynamic scaling.

6. Data Flow Overview

[Market Data Center] → NATS Tick Stream → [Signal Aggregation Center] → [Strategy Execution Center] → [Matching Sim Center] → [Capital Management Center]
     ↘                              ↓
    [Arbitrage System]              [Risk Monitoring Center] → [Anomaly Detection Center]
     ↘                               ↓
[Backtest Center] ← Data Lake Storage ← [Backtest Result]

7. Layered Tech Stack Summary

Layer Software/Tech
Frontend Next.js, TailwindCSS
API FastAPI
Communication gRPC, NATS
Microservices FastAPI + Rust
Data PostgreSQL, Redis, TimescaleDB, MinIO
Infra Kubernetes, Docker, Prometheus, Grafana, Loki

Summary

This architecture covers all modules, protocols, storage, and deployment platforms, ensuring: - Ultra-low latency (gRPC + NATS) - High scalability (Microservices + Docker + K8s) - High availability (Disaster recovery, monitoring, load balancing) - Ultra-high performance (Rust core modules)

This design is ready for production-grade deployment!