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
52
53
54
55
56
57
//! WASM-compatible orderbook engine for Kraken WebSocket API v2
//!
//! This crate provides the core orderbook data structures and checksum validation.
//! It is designed to compile to both native and WASM targets.
//!
//! # Features
//!
//! - **Level 2 (L2)**: Aggregated price levels with checksum validation
//! - **Level 3 (L3)**: Order-level tracking with FIFO queue semantics
//!
//! # Critical WASM Constraints
//!
//! - NO `std::time::Instant` (panics in WASM)
//! - NO `tokio` (doesn't compile to WASM)
//! - NO networking code
//!
//! # L2 Example
//!
//! ```
//! use kraken_book::{Orderbook, OrderbookState};
//! use kraken_types::BookData;
//!
//! let mut book = Orderbook::new("BTC/USD");
//! assert_eq!(book.state(), OrderbookState::Uninitialized);
//! ```
//!
//! # L3 Example
//!
//! ```
//! use kraken_book::l3::{L3Book, L3Order, L3Side};
//! use rust_decimal_macros::dec;
//!
//! let mut book = L3Book::new("BTC/USD", 10);
//! book.add_order(L3Order::new("order1", dec!(100), dec!(1)), L3Side::Bid);
//!
//! if let Some(pos) = book.queue_position("order1") {
//! println!("Position: {}, Qty ahead: {}", pos.position, pos.qty_ahead);
//! }
//! ```
// Re-export main types
pub use ;
pub use ;
pub use ;
pub use TreeBook;
// Re-export L3 types at crate root for convenience
pub use ;