# CLOB-Sync
[](https://crates.io/crates/clob-sync)
[](https://docs.rs/clob-sync)
[](LICENSE)
[](https://crates.io/crates/clob-sync)
[](https://blog.rust-lang.org/2025/06/26/Rust-1.88.0/)
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
^
| +---------+
| | $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`:
```toml
[dependencies]
clob-sync = "0.1.2"
```
Or use `cargo add`:
```bash
cargo add clob-sync
```
## Development
```bash
git clone git@github.com:jfaleiro/clob-sync.git
cd clob-sync
```
```bash
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](https://www.conventionalcommits.org/en/v1.0.0/).
## License
This project is licensed under the [GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.en.html). See the [LICENSE](LICENSE) file for details.