Work / Cuantum

Cuantum — crypto copy-trading platform

Signal-based copy trading across centralized exchanges, from TradingView webhooks and strategy engines through CCXT order routing to PnL settlement and BSC deposit watching.

A full-stack platform for signal-based copy trading across centralized exchanges. The backend ingests TradingView webhooks and strategy engine signals (Pine Script → Node), routes them to follower accounts via CCXT with per-exchange credential isolation, and manages the full order lifecycle: entry, take-profit (per-entry, OB-based, multi-level), stop-loss, and PnL harvesting with automated fee collection.

Engineering work

  • Fixed a 1.5 GB heap leak from unbounded CCXT instance creation by introducing credential-keyed instance caching with TTL eviction.
  • Eliminated cascading RPC rate-limit storms in the BSC deposit watcher with a scan guard and exponential backoff.
  • Added per-bar signal deduplication to the V2 strategy engine so 4H strategies fire once per bar instead of every 5 seconds.
  • Implemented OB-based and multi-level TP delegation on the runner path, previously only in the webhook path.

Deployed on a VPS with Nginx and PM2 at cuantum.tuttilabs.xyz.

System Architecture

Cuantum system architecture: clients, Express API, strategy runner, exec engine, workers, and external services

Clients (Next.js app, TradingView alerts, admin console) call the Express API over REST and SSE. The strategy runner evaluates V2/V3/Grid-ATR engines with per-bar dedupe, the exec engine routes risk-checked orders to exchanges through CCXT, and background workers own deposit watching, sweeping, and reconciliation. One box runs the single-writer workers so deposits and PnL are never credited twice.

Database Schema

Cuantum MongoDB schema: User, ExchangeAccount, Strategy, Follower, Order, Signal, FollowerFill, and money ledger collections

Fourteen Mongoose collections. The core chain is User → ExchangeAccount / Follower / Strategy, with Follower binding a user, a strategy, and an exchange account together under explicit capital and leverage limits. Orders and signals hang off strategies and followers. A separate money layer (Deposit, UserCredit, CreditTxn, ProfitLog, WithdrawalRequest) keeps balances and fee settlement auditable and idempotent.

Stack

Cuantum tech stack: Next.js frontend, Node/Express backend, CCXT trading engine, MongoDB data layer, ethers v6 on BSC, PM2 and Nginx infrastructure

Next.js 14 on the frontend; Node.js and Express on the backend; CCXT plus a Pine Script-derived engine layer for trading; MongoDB Atlas via Mongoose for data; ethers v6 against BSC for deposits; PM2, Nginx, and Let's Encrypt on the VPS.

← All work