Go Backend · Next.js 14 · Apache Kafka · Multi-Broker Copy Trading
CopyTrader is a low-latency, multi-broker copy trading platform that mirrors trades from a master/leader account to up to 20+ follower accounts in parallel, with an end-to-end execution SLA of under 3 seconds. It supports 7 major futures brokers and provides a real-time dashboard for monitoring all accounts simultaneously.
Traders running multiple prop firm or personal accounts need every follower account to execute the same trade as the leader account — fast, reliably, and at scale. Traditional manual duplication is impossible at the speed required. This platform automates the entire flow from signal detection to execution confirmation across all accounts.
| Layer | Component |
|---|---|
| 1 | Next.js 14 Frontend (SSR + client components, WebSocket) |
| 2 | Go WS Gateway (:8081) + Go REST API (:8080) |
| 3 | Apache Kafka Cluster (KRaft, 6 topics) |
| 4 | Go Microservices (Signal Ingestion, Fan-Out, Executor, Position Tracker) |
| 5 | 7 Broker Adapters (persistent auth, circuit breakers) |
| 6 | PostgreSQL+TimescaleDB, Redis, Prometheus+Grafana |
| Topic | Partitions | Key | Purpose |
|---|---|---|---|
| trade.signals | 3 | symbol | Master order events |
| trade.executions | 10 | account_id | Fill confirmations |
| positions.updates | 10 | account_id | Position & P&L |
| account.status | 20 | account_id | Broker health |
| order.errors | 5 | account_id | Execution failures |
| system.heartbeat | 1 | - | Service health |
| Signal detection | <50ms |
| Normalization + Kafka publish | <25ms |
| Fan-out router + goroutine dispatch | <10ms |
| Broker API execution (P95) | <800ms |
| Result collection + Kafka publish | <50ms |
| Total end-to-end (typical) | <1 second |
| Total end-to-end (worst case SLA) | <3 seconds |
| Broker | Protocol | Connection | Key Notes |
|---|---|---|---|
| Tradovate | REST + WebSocket | Persistent WSS | OAuth2 token, fill subscription via WS |
| Rithmic | R|API+ (proprietary) | TCP binary (C SDK) | Most complex — CGO wrapper |
| DxFeed | dxLink | WebSocket | Order chain event subscription |
| NinjaTrader | ATI | TCP socket | SuperDOM AT Interface, text commands |
| ProjectX | REST + WebSocket | HTTP + WSS | Straightforward HTTP API, WS for fills |
| Quantower | FIX 4.2/4.4 | FIX session | Standard FIX, session management |
| Sierra Chart | SCID / DLL | DLL/Extension API | Trading extension interface |
Every adapter implements BrokerAdapter Go interface: Connect(), PlaceOrder(), Subscribe(), Disconnect()
/copytrader
├── cmd/
│ ├── ingestion/ # Signal ingestion service
│ ├── router/ # Fan-out order router
│ ├── executor/ # Broker executor worker pool
│ ├── gateway/ # WebSocket gateway (browser-facing)
│ └── tracker/ # Position & P&L tracker
├── internal/
│ ├── kafka/ # Producer/Consumer wrappers
│ ├── brokers/
│ │ ├── tradovate/
│ │ ├── rithmic/
│ │ ├── ninjatrader/
│ │ ├── projectx/
│ │ ├── dxfeed/
│ │ ├── quantower/
│ │ └── sierrachart/
│ ├── models/ # TradeSignal, Execution, Position
│ ├── router/ # Fan-out logic
│ ├── scaling/ # Scaling rules engine
│ └── circuit/ # Circuit breaker
├── pkg/
│ └── ws/ # WebSocket hub
└── docker-compose.yml
/copytrader-frontend
├── app/
│ ├── layout.tsx
│ ├── (auth)/login/page.tsx
│ ├── dashboard/page.tsx # SERVER Component
│ ├── trading/page.tsx # CLIENT Component
│ │ └── components/
│ │ ├── AccountGrid.tsx
│ │ ├── OrderLog.tsx
│ │ ├── PositionPanel.tsx
│ │ └── TradingChart.tsx
│ ├── accounts/page.tsx
│ ├── reports/page.tsx
│ └── api/
│ ├── accounts/route.ts
│ ├── orders/route.ts
│ └── auth/[...nextauth]/
├── hooks/
│ ├── useWebSocket.ts
│ ├── useTradeStream.ts
│ └── usePositions.ts
├── store/
│ ├── tradeStore.ts # Zustand
│ ├── positionStore.ts
│ └── accountStore.ts
├── lib/
│ ├── ws.ts # WebSocket singleton
│ ├── api.ts
│ └── types.ts
└── middleware.ts