Skip to main content

apple_quant_algorithmic/timestamp/
point_trade.rs

1use bevy::prelude::Deref;
2
3use crate::timestamp::{BinTimestamp, Timestamp, Timestamped};
4
5#[derive(Debug, Default, Deref, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
6pub struct TradeTimestamp(Timestamp);
7
8impl TradeTimestamp {
9	pub fn new(timestamp: Timestamp) -> Self {
10		Self(timestamp)
11	}
12
13	pub fn into_bin_timestamp<const NS_LEN: u64>(self) -> BinTimestamp<NS_LEN> {
14		BinTimestamp::new(&self)
15	}
16}
17
18impl Timestamped for TradeTimestamp {
19	fn timestamp(&self) -> &Timestamp {
20		&self.0
21	}
22}