trading_toolkit/types/
data.rs1pub trait BaseData {
2 fn value(&self) -> f64;
3 fn weight(&self) -> u64;
4 fn epoch_time(&self) -> u128;
5}
6
7pub trait Candle {
8 fn open_price(&self) -> f64;
9 fn high_price(&self) -> f64;
10 fn low_price(&self) -> f64;
11 fn close_price(&self) -> f64;
12 fn tot_exec_volume(&self) -> u64;
13 fn epoch_time(&self) -> u128;
14}
15
16impl BaseData for dyn Candle {
17 fn value(&self) -> f64 {
18 self.close_price()
19 }
20
21 fn weight(&self) -> u64 {
22 self.tot_exec_volume()
23 }
24 fn epoch_time(&self) -> u128 {
25 self.epoch_time()
26 }
27}