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::{
    AccountType, AcctIDSource, OrdType, PriceType, QtyType, QuotePriceType, QuoteRequestType,
    QuoteType, SettlType, Side,
};
use super::{
    EvntGrp, FinancingDetails, Instrument, OrderQtyData, Parties, QuotQualGrp, QuotReqLegsGrp,
    SecAltIDGrp, SpreadOrBenchmarkCurveData, Stipulations, UndInstrmtGrp, YieldData,
};

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

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

impl<'a> QuotReqGrp<'a> {
    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
        Tag(146),
        Tag(55),
        &[
            Tag(1), Tag(15), Tag(22), Tag(38), Tag(40), Tag(44), Tag(48), Tag(54), Tag(55), Tag(60),
            Tag(62), Tag(63), Tag(64), Tag(65), Tag(106), Tag(107), Tag(126), Tag(140), Tag(152),
            Tag(167), Tag(192), Tag(193), Tag(200), Tag(201), Tag(202), Tag(206), Tag(207),
            Tag(218), Tag(220), Tag(221), Tag(222), Tag(223), Tag(224), Tag(225), Tag(226),
            Tag(227), Tag(228), Tag(229), Tag(231), Tag(232), Tag(235), Tag(236), Tag(239),
            Tag(240), Tag(255), Tag(303), Tag(336), Tag(348), Tag(349), Tag(350), Tag(351),
            Tag(423), Tag(453), Tag(454), Tag(460), Tag(461), Tag(468), Tag(469), Tag(470),
            Tag(471), Tag(472), Tag(516), Tag(537), Tag(541), Tag(543), Tag(555), Tag(581),
            Tag(625), Tag(640), Tag(660), Tag(662), Tag(663), Tag(667), Tag(691), Tag(692),
            Tag(696), Tag(697), Tag(698), Tag(699), Tag(701), Tag(711), Tag(735), Tag(761),
            Tag(762), Tag(788), Tag(854), Tag(864), Tag(873), Tag(874), Tag(875), Tag(876),
            Tag(898), Tag(913), Tag(914), Tag(915), Tag(916), Tag(917), Tag(918), Tag(919),
            Tag(947),
        ],
        &[
            SecAltIDGrp::TABLE, EvntGrp::TABLE, UndInstrmtGrp::TABLE, Stipulations::TABLE,
            QuotReqLegsGrp::TABLE, QuotQualGrp::TABLE, Parties::TABLE,
        ],
    );

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(711), Tag(140), Tag(303), Tag(537), Tag(336), Tag(625), Tag(229), Tag(54),
                Tag(854), Tag(63), Tag(64), Tag(193), Tag(192), Tag(15), Tag(232), Tag(1), Tag(660),
                Tag(581), Tag(555), Tag(735), Tag(692), Tag(40), Tag(62), Tag(126), Tag(60),
                Tag(423), Tag(44), Tag(640), Tag(453),
            ],
            &[
                Instrument::known_tags(), FinancingDetails::known_tags(),
                UndInstrmtGrp::known_tags(), OrderQtyData::known_tags(), Stipulations::known_tags(),
                QuotReqLegsGrp::known_tags(), QuotQualGrp::known_tags(),
                SpreadOrBenchmarkCurveData::known_tags(), YieldData::known_tags(),
                Parties::known_tags(),
            ],
        );
        &TAGS
    }

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

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

    /// The `FinancingDetails` component.
    pub fn financing_details(&self) -> FinancingDetails<'a> {
        FinancingDetails(self.0)
    }

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

    /// The `QuoteRequestType` (303) field.
    #[doc(alias = "QuoteRequestType")]
    pub fn quote_request_type(&self) -> Result<Option<QuoteRequestType>, InvalidValue> {
        Ok(self.0.get_int(Tag(303))?.map(QuoteRequestType::from_value))
    }

    /// The `QuoteType` (537) field.
    #[doc(alias = "QuoteType")]
    pub fn quote_type(&self) -> Result<Option<QuoteType>, InvalidValue> {
        Ok(self.0.get_int(Tag(537))?.map(QuoteType::from_value))
    }

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

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

    /// The `QtyType` (854) field.
    #[doc(alias = "QtyType")]
    pub fn qty_type(&self) -> Result<Option<QtyType>, InvalidValue> {
        Ok(self.0.get_int(Tag(854))?.map(QtyType::from_value))
    }

    /// The `OrderQtyData` component.
    pub fn order_qty_data(&self) -> OrderQtyData<'a> {
        OrderQtyData(self.0)
    }

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

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

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

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

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

    /// The `AcctIDSource` (660) field.
    #[doc(alias = "AcctIDSource")]
    pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
        Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
    }

    /// The `AccountType` (581) field.
    #[doc(alias = "AccountType")]
    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
    }

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

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

    /// The `QuotePriceType` (692) field.
    #[doc(alias = "QuotePriceType")]
    pub fn quote_price_type(&self) -> Result<Option<QuotePriceType>, InvalidValue> {
        Ok(self.0.get_int(Tag(692))?.map(QuotePriceType::from_value))
    }

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

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

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

    /// The `SpreadOrBenchmarkCurveData` component.
    pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'a> {
        SpreadOrBenchmarkCurveData(self.0)
    }

    /// The `PriceType` (423) field.
    #[doc(alias = "PriceType")]
    pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
        Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
    }

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

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

    /// The `YieldData` component.
    pub fn yield_data(&self) -> YieldData<'a> {
        YieldData(self.0)
    }

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

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