TitaniumBOE-Sim

Simulator of Cboe's BOE binary protocol with a matching engine, trading bots, REST API, WebSocket feed, and dashboard — all packaged in a single deployable JAR.

  • Java 21
  • Virtual Threads
  • Javalin
  • RocksDB
  • Docker
  • JUnit 5

The Problem

Cboe's BOE (Binary Order Entry) protocol is the binary standard used by institutional traders to send orders to U.S. options exchanges. It is not human-readable text: each message is an exact sequence of bytes in Little Endian format, with fixed-size fields, prices encoded with 4 implicit decimal places, and optional fields controlled by bitfields negotiated at session start.

Understanding how it works internally — and being able to experiment with it — is practically impossible without access to real trading systems.

The Solution

A full simulator that speaks the same language as Cboe, byte by byte, following the official spec v2.11.90. Any real BOE client can connect as if it were the actual exchange.

The system includes:

  • Matching engine with price-time priority — orders are matched by price and, within the same price, by arrival order (FIFO)
  • 3 trading bots that maintain constant market activity: Market Maker (provides liquidity on both sides), Trend Follower (follows momentum) and Random Trader (simulates market noise)
  • REST API + WebSocket for real-time market data and operations from any HTTP client
  • Web dashboard (Astro + Tailwind) served directly from the JAR — no extra server or build step
  • Interactive CLI to connect, submit orders and monitor the order book from the terminal
  • Full persistence with RocksDB: orders, trades and sessions survive restarts

Under the Hood

Each TCP connection runs on its own Java 21 Virtual Thread — the simplest model (blocking I/O) without the cost of real OS threads. Result: over 500 concurrent sessions with P99 Order Acknowledgment latency under 5ms.

The matching engine synchronizes per symbol instead of globally: AAPL and SPX can run matching in parallel without blocking each other. Writes to RocksDB go through an async queue — the client receives its confirmation before anything touches disk.

Protocol messages are modeled as Java 21 sealed classes, enabling exhaustive dispatch verified at compile time: adding a new message type without handling it is a compile error, not a silent bug.

Ti
TitaniumBOE-Sim · Arquitectura
Cboe Titanium U.S. Options BOE v2.11.90 · Java 21 · Virtual Threads
▶ Pruébalo — arrastra nodos · click para inspeccionar
clienteedgecoredatasim
HTTP / WSTCP binarydispatchprocessOrder()saveAsync()tradesREST looptrade eventsBrowser / DashboardAstro 5 · TailwindCLI · BOE Client SDKexternal integrationsRestApiServerJavalin 6.7 · :9091RESTWS /ws/feedScalar UICboeServerNIO · TCP :8081VThread/connLoginHeartbeatClientConnectionHandler1 sesión = 1 VThreadOrderManagervalida · enruta · respondeOrderValidatorack/rejectMatchingEnginelock por símbolo · FIFOOrderBook<sym>TreeMap<BigDecimal,List<Order>>price-time priorityPersistence LayerRocksDB 9.11 · write-behindOrderRepositoryTradeRepository6 column familiesBotManagerVThreads paralelosMarketMakerTrendFollowerRandomTrader
lanza hasta 50 órdenes BOE concurrentes recorriendo el sistema
Architecture diagram of TitaniumBOE-Sim

By the Numbers

  • 131 Java classes · 319 automated tests
  • 11 BOE message types with exact wire format per spec
  • P99 < 5ms Order Acknowledgment latency under sustained load
  • 500+ simultaneous TCP connections without drops
  • 10 implementation phases — from typed enums to per-session optional field negotiation
Architecture diagram of TitaniumBOE-Sim