Bitcoin Forum
June 25, 2026, 01:13:46 AM *
News: Latest Bitcoin Core release: 31.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: UBDCC: self-hosted Binance DepthCache cluster (MIT, REST, any language)  (Read 23 times)
alice_bob (OP)
Sr. Member
****
Offline

Activity: 322
Merit: 250



View Profile WWW
May 05, 2026, 07:19:47 AM
 #1

UBDCC: A self-hosted DepthCache cluster for Binance order books (MIT, any language via REST)

If you run more than one bot or service against Binance order books, you have probably bumped into the same set of headaches:

  • Each process keeps its own DepthCache, and they slowly drift out of sync with each other
  • Cold starts eat minutes of REST snapshots before the cache is usable again
  • Silent desync — top of book looks fine, deeper levels are wrong, and you only find out from a bad fill
  • Orphaned price levels beyond Binance's top-1000 guarantee that quietly stay in your book forever
  • Your Go service and your Python research notebook can't share one book without writing glue

UBDCC (UNICORN Binance Depth Cache Cluster) turns DepthCaches into a small self-hosted service that any language can query over REST/JSON. One source of truth, kept fresh by a cluster instead of a single process.

What you get:
  • Sequence validation + gap detection per stream — desyncs surface as errors, not as bad data
  • Replication and load balancing across DepthCacheNodes — losing a pod doesn't lose your book
  • Self-healing cluster: nodes drop in/out, work gets redistributed automatically
  • Built-in rate limiting so snapshot refreshes never trip Binance
  • ~3 ms internal response times for bids/asks queries
  • Spot, Futures, Options across binance.com / binance.us / binance.tr / testnets
  • Browser dashboard with an API builder that hands you ready-to-paste code for curl, Python, JS, Go, Rust, Java, C#, PHP

Try it locally:
Code:
pip install ubdcc
ubdcc start --dcn 4

That spins up a four-node cluster on your machine. Same stack scales to Docker Compose or Kubernetes when you want to move it off your laptop.

Resources:
MIT licensed, part of the broader UNICORN Binance Suite.

Happy to hear what's missing for your workflow — feature ideas and pain points welcome.

Creator of the UNICORN Binance Suite — 6 open source Python libraries for automated trading systems on Binance. Built and maintained entirely solo since 2019.
alice_bob (OP)
Sr. Member
****
Offline

Activity: 322
Merit: 250



View Profile WWW
June 03, 2026, 10:35:53 PM
Last edit: June 11, 2026, 10:57:39 AM by alice_bob
 #2

Small follow-up update:

I tested the Kubernetes setup at a larger scale now.

UBDCC created all active Binance Spot + Futures markets as replicated DepthCaches on a 6-node Vultr Kubernetes cluster:

- 2013 markets
- 2 replicas per market
- 4026 replicated DepthCaches
- no Binance API credentials
- public market data only
- full sync in about 25 minutes

I also ran Grafana Cloud k6 tests against the REST API.

The interesting part was not just the RPS number, but the difference between one hot market and distributed access across many markets.

Full write-up:

https://blog.technopathy.club/i-created-2013-binance-order-books-on-kubernetes-with-2-replicas-in-25-minutes-then-stress-tested-the-rest-api

YouTube:
https://youtu.be/erxIkwmqlmk

Creator of the UNICORN Binance Suite — 6 open source Python libraries for automated trading systems on Binance. Built and maintained entirely solo since 2019.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!