1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/******************************************************************************
Author: Joaquín Béjar García
Email: jb@taunais.com
Date: 28/3/25
******************************************************************************/
//! Core price level module: lock-free order queue, matching, snapshots, and statistics.
//!
//! This module provides the central [`PriceLevel`] type that represents a single price
//! point in a limit order book. It manages a lock-free queue of orders, performs matching,
//! tracks statistics, and supports snapshot persistence with checksum protection.
//!
//! # Key Types
//!
//! - [`PriceLevel`] — the main lock-free price level implementation supporting concurrent
//! add, match, update, and cancel operations via atomic counters and crossbeam queues.
//! - [`PriceLevelData`] — a serializable representation for data transfer and storage.
//! - [`PriceLevelSnapshot`] — a point-in-time snapshot of all orders at a price level.
//! - [`PriceLevelSnapshotPackage`] — a checksum-protected wrapper around a snapshot for
//! safe persistence and recovery via JSON.
//! - [`PriceLevelStatistics`] — real-time execution statistics (orders added/removed/executed,
//! quantity/value executed, average price, waiting times).
//! - [`OrderQueue`] — the underlying lock-free order queue based on crossbeam.
//!
//! # Snapshot Persistence
//!
//! Snapshots can be serialized to JSON with SHA-256 checksum protection:
//!
//! ```rust
//! use pricelevel::PriceLevel;
//!
//! let level = PriceLevel::new(10_000);
//! let json = level.snapshot_to_json().unwrap();
//! let restored = PriceLevel::from_snapshot_json(&json).unwrap();
//! ```
pub use ;
pub use OrderQueue;
pub use ;
pub use PriceLevelStatistics;