pub struct OrderBookResponse {
pub ticker: String,
pub class_code: String,
pub depth: Option<u32>,
pub date_time: Option<String>,
pub bid_volume: Option<Decimal>,
pub ask_volume: Option<Decimal>,
pub bids: Vec<OrderBookLevel>,
pub asks: Vec<OrderBookLevel>,
}Expand description
A snapshot of the order book.
bids run from the best (highest) price down and asks from the best (lowest) price up, as the broker
sends them. The code does not sort them.
§Examples
use brokapi_bcs_protocol::http::models::OrderBookResponse;
let book: OrderBookResponse = serde_json::from_str(
r#"{"ticker":"SBER","classCode":"TQBR","depth":2,"bidVolume":190,"askVolume":170,
"bids":[{"price":244.30,"quantity":100},{"price":244.25,"quantity":90}],
"asks":[{"price":244.35,"quantity":120},{"price":244.40,"quantity":50}]}"#,
)?;
assert_eq!(book.bids[0].price, dec!(244.30));Fields§
§ticker: StringTicker.
class_code: StringClass code (board).
depth: Option<u32>Depth of the book that was returned.
date_time: Option<String>Time the book was updated (UTC), kept as the text the broker sends.
bid_volume: Option<Decimal>Total quantity of the bids within depth, in pieces. It is the sum over the levels returned, not over the whole book.
ask_volume: Option<Decimal>Total quantity of the asks within depth, in pieces. It is the sum over the levels returned, not over the whole book.
bids: Vec<OrderBookLevel>Buy side, best price first.
asks: Vec<OrderBookLevel>Sell side, best price first.
Trait Implementations§
Source§impl Clone for OrderBookResponse
impl Clone for OrderBookResponse
Source§fn clone(&self) -> OrderBookResponse
fn clone(&self) -> OrderBookResponse
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 OrderBookResponse
impl Debug for OrderBookResponse
Source§impl<'de> Deserialize<'de> for OrderBookResponse
impl<'de> Deserialize<'de> for OrderBookResponse
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 OrderBookResponse
impl RefUnwindSafe for OrderBookResponse
impl Send for OrderBookResponse
impl Sync for OrderBookResponse
impl Unpin for OrderBookResponse
impl UnsafeUnpin for OrderBookResponse
impl UnwindSafe for OrderBookResponse
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