pricelevel 0.7.0

A high-performance, lock-free price level implementation for limit order books in Rust. This library provides the building blocks for creating efficient trading systems with support for multiple order types and concurrent access patterns.
Documentation
#[cfg(test)]
mod tests {
    use crate::execution::list::TradeList;
    use crate::execution::trade::Trade;
    use crate::orders::{Id, Side};
    use crate::utils::{Price, Quantity, TimestampMs};
    use std::str::FromStr;
    use uuid::Uuid;

    fn parse_uuid(input: &str) -> Uuid {
        match Uuid::parse_str(input) {
            Ok(value) => value,
            Err(error) => panic!("failed to parse uuid: {error}"),
        }
    }

    fn sample_trade() -> Trade {
        Trade::with_timestamp(
            Id::from_uuid(parse_uuid("6ba7b810-9dad-11d1-80b4-00c04fd430c8")),
            Id::from_u64(1),
            Id::from_u64(2),
            Price::new(10_000),
            Quantity::new(5),
            Side::Buy,
            TimestampMs::new(1_616_823_000_000),
        )
    }

    #[test]
    fn trade_list_display_and_parse_roundtrip() {
        let mut list = TradeList::new();
        list.add(sample_trade());

        let rendered = list.to_string();
        assert!(rendered.starts_with("Trades:["));
        assert!(rendered.contains("Trade:trade_id="));

        let parsed = match TradeList::from_str(&rendered) {
            Ok(value) => value,
            Err(error) => panic!("failed to parse trade list: {error:?}"),
        };

        assert_eq!(parsed.len(), 1);
        assert_eq!(parsed.as_vec()[0].trade_id(), list.as_vec()[0].trade_id());
    }

    #[test]
    fn trade_list_from_str_rejects_old_prefix() {
        let result = TradeList::from_str("Transactions:[]");
        assert!(result.is_err());
    }
}