CEX Orderbook
A Rust and Actix Web prototype for exploring order-book APIs.
Overview
CEX Orderbook is an early Rust prototype that connects Actix HTTP handlers to a shared in-memory order-book structure. It explores routing, synchronized state, and JSON responses. The published implementation is a scaffold; matching and complete order insertion remain unfinished.
Architecture
Scroll to explore the connections, or use Fit to see the full diagram.
Actix handlers around a shared in-memory order-book structure
- Actix Web registers order creation, deletion, and depth routes over an Arc<Mutex<Orderbook>> shared state.
- The current create_order implementation increments the ID and constructs an order, but does not insert it into the book. Filled quantity is returned as zero.
- This diagram describes the implemented HTTP/data-structure scaffold. A matching loop, Redis messaging, and durable persistence are not part of the published implementation.
Component responsibilities
Actix HTTP service
An Actix Web server exposes order creation, deletion, and depth routes on a shared Arc<Mutex<Orderbook>>.
Order-book scaffold
The current code increments order IDs and constructs an order, but does not insert it into the book. The returned filled quantity is zero.
Prototype boundary
The published implementation does not include a matching loop, Redis messaging, or durable persistence.
Why I built this
I wanted to study the matching engine at the center of an exchange and strengthen my Rust and data-structure skills. Focusing on the order book let me work directly on bid/ask matching and the surrounding communication flow.
Use case
A local learning environment for exercising Rust HTTP routes and synchronized order-book state before implementing a complete matching engine.
What I learned
- Connecting Actix routes to shared Rust state.
- Working with Arc and Mutex around in-memory data structures.
- Separating an HTTP scaffold from the insertion and matching behavior still needed for a complete order book.
Key features
Order API scaffold
Explore order creation, deletion, and depth route handlers.
Rust shared state
Connect HTTP handlers to synchronized in-memory book structures.
Prototype responses
Return JSON order IDs, quantities, and aggregated depth responses.


