#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Decimal, Instances, InvalidValue, LazyKnownTags, MultipleValues, RawMessage, Tag,
};
use super::super::components::{
Header, InstrmtLegGrp, Instrument, MDFullGrp, Trailer, UndInstrmtGrp,
};
use super::super::enums::{ApplQueueResolution, CorporateAction, FinancialStatus};
pub struct MarketDataSnapshotFullRefresh(RawMessage);
impl MarketDataSnapshotFullRefresh {
pub const MSG_TYPE: &[u8] = b"W";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(262), Tag(711), Tag(555), Tag(291), Tag(292), Tag(451), Tag(268), Tag(813),
Tag(814),
],
&[
Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(), MDFullGrp::known_tags(),
],
);
&TAGS
}
pub fn from_raw(raw: RawMessage) -> Self {
Self(raw)
}
pub fn raw(&self) -> &RawMessage {
&self.0
}
pub fn header(&self) -> Header<'_> {
Header(self.0.scope(), Self::known_tags().get())
}
pub fn trailer(&self) -> Trailer<'_> {
Trailer(self.0.scope())
}
#[doc(alias = "MDReqID")]
pub fn md_req_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(262))
}
pub fn instrument(&self) -> Instrument<'_> {
Instrument(self.0.scope(), Self::known_tags().get())
}
#[doc(alias = "NoUnderlyings")]
pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoLegs")]
pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "FinancialStatus")]
pub fn financial_status(&self) -> Result<Option<MultipleValues<'_, FinancialStatus<'_>>>, InvalidValue> {
self.0.get_multiple_values(Tag(291))
}
#[doc(alias = "CorporateAction")]
pub fn corporate_action(&self) -> Result<Option<MultipleValues<'_, CorporateAction<'_>>>, InvalidValue> {
self.0.get_multiple_values(Tag(292))
}
#[doc(alias = "NetChgPrevDay")]
pub fn net_chg_prev_day(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(451))
}
#[doc(alias = "NoMDEntries")]
pub fn md_entries(&self) -> Result<Instances<'_, MDFullGrp<'_>>, InvalidValue> {
self.0.get_group(&MDFullGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "ApplQueueDepth")]
pub fn appl_queue_depth(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(813))
}
#[doc(alias = "ApplQueueResolution")]
pub fn appl_queue_resolution(&self) -> Result<Option<ApplQueueResolution>, InvalidValue> {
Ok(self.0.get_int(Tag(814))?.map(ApplQueueResolution::from_value))
}
}
impl std::fmt::Debug for MarketDataSnapshotFullRefresh {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "MarketDataSnapshotFullRefresh({})", self.0)
}
}
impl std::fmt::Display for MarketDataSnapshotFullRefresh {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}