I reverse-engineered the IB Gateway and rebuilt it in Rust for low latency
u/PyOdyssee ·
Reddit — r/algotrading
· March 16, 2026 at 16:47
· ⬆ 36 pts
· 💬 24 comments
| View on Reddit ↗
AI Summary
Summary
The author reverse-engineered the Interactive Brokers (IB) Gateway FIX protocol and rebuilt it in Rust (named IBX) to achieve lower latency for algorithmic trading.
Benchmarks provided by the author show a 5.5x improvement in limit order submission latency compared to the standard C++ TWS API.
Quality assessment: High-quality technical/infrastructure contribution for quantitative traders, but contains no directional investment DD or market speculation (noise from an asset allocation perspective).
Score36
Comments24
Upvote %97%
▶ Full Post Text
I spent the last month decrypting the FIX protocol of the IB Gateway using Java bytecode instrumentation tool (ByteBuddy) and javap disassembly to build my own version of the gateway.
I built it in Rust, with direct FIX connection, designed for low-latency, named IBX: [https://github.com/deepentropy/ibx](https://github.com/deepentropy/ibx)
It includes a lot of integration tests, excluding some specific features like Financial Advisor, Options... It also ships with an ibapi-compatible Python layer (EClient/EWrapper) via PyO3, so you can migrate existing ibapi or ib\_async code with minimal changes. There are [https://github.com/deepentropy/ibx/tree/main/notebooks](https://github.com/deepentropy/ibx/tree/main/notebooks) adapted from ib\_async's examples covering basics, market data, historical bars, tick-by-tick, and ordering.
Purpose of sharing it is to raise bugs/gaps in the hope to run it with a live account. Hope you could give it a try.
Check the [readme.md](https://github.com/deepentropy/ibx/blob/main/README.md), it explains how you could use it from Rust, but also bridging it with python PyO3.
Just some Order Latency benchmark I ran over the public network (same machine, same network path). This would need more serious testing from a datacenter next to IB Servers in Chicago/New-York, but it gives a rough idea:
| Metric | IBX | C++ TWS API | Ratio |
|---|---|---|---|
| Limit submit → ack | 114.8ms | 632.9ms | **5.5x faster** |
| Limit cancel → confirm | 125.7ms | 148.2ms | 1.2x faster |
| **Limit full round-trip** | **240.5ms** | **781.1ms** | **3.2x faster** |