clob-sync 0.1.2

A synchronous, high-performance Central Limit Order Book implementation in Rust featuring an in-memory architecture with zero-cost abstractions and type-safe financial primitives for ultra-low latency trading applications.
Documentation

CLOB-Sync

crates.io docs.rs License Downloads MSRV

A synchronous, high-performance Central Limit Order Book implementation in Rust featuring an in-memory architecture with zero-cost abstractions and type-safe financial primitives for ultra-low latency trading applications.

Central Limit Order Book

A Central Limit Order Book (CLOB) is composed of two priority queues: asks (limit sell orders ordered low to high) and bids (limit buy orders ordered high to low). Orders at the same price are FIFO.

Price
  ^
  |     +---------+
  |     | $102 C  |  ← Worst Ask
  |     | $101 B  |
  |     | $100 A  |  ← Best Ask (lowest)
  |     +---------+
  |      spread
  |     +---------+
  |     | $99  X  |  ← Best Bid (highest)
  |     | $98  Y  |
  |     | $97  Z  |  ← Worst Bid
  |     +---------+
  +--------------------------> Quantity

Order Behavior

  • Limit orders: Not allowed to cross spread (buy price >= best ask, sell price <= best bid). Rests on book otherwise.
  • Market orders: Execute immediately at best price. Partial fills when liquidity insufficient.

Installation

Add this to your Cargo.toml:

[dependencies]
clob-sync = "0.1.2"

Or use cargo add:

cargo add clob-sync

Development

git clone git@github.com:jfaleiro/clob-sync.git
cd clob-sync
make setup

Main development tasks are executed as a result of git commit and git push operations.

Commit messages are validated during commit-msg phase of git hook and must be compatible with Conventional Commits.

License

This project is licensed under the GNU Affero General Public License v3.0. See the LICENSE file for details.