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, Instances, InvalidValue, LazyKnownTags, MultipleValues, RawMessage, Tag,
    UtcTimestamp,
};

use super::super::components::{
    DiscretionInstructions, Header, InstrmtLegGrp, Instrument, PegInstructions, SideCrossOrdModGrp,
    SpreadOrBenchmarkCurveData, Stipulations, Trailer, TrdgSesGrp, UndInstrmtGrp, YieldData,
};
use super::super::enums::{
    CancellationRights, CrossPrioritization, CrossType, ExecInst, GTBookingInst, HandlInst,
    MoneyLaunderingStatus, OrdType, PriceType, ProcessCode, SettlType, TargetStrategy, TimeInForce,
};

/// The `NewOrderCross` (35=s) message.
pub struct NewOrderCross(RawMessage);

impl NewOrderCross {
    pub const MSG_TYPE: &[u8] = b"s";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(548), Tag(549), Tag(550), Tag(552), Tag(711), Tag(555), Tag(63), Tag(64),
                Tag(21), Tag(18), Tag(110), Tag(111), Tag(100), Tag(386), Tag(81), Tag(140),
                Tag(114), Tag(60), Tag(232), Tag(40), Tag(423), Tag(44), Tag(99), Tag(15), Tag(376),
                Tag(23), Tag(117), Tag(59), Tag(168), Tag(432), Tag(126), Tag(427), Tag(210),
                Tag(847), Tag(848), Tag(849), Tag(480), Tag(481), Tag(513), Tag(494),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), SideCrossOrdModGrp::known_tags(),
                Instrument::known_tags(), UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(),
                TrdgSesGrp::known_tags(), Stipulations::known_tags(),
                SpreadOrBenchmarkCurveData::known_tags(), YieldData::known_tags(),
                PegInstructions::known_tags(), DiscretionInstructions::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())
    }

    /// The `CrossID` (548) field.
    #[doc(alias = "CrossID")]
    pub fn cross_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(548))
    }

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

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

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

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

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

    /// The `SettlType` (63) field.
    #[doc(alias = "SettlType")]
    pub fn settl_type(&self) -> Result<Option<SettlType<'_>>, 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 `HandlInst` (21) field.
    #[doc(alias = "HandlInst")]
    pub fn handl_inst(&self) -> Result<Option<HandlInst<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(21))?.map(HandlInst::from_value))
    }

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

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

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

    /// The `ExDestination` (100) field.
    #[doc(alias = "ExDestination")]
    pub fn ex_destination(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(100))
    }

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

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

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

    /// The `LocateReqd` (114) field.
    #[doc(alias = "LocateReqd")]
    pub fn locate_reqd(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(114))
    }

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

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

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

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

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

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

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

    /// The `ComplianceID` (376) field.
    #[doc(alias = "ComplianceID")]
    pub fn compliance_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(376))
    }

    /// The `IOIID` (23) field.
    #[doc(alias = "IOIID")]
    pub fn ioiid(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(23))
    }

    /// The `QuoteID` (117) field.
    #[doc(alias = "QuoteID")]
    pub fn quote_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(117))
    }

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

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

    /// 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 `GTBookingInst` (427) field.
    #[doc(alias = "GTBookingInst")]
    pub fn gt_booking_inst(&self) -> Result<Option<GTBookingInst>, InvalidValue> {
        Ok(self.0.get_int(Tag(427))?.map(GTBookingInst::from_value))
    }

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

    /// The `PegInstructions` component.
    pub fn peg_instructions(&self) -> PegInstructions<'_> {
        PegInstructions(self.0.scope())
    }

    /// The `DiscretionInstructions` component.
    pub fn discretion_instructions(&self) -> DiscretionInstructions<'_> {
        DiscretionInstructions(self.0.scope())
    }

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

    /// The `TargetStrategyParameters` (848) field.
    #[doc(alias = "TargetStrategyParameters")]
    pub fn target_strategy_parameters(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(848))
    }

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

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

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

    /// The `RegistID` (513) field.
    #[doc(alias = "RegistID")]
    pub fn regist_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(513))
    }

    /// The `Designation` (494) field.
    #[doc(alias = "Designation")]
    pub fn designation(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(494))
    }
}

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

impl std::fmt::Display for NewOrderCross {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(&self.0, f)
    }
}