apple-quant-algorithmic 0.1.0

Apple Quant's algorithmic trading api
Documentation
use bevy::prelude::Deref;

use crate::timestamp::{BinTimestamp, Timestamp, Timestamped};

#[derive(Debug, Default, Deref, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct TradeTimestamp(Timestamp);

impl TradeTimestamp {
	pub fn new(timestamp: Timestamp) -> Self {
		Self(timestamp)
	}

	pub fn into_bin_timestamp<const NS_LEN: u64>(self) -> BinTimestamp<NS_LEN> {
		BinTimestamp::new(&self)
	}
}

impl Timestamped for TradeTimestamp {
	fn timestamp(&self) -> &Timestamp {
		&self.0
	}
}