pub struct OrderBookData {
pub ticker: String,
pub class_code: String,
pub depth: Option<u32>,
pub date_time: Option<String>,
pub bids: Vec<OrderBookLevel>,
pub asks: Vec<OrderBookLevel>,
}Expand description
An order book update. It is a full snapshot of the levels within depth, not a delta.
bids and asks come best price first, as the broker sends them. The code does not sort them.
§Examples
use brokapi_bcs_protocol::ws::models::OrderBookData;
let book: OrderBookData = serde_json::from_str(
r#"{"ticker":"SBER","classCode":"TQBR","depth":2,
"bids":[{"price":244.30,"quantity":100}],"asks":[{"price":244.35,"quantity":120}]}"#,
)?;
assert_eq!(book.bids[0].price, dec!(244.30));Fields§
§ticker: StringTicker.
class_code: StringClass code (board).
depth: Option<u32>Depth of the book.
date_time: Option<String>Time the book was updated (UTC), kept as the text the broker sends.
bids: Vec<OrderBookLevel>Buy side, best price first.
asks: Vec<OrderBookLevel>Sell side, best price first.
Trait Implementations§
Source§impl Clone for OrderBookData
impl Clone for OrderBookData
Source§fn clone(&self) -> OrderBookData
fn clone(&self) -> OrderBookData
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OrderBookData
impl Debug for OrderBookData
Source§impl<'de> Deserialize<'de> for OrderBookData
impl<'de> Deserialize<'de> for OrderBookData
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 OrderBookData
impl RefUnwindSafe for OrderBookData
impl Send for OrderBookData
impl Sync for OrderBookData
impl Unpin for OrderBookData
impl UnsafeUnpin for OrderBookData
impl UnwindSafe for OrderBookData
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