#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::{OrdRejReason, OrdStatus};
#[derive(Clone, Copy)]
pub struct OrdListStatGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for OrdListStatGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> OrdListStatGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(73),
Tag(11),
&[
Tag(6), Tag(11), Tag(14), Tag(39), Tag(58), Tag(84), Tag(103), Tag(151), Tag(354),
Tag(355), Tag(526), Tag(636),
],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(11), Tag(526), Tag(14), Tag(39), Tag(636), Tag(151), Tag(84), Tag(6), Tag(103),
Tag(58), Tag(354), Tag(355),
],
&[],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "ClOrdID")]
pub fn cl_ord_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(11))
}
#[doc(alias = "SecondaryClOrdID")]
pub fn secondary_cl_ord_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(526))
}
#[doc(alias = "CumQty")]
pub fn cum_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(14))
}
#[doc(alias = "OrdStatus")]
pub fn ord_status(&self) -> Result<Option<OrdStatus<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(39))?.map(OrdStatus::from_value))
}
#[doc(alias = "WorkingIndicator")]
pub fn working_indicator(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(636))
}
#[doc(alias = "LeavesQty")]
pub fn leaves_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(151))
}
#[doc(alias = "CxlQty")]
pub fn cxl_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(84))
}
#[doc(alias = "AvgPx")]
pub fn avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(6))
}
#[doc(alias = "OrdRejReason")]
pub fn ord_rej_reason(&self) -> Result<Option<OrdRejReason>, InvalidValue> {
Ok(self.0.get_int(Tag(103))?.map(OrdRejReason::from_value))
}
#[doc(alias = "Text")]
pub fn text(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(58))
}
#[doc(alias = "EncodedTextLen")]
pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(354))
}
#[doc(alias = "EncodedText")]
pub fn encoded_text(&self) -> Option<&'a [u8]> {
self.0.get(Tag(355))
}
}
impl std::fmt::Debug for OrdListStatGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "OrdListStatGrp({})", self.0)
}
}