refix-fix44 0.12.0

Typed FIX 4.4 protocol messages for the ReFIX engine
Documentation
// @generated by refix codegen from FIX44.xml. Do not edit.
#![cfg_attr(rustfmt, rustfmt::skip)]

use refix_message::{
    Date, Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, MultipleValues, Tag, Time,
    UtcTimestamp,
};

use super::super::enums::{
    CorporateAction, DeleteReason, ExecInst, FinancialStatus, MDEntryType, MDUpdateAction,
    OpenCloseSettlFlag, QuoteCondition, Scope, TickDirection, TimeInForce, TradeCondition,
};
use super::{EvntGrp, InstrmtLegGrp, Instrument, SecAltIDGrp, UndInstrmtGrp};

/// An instance of the `NoMDEntries` (268) group.
#[derive(Clone, Copy)]
pub struct MDIncGrp<'a>(refix_message::Scope<'a>);

impl<'a> From<refix_message::Scope<'a>> for MDIncGrp<'a> {
    fn from(scope: refix_message::Scope<'a>) -> Self {
        Self(scope)
    }
}

impl<'a> MDIncGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(268),
        Tag(279),
        &[
            Tag(15), Tag(18), Tag(22), Tag(37), Tag(48), Tag(55), Tag(58), Tag(59), Tag(65),
            Tag(106), Tag(107), Tag(110), Tag(126), Tag(167), Tag(200), Tag(201), Tag(202),
            Tag(206), Tag(207), Tag(223), Tag(224), Tag(225), Tag(226), Tag(227), Tag(228),
            Tag(231), Tag(239), Tag(240), Tag(255), Tag(269), Tag(270), Tag(271), Tag(272),
            Tag(273), Tag(274), Tag(275), Tag(276), Tag(277), Tag(278), Tag(279), Tag(280),
            Tag(282), Tag(283), Tag(284), Tag(285), Tag(286), Tag(287), Tag(288), Tag(289),
            Tag(290), Tag(291), Tag(292), Tag(299), Tag(336), Tag(346), Tag(348), Tag(349),
            Tag(350), Tag(351), Tag(354), Tag(355), Tag(432), Tag(451), Tag(454), Tag(460),
            Tag(461), Tag(470), Tag(471), Tag(472), Tag(541), Tag(543), Tag(546), Tag(555),
            Tag(625), Tag(667), Tag(691), Tag(711), Tag(762), Tag(811), Tag(864), Tag(873),
            Tag(874), Tag(875), Tag(876), Tag(947),
        ],
        &[SecAltIDGrp::TABLE, EvntGrp::TABLE, UndInstrmtGrp::TABLE, InstrmtLegGrp::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(279), Tag(285), Tag(269), Tag(278), Tag(280), Tag(711), Tag(555), Tag(291),
                Tag(292), Tag(270), Tag(15), Tag(271), Tag(272), Tag(273), Tag(274), Tag(275),
                Tag(336), Tag(625), Tag(276), Tag(277), Tag(282), Tag(283), Tag(284), Tag(286),
                Tag(59), Tag(432), Tag(126), Tag(110), Tag(18), Tag(287), Tag(37), Tag(299),
                Tag(288), Tag(289), Tag(346), Tag(290), Tag(546), Tag(811), Tag(451), Tag(58),
                Tag(354), Tag(355),
            ],
            &[Instrument::known_tags(), UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags()],
        );
        &TAGS
    }

    pub fn raw(&self) -> refix_message::Scope<'a> {
        self.0
    }

    /// The `MDUpdateAction` (279) field.
    #[doc(alias = "MDUpdateAction")]
    pub fn md_update_action(&self) -> Result<Option<MDUpdateAction<'a>>, InvalidValue> {
        Ok(self.0.get_str(Tag(279))?.map(MDUpdateAction::from_value))
    }

    /// The `DeleteReason` (285) field.
    #[doc(alias = "DeleteReason")]
    pub fn delete_reason(&self) -> Result<Option<DeleteReason<'a>>, InvalidValue> {
        Ok(self.0.get_str(Tag(285))?.map(DeleteReason::from_value))
    }

    /// The `MDEntryType` (269) field.
    #[doc(alias = "MDEntryType")]
    pub fn md_entry_type(&self) -> Result<Option<MDEntryType<'a>>, InvalidValue> {
        Ok(self.0.get_str(Tag(269))?.map(MDEntryType::from_value))
    }

    /// The `MDEntryID` (278) field.
    #[doc(alias = "MDEntryID")]
    pub fn md_entry_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(278))
    }

    /// The `MDEntryRefID` (280) field.
    #[doc(alias = "MDEntryRefID")]
    pub fn md_entry_ref_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(280))
    }

    /// The `Instrument` component.
    pub fn instrument(&self) -> Instrument<'a> {
        Instrument(self.0, Self::known_tags().get())
    }

    /// The instances of the `NoUnderlyings` (711) group.
    #[doc(alias = "NoUnderlyings")]
    pub fn underlyings(&self) -> Result<Instances<'a, UndInstrmtGrp<'a>>, InvalidValue> {
        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The instances of the `NoLegs` (555) group.
    #[doc(alias = "NoLegs")]
    pub fn legs(&self) -> Result<Instances<'a, InstrmtLegGrp<'a>>, InvalidValue> {
        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The `FinancialStatus` (291) field.
    #[doc(alias = "FinancialStatus")]
    pub fn financial_status(&self) -> Result<Option<MultipleValues<'a, FinancialStatus<'a>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(291))
    }

    /// The `CorporateAction` (292) field.
    #[doc(alias = "CorporateAction")]
    pub fn corporate_action(&self) -> Result<Option<MultipleValues<'a, CorporateAction<'a>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(292))
    }

    /// The `MDEntryPx` (270) field.
    #[doc(alias = "MDEntryPx")]
    pub fn md_entry_px(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(270))
    }

    /// The `Currency` (15) field.
    #[doc(alias = "Currency")]
    pub fn currency(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(15))
    }

    /// The `MDEntrySize` (271) field.
    #[doc(alias = "MDEntrySize")]
    pub fn md_entry_size(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(271))
    }

    /// The `MDEntryDate` (272) field.
    #[doc(alias = "MDEntryDate")]
    pub fn md_entry_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(272))
    }

    /// The `MDEntryTime` (273) field.
    #[doc(alias = "MDEntryTime")]
    pub fn md_entry_time(&self) -> Result<Option<Time>, InvalidValue> {
        self.0.get_time(Tag(273))
    }

    /// The `TickDirection` (274) field.
    #[doc(alias = "TickDirection")]
    pub fn tick_direction(&self) -> Result<Option<TickDirection<'a>>, InvalidValue> {
        Ok(self.0.get_str(Tag(274))?.map(TickDirection::from_value))
    }

    /// The `MDMkt` (275) field.
    #[doc(alias = "MDMkt")]
    pub fn md_mkt(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(275))
    }

    /// The `TradingSessionID` (336) field.
    #[doc(alias = "TradingSessionID")]
    pub fn trading_session_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(336))
    }

    /// The `TradingSessionSubID` (625) field.
    #[doc(alias = "TradingSessionSubID")]
    pub fn trading_session_sub_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(625))
    }

    /// The `QuoteCondition` (276) field.
    #[doc(alias = "QuoteCondition")]
    pub fn quote_condition(&self) -> Result<Option<MultipleValues<'a, QuoteCondition<'a>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(276))
    }

    /// The `TradeCondition` (277) field.
    #[doc(alias = "TradeCondition")]
    pub fn trade_condition(&self) -> Result<Option<MultipleValues<'a, TradeCondition<'a>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(277))
    }

    /// The `MDEntryOriginator` (282) field.
    #[doc(alias = "MDEntryOriginator")]
    pub fn md_entry_originator(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(282))
    }

    /// The `LocationID` (283) field.
    #[doc(alias = "LocationID")]
    pub fn location_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(283))
    }

    /// The `DeskID` (284) field.
    #[doc(alias = "DeskID")]
    pub fn desk_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(284))
    }

    /// The `OpenCloseSettlFlag` (286) field.
    #[doc(alias = "OpenCloseSettlFlag")]
    pub fn open_close_settl_flag(&self) -> Result<Option<MultipleValues<'a, OpenCloseSettlFlag<'a>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(286))
    }

    /// The `TimeInForce` (59) field.
    #[doc(alias = "TimeInForce")]
    pub fn time_in_force(&self) -> Result<Option<TimeInForce<'a>>, InvalidValue> {
        Ok(self.0.get_str(Tag(59))?.map(TimeInForce::from_value))
    }

    /// The `ExpireDate` (432) field.
    #[doc(alias = "ExpireDate")]
    pub fn expire_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(432))
    }

    /// The `ExpireTime` (126) field.
    #[doc(alias = "ExpireTime")]
    pub fn expire_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
        self.0.get_utc_timestamp(Tag(126))
    }

    /// The `MinQty` (110) field.
    #[doc(alias = "MinQty")]
    pub fn min_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(110))
    }

    /// The `ExecInst` (18) field.
    #[doc(alias = "ExecInst")]
    pub fn exec_inst(&self) -> Result<Option<MultipleValues<'a, ExecInst<'a>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(18))
    }

    /// The `SellerDays` (287) field.
    #[doc(alias = "SellerDays")]
    pub fn seller_days(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(287))
    }

    /// The `OrderID` (37) field.
    #[doc(alias = "OrderID")]
    pub fn order_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(37))
    }

    /// The `QuoteEntryID` (299) field.
    #[doc(alias = "QuoteEntryID")]
    pub fn quote_entry_id(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(299))
    }

    /// The `MDEntryBuyer` (288) field.
    #[doc(alias = "MDEntryBuyer")]
    pub fn md_entry_buyer(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(288))
    }

    /// The `MDEntrySeller` (289) field.
    #[doc(alias = "MDEntrySeller")]
    pub fn md_entry_seller(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(289))
    }

    /// The `NumberOfOrders` (346) field.
    #[doc(alias = "NumberOfOrders")]
    pub fn number_of_orders(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(346))
    }

    /// The `MDEntryPositionNo` (290) field.
    #[doc(alias = "MDEntryPositionNo")]
    pub fn md_entry_position_no(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(290))
    }

    /// The `Scope` (546) field.
    #[doc(alias = "Scope")]
    pub fn scope(&self) -> Result<Option<MultipleValues<'a, Scope<'a>>>, InvalidValue> {
        self.0.get_multiple_values(Tag(546))
    }

    /// The `PriceDelta` (811) field.
    #[doc(alias = "PriceDelta")]
    pub fn price_delta(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(811))
    }

    /// The `NetChgPrevDay` (451) field.
    #[doc(alias = "NetChgPrevDay")]
    pub fn net_chg_prev_day(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(451))
    }

    /// The `Text` (58) field.
    #[doc(alias = "Text")]
    pub fn text(&self) -> Result<Option<&'a str>, InvalidValue> {
        self.0.get_str(Tag(58))
    }

    /// The `EncodedTextLen` (354) field.
    #[doc(alias = "EncodedTextLen")]
    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(354))
    }

    /// The `EncodedText` (355) field.
    #[doc(alias = "EncodedText")]
    pub fn encoded_text(&self) -> Option<&'a [u8]> {
        self.0.get(Tag(355))
    }
}

impl std::fmt::Debug for MDIncGrp<'_> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "MDIncGrp({})", self.0)
    }
}