Skip to content

Latest commit

 

History

164 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Farm Terminal — Professional Multi-Exchange Trading Platform

License: Proprietary TypeScript React NATS Docker

Production-ready trading terminal for crypto futures across 6 exchanges. Real-time data, spread arbitrage, auto-trading from Telegram signals, and a modern dashboard.

Showcase: sssaturX.github.io/farm · Code license: All Rights Reserved

Source is visible for portfolio review. You may not copy, modify, deploy, or reuse this code without written permission.


Screenshots

Product tour (autoplay): sssaturX.github.io/farm/#demo · GIF: portfolio/assets/product-tour.gif

Overview Trade Spread
Overview Trade Spread

Key Features

Multi-Exchange Trading

  • 6 exchanges: MEXC, Gate.io, Bitget, BingX, Bybit, Binance
  • Multi-account — add multiple accounts per exchange
  • Unified dashboard — balances, positions, PnL in one place

Manual & Automated Trading

  • Manual trading — open/close positions from the dashboard with margin or volume control
  • Auto-trading — execute spread signals from Telegram channels (#TICKER Long MEXC Short GATE, #TICKER aligned)
  • Spread signals — real-time arbitrage opportunities across exchanges

Real-Time Data

  • WebSocket prices — MEXC, Gate for low-latency quotes
  • WebSocket positions — MEXC, Gate, Bitget for live PnL
  • Volume Spike — unusual activity detection (rvol, z-score, imbalance, microburst)

Spread HFT Engine

  • 6 exchange connectors — Binance, Bybit, MEXC, Gate, Bitget, BingX
  • O(n) min/max spread — ultra-low latency, array-based price cache
  • Threshold & signal engines — open/close signals via NATS

Optional: DEX-CEX Scanner

  • Enterprise arbitrage — real-time DEX vs CEX across multiple blockchains
  • Token registry, risk engine, spread & signal engines
  • Enable with: docker compose --profile dexcex up -d

Architecture

┌─────────────┐     HTTPS      ┌─────────┐
│   Browser   │◄──────────────►│  nginx  │
│  (Dashboard)│                └────┬────┘
└──────┬──────┘                     │
       │ WebSocket                  │
       │ (prices, positions,        │
       │  trade results, alerts)    │
       ▼                            │
┌─────────────┐              ┌──────▼──────┐
│  ws-service │◄─── NATS ───►│     api     │
└─────────────┘              │ (node-service)│
       ▲                     └──────┬──────┘
       │                            │
       │  positions, prices,        │  orders, positions,
       │  results, alerts           │  accounts, auth
       │                            │
┌──────┴──────┐              ┌──────▼──────┐
│   NATS     │              │ key-service │
│  (cluster) │              │    (KMS)     │
└──────┬──────┘              └──────┬──────┘
       │                            │
       │  order requests            │  decrypt credentials
       ▼                            ▼
┌─────────────┐              ┌─────────────┐
│trading-worker│             │  PostgreSQL │
│ (executes)   │              │    Redis   │
└─────────────┘              └─────────────┘

Services

Service Purpose
api REST API, auth, accounts, positions, orders, WebSocket to exchanges
key-service Decrypts exchange credentials (API keys) for trading-worker
trading-worker Consumes orders from NATS, executes on exchanges
ws-service Proxies NATS (prices, positions, results, alerts) to dashboard WebSocket
pnl-engine Trades + user stats (win rate, net PnL)
tg-listener Telegram signals → open/close via NATS
spread-engine HFT spread detection across 6 exchanges
frontend React/Vite dashboard (Cactus Edge UI)

Supported Exchanges

Exchange REST WebSocket (prices) WebSocket (positions)
MEXC
Gate.io
Bitget
BingX
Bybit
Binance

Quick Start

Prerequisites

  • Docker & Docker Compose
  • Node.js 18+ (for local dev)

Environment

Copy examples (never commit real secrets):

cp .env.example .env
cp node-service/.env.example node-service/.env
cp node-service/accounts.example.json node-service/accounts.json

Fill required values in .env:

JWT_SECRET=<32-byte hex>
MASTER_ENCRYPTION_KEY=<32-byte hex>
KMS_INTERNAL_TOKEN=<64-char hex>

Generate secrets:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Run with Docker

docker compose up -d --build

DEX-CEX Scanner (optional)

docker compose --profile dexcex up -d

Dashboard at /api/dexcex/ via nginx proxy.


Auto-Trading: Signal Format

Open position

  • Ticker#TICKER or TICKER_USDT
  • LongLong + exchange (e.g. Long MEXC)
  • ShortShort + exchange (e.g. Short GATE)

Example:

#PEPE | Spread: 5%
🟢Long MEXC
🔴Short GATE

Close position

Message: #TICKER aligned


Project Structure

farm/
├── farm-spa/              # React/Vite dashboard (Docker frontend)
├── node-service/          # API + legacy dashboard + tg-listener
├── services/              # key-service, trading-worker, ws-service, …
├── spread-engine-hft/     # Spread HFT pipeline
├── dexcex-scanner/        # DEX-CEX arbitrage (optional)
├── portfolio/             # GitHub Pages showcase site
├── nats-eventbus/         # NATS cluster config
├── nginx/                 # Reverse proxy
├── monitoring/            # Prometheus, Grafana
└── docs/                  # Architecture, audits, publish checklist

Documentation


License

All Rights Reserved. See LICENSE.

This is a source-available portfolio showcase — not an open-source license. Viewing on GitHub does not grant rights to use, copy, modify, distribute, or deploy the software.

About

Multi-exchange trading terminal that lets users trade across 6 exchanges from a single interface. Includes real-time position tracking, spread detection, volume spike monitoring, PnL analytics, and automated trading tools.

Topics

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages