← Index Case study 01

Terminal Trading Platform

Go-based trading backend with copy-trading, risk engine, and MetaTrader 5 integration

Stack
GoPostgreSQLRabbitMQWebSocketsDocker
fig. — simulated system behaviour live sim
Problem

A trading firm needs infrastructure to manage multiple trading sessions across MetaTrader 5, with real-time order management, risk controls, copy-trading between master and slave accounts, and a live dashboard.

Solution

A microservices backend monorepo providing:

  • Go REST API for auth, sessions, orders, risk, and portfolio
  • MT5 bridge service for MetaTrader 5 communication
  • OMS/RMS for order validation and risk management
  • RabbitMQ for async inter-service messaging
  • WebSocket streams for real-time dashboards
Architecture
architecture.svg
Frontend Dashboard ──── API (Go:8080) ──── PostgreSQL (5432)
     (WebSocket)            │
                       RabbitMQ (5672)
                            │
              ┌─────────────┼─────────────┐
         MT5 Bridge    OMS / RMS     Event Workers
          (5556)
              │
         MetaTrader 5
Key Decisions

Go over Node.js

Concurrency model suits high-throughput event processing.

RabbitMQ over Redis pub/sub

Durable message delivery for order events.

Event-driven copy-trading

Master/slave sync via events, not polling.

Three WebSocket stream types

Single session, all sessions, and full table data views.

Real-Time Events
WebSocket session_update
{
  "type": "session_update",
  "session_id": "sess_7f3a9b",
  "data": {
    "status": "active",
    "equity": 12450.80,
    "margin_used": 3200.00,
    "open_positions": 5,
    "unrealized_pnl": 340.25,
    "risk_level": "normal"
  },
  "timestamp": "2025-11-14T09:32:15.442Z"
}
Stack
Backend

Go, PostgreSQL, RabbitMQ (AMQP)

Services

REST API, MT5 Bridge, OMS/RMS, Event Workers

Infrastructure

Docker Compose, PgAdmin, Makefile

Auth

JWT, RBAC (admin/investor roles)

Real-time

WebSockets (3 stream types)

Next case study

AgriVision AI

→