CoinPanel: a crypto-trading platform connected in real time to the largest exchanges
Since 2021 I've been the fractional CTO of CoinPanel, a crypto-trading platform based in Sweden. I led its architecture, security and scalability through a period of extreme volatility in the crypto market, and then its move into Banking-as-a-Service.
- My role
- Fractional CTO
- Company
- CoinPanel, Sweden
- Stack
- Python, FastAPI, CCXT, GKE, Pub/Sub, Redis
- Since
- 2021
- −70%total infrastructure cost after reviewing the architecture
- −90%market-data cost after moving from Bigtable to Redis
- 13,000+trades per second at peak, on just four of the exchanges
- 7+exchanges connected: Binance, OKX, KuCoin, Bybit, Kraken…
The challenge
Ingesting and processing prices and trades from Binance, Crypto.com, OKX, KuCoin, Bybit, Kraken and other exchanges in real time, executing real orders with users' money, and keeping the platform stable exactly when traffic peaked: during the crashes and rebounds of 2022 and 2023.
What I built
- Market data ingestion: a service that collects trades and prices from the exchanges and stores them as time series, first in Bigtable and later in Redis.
- Order execution against the exchanges, decoupled with Pub/Sub queues and guarded with Redis locks so an order is never executed twice.
- Trading automation: bots with limit, market and trailing orders, plus real-time price alerts.
- Portfolio valuation: balances per asset and total value in BTC, USD, EUR, GBP and AUD.
- Custody of users' API keys in HashiCorp Vault, accessed through Google Cloud identities, with no credentials in the code.
- Microservices on Kubernetes (GKE) that autoscale on queue depth, and leadership of the engineering team.
Technical decisions
From Bigtable to Redis
We questioned the standard approach: the switch cut market-data costs by more than 90%, far more than the optimisations proposed by Google Cloud's specialists, and it improved performance too.
One layer for every exchange
CCXT with our own adapters for the exchanges that behaved differently: adding an exchange didn't mean rewriting the platform.
Scaling without getting blocked
Autoscaling on pending messages in the queue and a per-minute weight limiter for each exchange, so we could ride the peaks without getting our IPs banned.
Outcome
A trading platform that held up on the market's worst days, with infrastructure costs around 70% lower, and the technical foundation on which CoinPanel built its Banking-as-a-Service product.