Skip to main content

refix_fix44/generated/messages/
mass_quote.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{Header, Parties, QuotSetGrp, Trailer};
7use super::super::enums::{AccountType, AcctIDSource, QuoteResponseLevel, QuoteType};
8
9/// The `MassQuote` (35=i) message.
10pub struct MassQuote(RawMessage);
11
12impl MassQuote {
13    pub const MSG_TYPE: &[u8] = b"i";
14
15    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
16        static TAGS: LazyKnownTags = LazyKnownTags::new(
17            &[
18                Tag(131), Tag(117), Tag(537), Tag(301), Tag(453), Tag(1), Tag(660), Tag(581),
19                Tag(293), Tag(294), Tag(296),
20            ],
21            &[
22                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
23                QuotSetGrp::known_tags(),
24            ],
25        );
26        &TAGS
27    }
28
29    pub fn from_raw(raw: RawMessage) -> Self {
30        Self(raw)
31    }
32
33    pub fn raw(&self) -> &RawMessage {
34        &self.0
35    }
36
37    pub fn header(&self) -> Header<'_> {
38        Header(self.0.scope(), Self::known_tags().get())
39    }
40
41    pub fn trailer(&self) -> Trailer<'_> {
42        Trailer(self.0.scope())
43    }
44
45    /// The `QuoteReqID` (131) field.
46    #[doc(alias = "QuoteReqID")]
47    pub fn quote_req_id(&self) -> Result<Option<&str>, InvalidValue> {
48        self.0.get_str(Tag(131))
49    }
50
51    /// The `QuoteID` (117) field.
52    #[doc(alias = "QuoteID")]
53    pub fn quote_id(&self) -> Result<Option<&str>, InvalidValue> {
54        self.0.get_str(Tag(117))
55    }
56
57    /// The `QuoteType` (537) field.
58    #[doc(alias = "QuoteType")]
59    pub fn quote_type(&self) -> Result<Option<QuoteType>, InvalidValue> {
60        Ok(self.0.get_int(Tag(537))?.map(QuoteType::from_value))
61    }
62
63    /// The `QuoteResponseLevel` (301) field.
64    #[doc(alias = "QuoteResponseLevel")]
65    pub fn quote_response_level(&self) -> Result<Option<QuoteResponseLevel>, InvalidValue> {
66        Ok(self.0.get_int(Tag(301))?.map(QuoteResponseLevel::from_value))
67    }
68
69    /// The instances of the `NoPartyIDs` (453) group.
70    #[doc(alias = "NoPartyIDs")]
71    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
72        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
73    }
74
75    /// The `Account` (1) field.
76    #[doc(alias = "Account")]
77    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
78        self.0.get_str(Tag(1))
79    }
80
81    /// The `AcctIDSource` (660) field.
82    #[doc(alias = "AcctIDSource")]
83    pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
84        Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
85    }
86
87    /// The `AccountType` (581) field.
88    #[doc(alias = "AccountType")]
89    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
90        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
91    }
92
93    /// The `DefBidSize` (293) field.
94    #[doc(alias = "DefBidSize")]
95    pub fn def_bid_size(&self) -> Result<Option<Decimal>, InvalidValue> {
96        self.0.get_decimal(Tag(293))
97    }
98
99    /// The `DefOfferSize` (294) field.
100    #[doc(alias = "DefOfferSize")]
101    pub fn def_offer_size(&self) -> Result<Option<Decimal>, InvalidValue> {
102        self.0.get_decimal(Tag(294))
103    }
104
105    /// The instances of the `NoQuoteSets` (296) group.
106    #[doc(alias = "NoQuoteSets")]
107    pub fn quote_sets(&self) -> Result<Instances<'_, QuotSetGrp<'_>>, InvalidValue> {
108        self.0.get_group(&QuotSetGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
109    }
110}
111
112impl std::fmt::Debug for MassQuote {
113    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
114        write!(f, "MassQuote({})", self.0)
115    }
116}
117
118impl std::fmt::Display for MassQuote {
119    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
120        std::fmt::Display::fmt(&self.0, f)
121    }
122}