pub struct L2Snapshot {
pub product_id: String,
pub bids: Vec<[String; 2]>,
pub asks: Vec<[String; 2]>,
}Expand description
Level 2 (L2) order book snapshot from Coinbase Advanced Trading API.
This structure represents a complete snapshot of the order book for a specific product, containing all current bid and ask levels. Each level includes price and size information.
§WebSocket Channel
This data is received via the level2 channel subscription.
§Performance Notes
- Uses
Stringfor flexibility with decimal parsing - Consider using
SmallStringfor better performance in hot paths - Arrays are used for bids/asks to maintain order and minimize allocations
Fields§
§product_id: StringThe trading pair identifier (e.g., “BTC-USD”, “ETH-USD”)
bids: Vec<[String; 2]>Current bid levels as [price, size] pairs, ordered from highest to lowest price
asks: Vec<[String; 2]>Current ask levels as [price, size] pairs, ordered from lowest to highest price
Trait Implementations§
Source§impl Debug for L2Snapshot
impl Debug for L2Snapshot
Source§impl<'de> Deserialize<'de> for L2Snapshot
impl<'de> Deserialize<'de> for L2Snapshot
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for L2Snapshot
impl RefUnwindSafe for L2Snapshot
impl Send for L2Snapshot
impl Sync for L2Snapshot
impl Unpin for L2Snapshot
impl UnwindSafe for L2Snapshot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more