Skip to main content

refix_fix42/generated/messages/
quote_request.rs

1// @generated by refix codegen from FIX42.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{
5    Date, Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, MonthYear, RawMessage, Tag,
6    UtcTimestamp,
7};
8
9use super::super::components::{Header, Trailer};
10use super::super::enums::{IDSource, OrdType, PutOrCall, QuoteRequestType, SecurityType, Side};
11
12/// The `QuoteRequest` (35=R) message.
13pub struct QuoteRequest(RawMessage);
14
15impl QuoteRequest {
16    pub const MSG_TYPE: &[u8] = b"R";
17
18    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
19        static TAGS: LazyKnownTags = LazyKnownTags::new(
20            &[Tag(131), Tag(146)],
21            &[Header::known_tags(), Trailer::known_tags(), QuoteRequestRelatedSym::known_tags()],
22        );
23        &TAGS
24    }
25
26    pub fn from_raw(raw: RawMessage) -> Self {
27        Self(raw)
28    }
29
30    pub fn raw(&self) -> &RawMessage {
31        &self.0
32    }
33
34    pub fn header(&self) -> Header<'_> {
35        Header(self.0.scope())
36    }
37
38    pub fn trailer(&self) -> Trailer<'_> {
39        Trailer(self.0.scope())
40    }
41
42    /// The `QuoteReqID` (131) field.
43    #[doc(alias = "QuoteReqID")]
44    pub fn quote_req_id(&self) -> Result<Option<&str>, InvalidValue> {
45        self.0.get_str(Tag(131))
46    }
47
48    /// The instances of the `NoRelatedSym` (146) group.
49    #[doc(alias = "NoRelatedSym")]
50    pub fn related_sym(&self) -> Result<Instances<'_, QuoteRequestRelatedSym<'_>>, InvalidValue> {
51        self.0.get_group(&QuoteRequestRelatedSym::TABLE, &Self::known_tags().get()).map(Instances::from)
52    }
53}
54
55impl std::fmt::Debug for QuoteRequest {
56    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
57        write!(f, "QuoteRequest({})", self.0)
58    }
59}
60
61impl std::fmt::Display for QuoteRequest {
62    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
63        std::fmt::Display::fmt(&self.0, f)
64    }
65}
66
67/// An instance of the `NoRelatedSym` (146) group.
68#[derive(Clone, Copy)]
69pub struct QuoteRequestRelatedSym<'a>(refix_message::Scope<'a>);
70
71impl<'a> From<refix_message::Scope<'a>> for QuoteRequestRelatedSym<'a> {
72    fn from(scope: refix_message::Scope<'a>) -> Self {
73        Self(scope)
74    }
75}
76
77impl<'a> QuoteRequestRelatedSym<'a> {
78    pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
79        Tag(146),
80        Tag(55),
81        &[
82            Tag(15), Tag(22), Tag(38), Tag(40), Tag(48), Tag(54), Tag(55), Tag(60), Tag(64),
83            Tag(65), Tag(106), Tag(107), Tag(126), Tag(140), Tag(167), Tag(192), Tag(193), Tag(200),
84            Tag(201), Tag(202), Tag(205), Tag(206), Tag(207), Tag(223), Tag(231), Tag(303),
85            Tag(336), Tag(348), Tag(349), Tag(350), Tag(351),
86        ],
87        &[],
88    );
89
90    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
91        static TAGS: LazyKnownTags = LazyKnownTags::new(
92            &[
93                Tag(55), Tag(65), Tag(48), Tag(22), Tag(167), Tag(200), Tag(205), Tag(201),
94                Tag(202), Tag(206), Tag(231), Tag(223), Tag(207), Tag(106), Tag(348), Tag(349),
95                Tag(107), Tag(350), Tag(351), Tag(140), Tag(303), Tag(336), Tag(54), Tag(38),
96                Tag(64), Tag(40), Tag(193), Tag(192), Tag(126), Tag(60), Tag(15),
97            ],
98            &[],
99        );
100        &TAGS
101    }
102
103    pub fn raw(&self) -> refix_message::Scope<'a> {
104        self.0
105    }
106
107    /// The `Symbol` (55) field.
108    #[doc(alias = "Symbol")]
109    pub fn symbol(&self) -> Result<Option<&'a str>, InvalidValue> {
110        self.0.get_str(Tag(55))
111    }
112
113    /// The `SymbolSfx` (65) field.
114    #[doc(alias = "SymbolSfx")]
115    pub fn symbol_sfx(&self) -> Result<Option<&'a str>, InvalidValue> {
116        self.0.get_str(Tag(65))
117    }
118
119    /// The `SecurityID` (48) field.
120    #[doc(alias = "SecurityID")]
121    pub fn security_id(&self) -> Result<Option<&'a str>, InvalidValue> {
122        self.0.get_str(Tag(48))
123    }
124
125    /// The `IDSource` (22) field.
126    #[doc(alias = "IDSource")]
127    pub fn id_source(&self) -> Result<Option<IDSource<'a>>, InvalidValue> {
128        Ok(self.0.get_str(Tag(22))?.map(IDSource::from_value))
129    }
130
131    /// The `SecurityType` (167) field.
132    #[doc(alias = "SecurityType")]
133    pub fn security_type(&self) -> Result<Option<SecurityType<'a>>, InvalidValue> {
134        Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
135    }
136
137    /// The `MaturityMonthYear` (200) field.
138    #[doc(alias = "MaturityMonthYear")]
139    pub fn maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
140        self.0.get_month_year(Tag(200))
141    }
142
143    /// The `MaturityDay` (205) field.
144    #[doc(alias = "MaturityDay")]
145    pub fn maturity_day(&self) -> Result<Option<i64>, InvalidValue> {
146        self.0.get_int(Tag(205))
147    }
148
149    /// The `PutOrCall` (201) field.
150    #[doc(alias = "PutOrCall")]
151    pub fn put_or_call(&self) -> Result<Option<PutOrCall>, InvalidValue> {
152        Ok(self.0.get_int(Tag(201))?.map(PutOrCall::from_value))
153    }
154
155    /// The `StrikePrice` (202) field.
156    #[doc(alias = "StrikePrice")]
157    pub fn strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
158        self.0.get_decimal(Tag(202))
159    }
160
161    /// The `OptAttribute` (206) field.
162    #[doc(alias = "OptAttribute")]
163    pub fn opt_attribute(&self) -> Result<Option<&'a str>, InvalidValue> {
164        self.0.get_str(Tag(206))
165    }
166
167    /// The `ContractMultiplier` (231) field.
168    #[doc(alias = "ContractMultiplier")]
169    pub fn contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
170        self.0.get_decimal(Tag(231))
171    }
172
173    /// The `CouponRate` (223) field.
174    #[doc(alias = "CouponRate")]
175    pub fn coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
176        self.0.get_decimal(Tag(223))
177    }
178
179    /// The `SecurityExchange` (207) field.
180    #[doc(alias = "SecurityExchange")]
181    pub fn security_exchange(&self) -> Result<Option<&'a str>, InvalidValue> {
182        self.0.get_str(Tag(207))
183    }
184
185    /// The `Issuer` (106) field.
186    #[doc(alias = "Issuer")]
187    pub fn issuer(&self) -> Result<Option<&'a str>, InvalidValue> {
188        self.0.get_str(Tag(106))
189    }
190
191    /// The `EncodedIssuerLen` (348) field.
192    #[doc(alias = "EncodedIssuerLen")]
193    pub fn encoded_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
194        self.0.get_int(Tag(348))
195    }
196
197    /// The `EncodedIssuer` (349) field.
198    #[doc(alias = "EncodedIssuer")]
199    pub fn encoded_issuer(&self) -> Option<&'a [u8]> {
200        self.0.get(Tag(349))
201    }
202
203    /// The `SecurityDesc` (107) field.
204    #[doc(alias = "SecurityDesc")]
205    pub fn security_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
206        self.0.get_str(Tag(107))
207    }
208
209    /// The `EncodedSecurityDescLen` (350) field.
210    #[doc(alias = "EncodedSecurityDescLen")]
211    pub fn encoded_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
212        self.0.get_int(Tag(350))
213    }
214
215    /// The `EncodedSecurityDesc` (351) field.
216    #[doc(alias = "EncodedSecurityDesc")]
217    pub fn encoded_security_desc(&self) -> Option<&'a [u8]> {
218        self.0.get(Tag(351))
219    }
220
221    /// The `PrevClosePx` (140) field.
222    #[doc(alias = "PrevClosePx")]
223    pub fn prev_close_px(&self) -> Result<Option<Decimal>, InvalidValue> {
224        self.0.get_decimal(Tag(140))
225    }
226
227    /// The `QuoteRequestType` (303) field.
228    #[doc(alias = "QuoteRequestType")]
229    pub fn quote_request_type(&self) -> Result<Option<QuoteRequestType>, InvalidValue> {
230        Ok(self.0.get_int(Tag(303))?.map(QuoteRequestType::from_value))
231    }
232
233    /// The `TradingSessionID` (336) field.
234    #[doc(alias = "TradingSessionID")]
235    pub fn trading_session_id(&self) -> Result<Option<&'a str>, InvalidValue> {
236        self.0.get_str(Tag(336))
237    }
238
239    /// The `Side` (54) field.
240    #[doc(alias = "Side")]
241    pub fn side(&self) -> Result<Option<Side<'a>>, InvalidValue> {
242        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
243    }
244
245    /// The `OrderQty` (38) field.
246    #[doc(alias = "OrderQty")]
247    pub fn order_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
248        self.0.get_decimal(Tag(38))
249    }
250
251    /// The `FutSettDate` (64) field.
252    #[doc(alias = "FutSettDate")]
253    pub fn fut_sett_date(&self) -> Result<Option<Date>, InvalidValue> {
254        self.0.get_date(Tag(64))
255    }
256
257    /// The `OrdType` (40) field.
258    #[doc(alias = "OrdType")]
259    pub fn ord_type(&self) -> Result<Option<OrdType<'a>>, InvalidValue> {
260        Ok(self.0.get_str(Tag(40))?.map(OrdType::from_value))
261    }
262
263    /// The `FutSettDate2` (193) field.
264    #[doc(alias = "FutSettDate2")]
265    pub fn fut_sett_date2(&self) -> Result<Option<Date>, InvalidValue> {
266        self.0.get_date(Tag(193))
267    }
268
269    /// The `OrderQty2` (192) field.
270    #[doc(alias = "OrderQty2")]
271    pub fn order_qty2(&self) -> Result<Option<Decimal>, InvalidValue> {
272        self.0.get_decimal(Tag(192))
273    }
274
275    /// The `ExpireTime` (126) field.
276    #[doc(alias = "ExpireTime")]
277    pub fn expire_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
278        self.0.get_utc_timestamp(Tag(126))
279    }
280
281    /// The `TransactTime` (60) field.
282    #[doc(alias = "TransactTime")]
283    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
284        self.0.get_utc_timestamp(Tag(60))
285    }
286
287    /// The `Currency` (15) field.
288    #[doc(alias = "Currency")]
289    pub fn currency(&self) -> Result<Option<&'a str>, InvalidValue> {
290        self.0.get_str(Tag(15))
291    }
292}
293
294impl std::fmt::Debug for QuoteRequestRelatedSym<'_> {
295    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
296        write!(f, "QuoteRequestRelatedSym({})", self.0)
297    }
298}