pub struct QuotesData {Show 15 fields
pub ticker: String,
pub class_code: String,
pub date_time: Option<String>,
pub bid: Option<Decimal>,
pub ask: Option<Decimal>,
pub last_price: Option<Decimal>,
pub open: Option<Decimal>,
pub close: Option<Decimal>,
pub high: Option<Decimal>,
pub low: Option<Decimal>,
pub change: Option<Decimal>,
pub change_rate: Option<f64>,
pub value: Option<Decimal>,
pub volume: Option<Decimal>,
pub trade_num: Option<u64>,
}Expand description
A quote update of one instrument.
The current docs name the best sell price offer and the last price last. Older samples used ask
and lastPrice. Both spellings are read into QuotesData::ask and QuotesData::last_price.
The docs give no quantity at the best prices.
§Examples
use brokapi_bcs_protocol::ws::models::QuotesData;
// The current docs form.
let q: QuotesData = serde_json::from_str(
r#"{"ticker":"SBER","classCode":"TQBR","bid":305.86,"offer":305.96,"last":305.97}"#,
)?;
assert_eq!((q.bid, q.ask, q.last_price), (Some(dec!(305.86)), Some(dec!(305.96)), Some(dec!(305.97))));
// The older form.
let old: QuotesData = serde_json::from_str(r#"{"ticker":"SBER","classCode":"TQBR","ask":305.96,"lastPrice":305.97}"#)?;
assert_eq!(old.ask, Some(dec!(305.96)));Fields§
§ticker: StringTicker.
class_code: StringClass code (board).
date_time: Option<String>Time the data was updated (UTC), kept as the text the broker sends.
bid: Option<Decimal>Best buy price.
ask: Option<Decimal>Best sell price. The broker docs call the field offer, older samples ask. Both are read.
last_price: Option<Decimal>Price of the last trade. The broker docs call the field last, older samples lastPrice. Both are read.
open: Option<Decimal>Opening price of the session.
close: Option<Decimal>Closing price of the previous session.
high: Option<Decimal>Highest price of the day.
low: Option<Decimal>Lowest price of the day.
change: Option<Decimal>Price change over the session, in the price currency.
change_rate: Option<f64>Price change over the session, in percent.
value: Option<Decimal>Traded value. Not in the current docs, read if the broker sends it.
volume: Option<Decimal>Traded volume. Not in the current docs, read if the broker sends it.
trade_num: Option<u64>Number of trades. Not in the current docs, read if the broker sends it.
Trait Implementations§
Source§impl Clone for QuotesData
impl Clone for QuotesData
Source§fn clone(&self) -> QuotesData
fn clone(&self) -> QuotesData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more