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, Tag, UtcTimestamp,
};

use super::super::enums::OrdType;
use super::{EvntGrp, InstrmtLegGrp, Instrument, SecAltIDGrp};

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

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

impl<'a> QuotEntryAckGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(295),
        Tag(299),
        &[
            Tag(15), Tag(22), Tag(40), Tag(48), Tag(55), Tag(60), Tag(62), Tag(64), Tag(65),
            Tag(106), Tag(107), Tag(132), Tag(133), Tag(134), Tag(135), Tag(167), Tag(188),
            Tag(189), Tag(190), Tag(191), Tag(192), Tag(193), 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(299), Tag(336), Tag(348), Tag(349),
            Tag(350), Tag(351), Tag(368), Tag(454), Tag(460), Tag(461), Tag(470), Tag(471),
            Tag(472), Tag(541), Tag(543), Tag(555), Tag(625), Tag(631), Tag(632), Tag(633),
            Tag(634), Tag(642), Tag(643), Tag(667), Tag(691), Tag(762), Tag(864), Tag(873),
            Tag(874), Tag(875), Tag(876), Tag(947),
        ],
        &[SecAltIDGrp::TABLE, EvntGrp::TABLE, InstrmtLegGrp::TABLE],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(299), Tag(555), Tag(132), Tag(133), Tag(134), Tag(135), Tag(62), Tag(188),
                Tag(190), Tag(189), Tag(191), Tag(631), Tag(632), Tag(633), Tag(634), Tag(60),
                Tag(336), Tag(625), Tag(64), Tag(40), Tag(193), Tag(192), Tag(642), Tag(643),
                Tag(15), Tag(368),
            ],
            &[Instrument::known_tags(), InstrmtLegGrp::known_tags()],
        );
        &TAGS
    }

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

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

    /// 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 `BidPx` (132) field.
    #[doc(alias = "BidPx")]
    pub fn bid_px(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(132))
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

    /// 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 `SettlDate` (64) field.
    #[doc(alias = "SettlDate")]
    pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(64))
    }

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

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

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

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

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

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

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

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