TitaniumBOE-Sim Cboe BOE Protocol Simulator
Exchange-side simulator for Cboe's BOE binary protocol, with a price-time matching engine, trading bots, REST API and WebSocket in a single JAR.
- Stack
- Java 21 · Javalin · RocksDB · WebSocket · Docker
- Status
- Completed
- Year
- 2025
- Code
- GitHub ↗DeepWiki ↗
Latest trades
Send an order and watch it cross the book.
See this order’s bytes ↓On the real server, 99% of acknowledgments arrive in under 4 ms.
On the wire, every order is a 56-byte binary message. Tap a field to see how it decodes.
Real New Order message · 56 bytes
Start of message offset 0–1 · 2 bytes
BA BA
Two fixed bytes that mark where each BOE message starts in the TCP stream.
Length offset 2–3 · 2 bytes
54 bytes
36 00 in Little Endian is 0x0036 = 54: the message size, not counting the 2 start bytes.
Message type offset 4 · 1 bytes
New Order
0x38 identifies a new order. This byte tells the server how to read the rest.
Matching unit offset 5 · 1 bytes
0
Always 0 in messages sent by the client.
Sequence number offset 6–9 · 4 bytes
42
2A 00 00 00 → 0x0000002A = 42. In Little Endian the least significant byte comes first.
ClOrdID offset 10–29 · 20 bytes
ORD-0001
The ID the client gives its order, in ASCII and padded with NUL (00) up to 20 bytes.
Side offset 30 · 1 bytes
Buy
The character '1' in ASCII (0x31) means buy; '2' would be sell.
Quantity offset 31–34 · 4 bytes
100
64 00 00 00 → 0x64 = 100 contracts, Little Endian again.
Number of bitfields offset 35 · 1 bytes
2
Says 2 bitfield bytes follow: each set bit announces an optional field at the end of the message.
Bitfield 1 offset 36 · 1 bytes
Price + OrdType
0x14 = 0001 0100: the bit worth 4 announces Price and the bit worth 16 announces OrdType.
Bitfield 2 offset 37 · 1 bytes
Symbol + Capacity
0x41 = 0100 0001: the bit worth 1 announces Symbol and the bit worth 64 announces Capacity.
Price offset 38–45 · 8 bytes
187.2500 USD
8 bytes in Little Endian: 0x1C9274 = 1,872,500. With 4 implied decimals that is 187.2500, with no floating point on the wire.
OrdType offset 46 · 1 bytes
Limit
'2' (0x32) is a limit order: it only fills at 187.25 or better.
Symbol offset 47–54 · 8 bytes
AAPL
AAPL in ASCII, padded with NUL (00) up to 8 bytes.
Capacity offset 55 · 1 bytes
Customer
'C' (0x43): the order belongs to a customer, not the broker's own account.
The interactive piece for this case lives at ymid.me/en/projects/titaniumboe-sim/
What BOE is
BOE (Binary Order Entry) is the protocol participants use to send orders to Cboe's U.S. options markets. It isn't text: every message is an exact sequence of bytes in Little Endian, with fixed-size fields, prices with 4 implied decimals, and optional fields announced through bitfields. Above you can send an order to the book and then see its bytes, encoded the same way the simulator does it.
What I built
An exchange-side simulator, written from the v2.11.90 specification: it accepts TCP connections, authenticates sessions, receives BOE orders and matches them in a price-time priority matching engine. Around that:
- Three bots (market maker, trend follower and random trader) that keep the book active.
- A REST API and WebSocket for market data and trading.
- Interactive API docs (OpenAPI with Scalar) served from the same JAR.
- RocksDB persistence: users, trades and orders survive a restart, and live orders go back into the book.
Under the hood
- Every TCP connection runs on its own Java 21 virtual thread: blocking I/O code that is easy to read, without paying for an OS thread per client.
- Matching is synchronized per symbol, not globally: AAPL and MSFT match in parallel without blocking each other.
- Writes to RocksDB go through an asynchronous queue: the client gets its acknowledgment without waiting on disk.
- Messages form a sealed-class hierarchy, so the compiler knows every possible type.
How close it is to the spec
I reviewed the simulator section by section against the v2.11.90 specification and fixed every difference I found. The spec's own hexadecimal examples are used as tests, and when an example contradicts its tables I log it as an erratum instead of copying it. What it complies with today:
- Every message code, the 1 s / 5 s heartbeat, and login with its reject codes.
- Sequenced and unsequenced messages, with replay of what was missed on reconnect.
- The optional fields the client asks for at login (return bitfields), message by message.
- Day, IOC, FOK, GTC and GTD orders; reserve, minimum quantity and stop orders; self-trade prevention.
- Cancel and Modify with their priority rules, mass cancel, Purge Orders, risk lockouts and Reset Risk.
What it doesn't have, answering with the reject the spec defines: auctions, complex orders, crosses and market-maker quotes. It doesn't use option series symbology yet either: the book trades symbols like AAPL.
Measured numbers
With the repository's load test, on a 16-core machine and a freshly started server for each run:
- 500 simultaneous TCP connections, none refused.
- Order Acknowledgment P99 between 2.5 and 4.0 ms (900 orders per run, across 10 sessions, all acknowledged).
- About 4,600 REST requests per second on public endpoints.
- More than 600 automated tests, all green.
The P99 is measured after the connection, login and REST phases, which warm up the JIT. Measuring latency alone on a cold server, the P99 lands between 7.2 and 13.9 ms.
While measuring I found the load test itself was out of date: it expected the old session codes and sent orders for a symbol the server rejects, so logins and latency hadn't been measured in a while. I fixed it before publishing these numbers. The memory phase is still not useful: it measures the client's heap, not the server's, so I don't publish that number.
The bottleneck
Login doesn't reach the target I had set (200 per second): it sits at around 50. Every password is checked with BCrypt at cost 12, which takes on the order of 200 ms of CPU per attempt; with 16 cores, the ceiling is around 60 logins per second. It's a deliberate cost: lowering it would make a brute-force attack cheaper.