1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{
5 Date, Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp,
6};
7
8use super::super::components::{
9 FinancingDetails, Header, Instrument, LegQuotGrp, OrderQtyData, Parties, QuotQualGrp,
10 SpreadOrBenchmarkCurveData, Stipulations, Trailer, UndInstrmtGrp, YieldData,
11};
12use super::super::enums::{
13 AccountType, AcctIDSource, CommType, CustOrderCapacity, OrdType, OrderCapacity, PriceType,
14 QuoteRespType, QuoteType, SettlCurrFxRateCalc, SettlType, Side,
15};
16
17pub struct QuoteResponse(RawMessage);
19
20impl QuoteResponse {
21 pub const MSG_TYPE: &[u8] = b"AJ";
22
23 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
24 static TAGS: LazyKnownTags = LazyKnownTags::new(
25 &[
26 Tag(693), Tag(117), Tag(694), Tag(11), Tag(528), Tag(23), Tag(537), Tag(735),
27 Tag(453), Tag(336), Tag(625), Tag(711), Tag(54), Tag(63), Tag(64), Tag(193),
28 Tag(192), Tag(15), Tag(232), Tag(1), Tag(660), Tag(581), Tag(555), Tag(132),
29 Tag(133), Tag(645), Tag(646), Tag(647), Tag(134), Tag(648), Tag(135), Tag(62),
30 Tag(188), Tag(190), Tag(189), Tag(191), Tag(631), Tag(632), Tag(633), Tag(634),
31 Tag(60), Tag(40), Tag(642), Tag(643), Tag(656), Tag(657), Tag(156), Tag(12),
32 Tag(13), Tag(582), Tag(100), Tag(58), Tag(354), Tag(355), Tag(44), Tag(423),
33 ],
34 &[
35 Header::known_tags(), Trailer::known_tags(), QuotQualGrp::known_tags(),
36 Parties::known_tags(), Instrument::known_tags(), FinancingDetails::known_tags(),
37 UndInstrmtGrp::known_tags(), OrderQtyData::known_tags(), Stipulations::known_tags(),
38 LegQuotGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
39 YieldData::known_tags(),
40 ],
41 );
42 &TAGS
43 }
44
45 pub fn from_raw(raw: RawMessage) -> Self {
46 Self(raw)
47 }
48
49 pub fn raw(&self) -> &RawMessage {
50 &self.0
51 }
52
53 pub fn header(&self) -> Header<'_> {
54 Header(self.0.scope(), Self::known_tags().get())
55 }
56
57 pub fn trailer(&self) -> Trailer<'_> {
58 Trailer(self.0.scope())
59 }
60
61 #[doc(alias = "QuoteRespID")]
63 pub fn quote_resp_id(&self) -> Result<Option<&str>, InvalidValue> {
64 self.0.get_str(Tag(693))
65 }
66
67 #[doc(alias = "QuoteID")]
69 pub fn quote_id(&self) -> Result<Option<&str>, InvalidValue> {
70 self.0.get_str(Tag(117))
71 }
72
73 #[doc(alias = "QuoteRespType")]
75 pub fn quote_resp_type(&self) -> Result<Option<QuoteRespType>, InvalidValue> {
76 Ok(self.0.get_int(Tag(694))?.map(QuoteRespType::from_value))
77 }
78
79 #[doc(alias = "ClOrdID")]
81 pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
82 self.0.get_str(Tag(11))
83 }
84
85 #[doc(alias = "OrderCapacity")]
87 pub fn order_capacity(&self) -> Result<Option<OrderCapacity<'_>>, InvalidValue> {
88 Ok(self.0.get_str(Tag(528))?.map(OrderCapacity::from_value))
89 }
90
91 #[doc(alias = "IOIID")]
93 pub fn ioiid(&self) -> Result<Option<&str>, InvalidValue> {
94 self.0.get_str(Tag(23))
95 }
96
97 #[doc(alias = "QuoteType")]
99 pub fn quote_type(&self) -> Result<Option<QuoteType>, InvalidValue> {
100 Ok(self.0.get_int(Tag(537))?.map(QuoteType::from_value))
101 }
102
103 #[doc(alias = "NoQuoteQualifiers")]
105 pub fn quote_qualifiers(&self) -> Result<Instances<'_, QuotQualGrp<'_>>, InvalidValue> {
106 self.0.get_group(&QuotQualGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
107 }
108
109 #[doc(alias = "NoPartyIDs")]
111 pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
112 self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
113 }
114
115 #[doc(alias = "TradingSessionID")]
117 pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
118 self.0.get_str(Tag(336))
119 }
120
121 #[doc(alias = "TradingSessionSubID")]
123 pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
124 self.0.get_str(Tag(625))
125 }
126
127 pub fn instrument(&self) -> Instrument<'_> {
129 Instrument(self.0.scope(), Self::known_tags().get())
130 }
131
132 pub fn financing_details(&self) -> FinancingDetails<'_> {
134 FinancingDetails(self.0.scope())
135 }
136
137 #[doc(alias = "NoUnderlyings")]
139 pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
140 self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
141 }
142
143 #[doc(alias = "Side")]
145 pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
146 Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
147 }
148
149 pub fn order_qty_data(&self) -> OrderQtyData<'_> {
151 OrderQtyData(self.0.scope())
152 }
153
154 #[doc(alias = "SettlType")]
156 pub fn settl_type(&self) -> Result<Option<SettlType<'_>>, InvalidValue> {
157 Ok(self.0.get_str(Tag(63))?.map(SettlType::from_value))
158 }
159
160 #[doc(alias = "SettlDate")]
162 pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
163 self.0.get_date(Tag(64))
164 }
165
166 #[doc(alias = "SettlDate2")]
168 pub fn settl_date2(&self) -> Result<Option<Date>, InvalidValue> {
169 self.0.get_date(Tag(193))
170 }
171
172 #[doc(alias = "OrderQty2")]
174 pub fn order_qty2(&self) -> Result<Option<Decimal>, InvalidValue> {
175 self.0.get_decimal(Tag(192))
176 }
177
178 #[doc(alias = "Currency")]
180 pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
181 self.0.get_str(Tag(15))
182 }
183
184 #[doc(alias = "NoStipulations")]
186 pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
187 self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
188 }
189
190 #[doc(alias = "Account")]
192 pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
193 self.0.get_str(Tag(1))
194 }
195
196 #[doc(alias = "AcctIDSource")]
198 pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
199 Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
200 }
201
202 #[doc(alias = "AccountType")]
204 pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
205 Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
206 }
207
208 #[doc(alias = "NoLegs")]
210 pub fn legs(&self) -> Result<Instances<'_, LegQuotGrp<'_>>, InvalidValue> {
211 self.0.get_group(&LegQuotGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
212 }
213
214 #[doc(alias = "BidPx")]
216 pub fn bid_px(&self) -> Result<Option<Decimal>, InvalidValue> {
217 self.0.get_decimal(Tag(132))
218 }
219
220 #[doc(alias = "OfferPx")]
222 pub fn offer_px(&self) -> Result<Option<Decimal>, InvalidValue> {
223 self.0.get_decimal(Tag(133))
224 }
225
226 #[doc(alias = "MktBidPx")]
228 pub fn mkt_bid_px(&self) -> Result<Option<Decimal>, InvalidValue> {
229 self.0.get_decimal(Tag(645))
230 }
231
232 #[doc(alias = "MktOfferPx")]
234 pub fn mkt_offer_px(&self) -> Result<Option<Decimal>, InvalidValue> {
235 self.0.get_decimal(Tag(646))
236 }
237
238 #[doc(alias = "MinBidSize")]
240 pub fn min_bid_size(&self) -> Result<Option<Decimal>, InvalidValue> {
241 self.0.get_decimal(Tag(647))
242 }
243
244 #[doc(alias = "BidSize")]
246 pub fn bid_size(&self) -> Result<Option<Decimal>, InvalidValue> {
247 self.0.get_decimal(Tag(134))
248 }
249
250 #[doc(alias = "MinOfferSize")]
252 pub fn min_offer_size(&self) -> Result<Option<Decimal>, InvalidValue> {
253 self.0.get_decimal(Tag(648))
254 }
255
256 #[doc(alias = "OfferSize")]
258 pub fn offer_size(&self) -> Result<Option<Decimal>, InvalidValue> {
259 self.0.get_decimal(Tag(135))
260 }
261
262 #[doc(alias = "ValidUntilTime")]
264 pub fn valid_until_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
265 self.0.get_utc_timestamp(Tag(62))
266 }
267
268 #[doc(alias = "BidSpotRate")]
270 pub fn bid_spot_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
271 self.0.get_decimal(Tag(188))
272 }
273
274 #[doc(alias = "OfferSpotRate")]
276 pub fn offer_spot_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
277 self.0.get_decimal(Tag(190))
278 }
279
280 #[doc(alias = "BidForwardPoints")]
282 pub fn bid_forward_points(&self) -> Result<Option<Decimal>, InvalidValue> {
283 self.0.get_decimal(Tag(189))
284 }
285
286 #[doc(alias = "OfferForwardPoints")]
288 pub fn offer_forward_points(&self) -> Result<Option<Decimal>, InvalidValue> {
289 self.0.get_decimal(Tag(191))
290 }
291
292 #[doc(alias = "MidPx")]
294 pub fn mid_px(&self) -> Result<Option<Decimal>, InvalidValue> {
295 self.0.get_decimal(Tag(631))
296 }
297
298 #[doc(alias = "BidYield")]
300 pub fn bid_yield(&self) -> Result<Option<Decimal>, InvalidValue> {
301 self.0.get_decimal(Tag(632))
302 }
303
304 #[doc(alias = "MidYield")]
306 pub fn mid_yield(&self) -> Result<Option<Decimal>, InvalidValue> {
307 self.0.get_decimal(Tag(633))
308 }
309
310 #[doc(alias = "OfferYield")]
312 pub fn offer_yield(&self) -> Result<Option<Decimal>, InvalidValue> {
313 self.0.get_decimal(Tag(634))
314 }
315
316 #[doc(alias = "TransactTime")]
318 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
319 self.0.get_utc_timestamp(Tag(60))
320 }
321
322 #[doc(alias = "OrdType")]
324 pub fn ord_type(&self) -> Result<Option<OrdType<'_>>, InvalidValue> {
325 Ok(self.0.get_str(Tag(40))?.map(OrdType::from_value))
326 }
327
328 #[doc(alias = "BidForwardPoints2")]
330 pub fn bid_forward_points2(&self) -> Result<Option<Decimal>, InvalidValue> {
331 self.0.get_decimal(Tag(642))
332 }
333
334 #[doc(alias = "OfferForwardPoints2")]
336 pub fn offer_forward_points2(&self) -> Result<Option<Decimal>, InvalidValue> {
337 self.0.get_decimal(Tag(643))
338 }
339
340 #[doc(alias = "SettlCurrBidFxRate")]
342 pub fn settl_curr_bid_fx_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
343 self.0.get_decimal(Tag(656))
344 }
345
346 #[doc(alias = "SettlCurrOfferFxRate")]
348 pub fn settl_curr_offer_fx_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
349 self.0.get_decimal(Tag(657))
350 }
351
352 #[doc(alias = "SettlCurrFxRateCalc")]
354 pub fn settl_curr_fx_rate_calc(&self) -> Result<Option<SettlCurrFxRateCalc<'_>>, InvalidValue> {
355 Ok(self.0.get_str(Tag(156))?.map(SettlCurrFxRateCalc::from_value))
356 }
357
358 #[doc(alias = "Commission")]
360 pub fn commission(&self) -> Result<Option<Decimal>, InvalidValue> {
361 self.0.get_decimal(Tag(12))
362 }
363
364 #[doc(alias = "CommType")]
366 pub fn comm_type(&self) -> Result<Option<CommType<'_>>, InvalidValue> {
367 Ok(self.0.get_str(Tag(13))?.map(CommType::from_value))
368 }
369
370 #[doc(alias = "CustOrderCapacity")]
372 pub fn cust_order_capacity(&self) -> Result<Option<CustOrderCapacity>, InvalidValue> {
373 Ok(self.0.get_int(Tag(582))?.map(CustOrderCapacity::from_value))
374 }
375
376 #[doc(alias = "ExDestination")]
378 pub fn ex_destination(&self) -> Result<Option<&str>, InvalidValue> {
379 self.0.get_str(Tag(100))
380 }
381
382 #[doc(alias = "Text")]
384 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
385 self.0.get_str(Tag(58))
386 }
387
388 #[doc(alias = "EncodedTextLen")]
390 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
391 self.0.get_int(Tag(354))
392 }
393
394 #[doc(alias = "EncodedText")]
396 pub fn encoded_text(&self) -> Option<&[u8]> {
397 self.0.get(Tag(355))
398 }
399
400 #[doc(alias = "Price")]
402 pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
403 self.0.get_decimal(Tag(44))
404 }
405
406 #[doc(alias = "PriceType")]
408 pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
409 Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
410 }
411
412 pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
414 SpreadOrBenchmarkCurveData(self.0.scope())
415 }
416
417 pub fn yield_data(&self) -> YieldData<'_> {
419 YieldData(self.0.scope())
420 }
421}
422
423impl std::fmt::Debug for QuoteResponse {
424 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
425 write!(f, "QuoteResponse({})", self.0)
426 }
427}
428
429impl std::fmt::Display for QuoteResponse {
430 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
431 std::fmt::Display::fmt(&self.0, f)
432 }
433}