include!("generated/tick.rs");
pub use crate::right::ParsedRight;
macro_rules! impl_contract_id {
($ty:ident) => {
impl $ty {
#[inline]
pub fn is_call(&self) -> bool {
ParsedRight::from_wire_byte(self.right) == Some(ParsedRight::Call)
}
#[inline]
pub fn is_put(&self) -> bool {
ParsedRight::from_wire_byte(self.right) == Some(ParsedRight::Put)
}
#[inline]
pub fn has_contract_id(&self) -> bool {
self.expiration != 0
}
}
};
}
impl_contract_id!(TradeTick);
impl_contract_id!(QuoteTick);
impl_contract_id!(OhlcTick);
impl_contract_id!(EodTick);
impl_contract_id!(OpenInterestTick);
impl_contract_id!(TradeQuoteTick);
impl_contract_id!(MarketValueTick);
impl_contract_id!(GreeksAllTick);
impl_contract_id!(GreeksFirstOrderTick);
impl_contract_id!(GreeksSecondOrderTick);
impl_contract_id!(GreeksThirdOrderTick);
impl_contract_id!(IvTick);
use crate::flags;
impl TradeTick {
#[must_use]
pub fn is_cancelled(&self) -> bool {
flags::trade::CANCELLED_RANGE.contains(&self.condition)
}
#[must_use]
pub fn trade_condition_no_last(&self) -> bool {
self.condition_flags & flags::condition_flags::NO_LAST == flags::condition_flags::NO_LAST
}
#[must_use]
pub fn price_condition_set_last(&self) -> bool {
self.price_flags & flags::price_flags::SET_LAST == flags::price_flags::SET_LAST
}
#[must_use]
pub fn is_incremental_volume(&self) -> bool {
self.volume_type == flags::volume::INCREMENTAL
}
#[must_use]
pub fn regular_trading_hours(&self) -> bool {
(flags::trade::RTH_START_MS..=flags::trade::RTH_END_MS).contains(&self.ms_of_day)
}
#[must_use]
pub fn is_seller(&self) -> bool {
self.ext_condition1 == flags::trade::SELLER_CONDITION
}
}
impl OptionContract {
#[inline]
pub fn is_call(&self) -> bool {
ParsedRight::from_wire_byte(self.right) == Some(ParsedRight::Call)
}
#[inline]
pub fn is_put(&self) -> bool {
ParsedRight::from_wire_byte(self.right) == Some(ParsedRight::Put)
}
}
include!("generated/tick_layout_asserts.rs");