1use crate::constant::{Exchange, Interval};
5use crate::time::DtNs;
6
7#[derive(Debug, Clone, PartialEq, Default)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10pub struct BarData {
11 pub gateway_name: String,
13 pub symbol: String,
15 pub exchange: Exchange,
17 pub datetime: DtNs,
19
20 pub interval: Option<Interval>,
22 pub volume: f64,
24 pub turnover: f64,
26 pub open_interest: f64,
28 pub open_price: f64,
30 pub high_price: f64,
32 pub low_price: f64,
34 pub close_price: f64,
36 pub pct_change: f64,
38}
39
40impl BarData {
41 pub fn en_symbol(&self) -> String {
43 crate::symbol::vt_symbol(&self.symbol, self.exchange)
44 }
45}