PROJECT / 1225 March 2026 — 27 April 2026

CEX Orderbook

A Rust and Actix Web prototype for exploring order-book APIs.

CEX Orderbook project preview
CEX Orderbook project preview

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

System architecture
100%

Scroll to explore the connections, or use Fit to see the full diagram.

Actix handlers around a shared in-memory order-book structureThis repository is an early HTTP prototype. It defines order/depth routes and shared book structures; matching, persistence, Redis integration, and complete order insertion are not implemented.HTTP clientPOST /orderDELETE /order/:idActix Web127.0.0.1:8080Order + depth handlersShared order bookArc<Mutex<Orderbook>>In-memory bids / asksJSON responsesOrder ID + quantitiesGET /depth aggregatesHTTP requestLock / accessSerialize resultHTTP response

Actix handlers around a shared in-memory order-book structure

  1. Actix Web registers order creation, deletion, and depth routes over an Arc<Mutex<Orderbook>> shared state.
  2. 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.
  3. This diagram describes the implemented HTTP/data-structure scaffold. A matching loop, Redis messaging, and durable persistence are not part of the published implementation.

CEX Orderbook · System architecture

Component responsibilities
  1. Actix HTTP service

    An Actix Web server exposes order creation, deletion, and depth routes on a shared Arc<Mutex<Orderbook>>.

  2. 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.

  3. 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

  1. Order API scaffold

    Explore order creation, deletion, and depth route handlers.

  2. Rust shared state

    Connect HTTP handlers to synchronized in-memory book structures.

  3. Prototype responses

    Return JSON order IDs, quantities, and aggregated depth responses.

More projects

View all
GitHub
LinkedIn
X