r/algotradingcrypto • u/AxitorDev • 4h ago
Built a Binance client focused on tail latency: 237 µs p99.9 at live pace, while popular clients hit 4 to 10 ms
I trade on Binance myself, and the slow message is the one that costs money. It usually shows up exactly when the market moves. So I built my own client in C# on .NET 10 and benchmarked it against Binance.Net, the official Binance Rust SDK and NautilusTrader's adapter. Same recorded mainnet traffic, same machine.
Book ticker at live market pace, p99.9:
mine: 237 µs
Binance.Net: 3.9 ms
NautilusTrader: 7.0 ms
official Rust SDK: 10.2 ms
"But my ping to Binance is way more than that." True. Network costs everyone the same, though, and at the median all clients look fine. The gap shows up in bursts: messages pile up, and every one of them waits for the client to chew through the ones in front of it. A client that's 15 to 33x faster per message clears the burst that much faster. Binance.Net also hits GC pauses of up to 72 ms under load. Mine allocates nothing per message, so there are no GC pauses at all.
Speed is half of it. The other half is the stuff that burned me in live trading:
sockets that look alive but carry no data. A watchdog catches them
rate limit bans. The limiter is built so it can't get your IP banned
orders sent twice after a timeout. Can't happen by accident
daily connection rotation without a gap. New socket is up before the old one closes
USD-M futures, Spot and COIN-M: REST, WebSocket API, streams, user data, local order book. MIT license.
https://github.com/Axitor/Trading.Gateway
If it's useful for your setup, a star helps other traders find it ⭐
