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 AllocGrp, ExecAllocGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument,
10 InstrumentExtension, OrdAllocGrp, Parties, SpreadOrBenchmarkCurveData, Stipulations, Trailer,
11 UndInstrmtGrp, YieldData,
12};
13use super::super::enums::{
14 AllocCancReplaceReason, AllocIntermedReqType, AllocLinkType, AllocNoOrdersType, AllocRejCode,
15 AllocReportType, AllocStatus, AllocTransType, BookingType, MatchType, PositionEffect, PriceType,
16 QtyType, SettlType, Side,
17};
18
19pub struct AllocationReport(RawMessage);
21
22impl AllocationReport {
23 pub const MSG_TYPE: &[u8] = b"AS";
24
25 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
26 static TAGS: LazyKnownTags = LazyKnownTags::new(
27 &[
28 Tag(755), Tag(70), Tag(71), Tag(795), Tag(796), Tag(793), Tag(794), Tag(87),
29 Tag(88), Tag(72), Tag(808), Tag(196), Tag(197), Tag(466), Tag(857), Tag(73),
30 Tag(124), Tag(570), Tag(700), Tag(574), Tag(54), Tag(711), Tag(555), Tag(53),
31 Tag(854), Tag(30), Tag(229), Tag(336), Tag(625), Tag(423), Tag(6), Tag(860),
32 Tag(15), Tag(74), Tag(453), Tag(75), Tag(60), Tag(63), Tag(64), Tag(775), Tag(381),
33 Tag(238), Tag(237), Tag(118), Tag(77), Tag(754), Tag(58), Tag(354), Tag(355),
34 Tag(157), Tag(158), Tag(159), Tag(540), Tag(738), Tag(920), Tag(921), Tag(922),
35 Tag(650), Tag(232), Tag(892), Tag(893), Tag(78),
36 ],
37 &[
38 Header::known_tags(), Trailer::known_tags(), OrdAllocGrp::known_tags(),
39 ExecAllocGrp::known_tags(), Instrument::known_tags(),
40 InstrumentExtension::known_tags(), FinancingDetails::known_tags(),
41 UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(),
42 SpreadOrBenchmarkCurveData::known_tags(), Parties::known_tags(),
43 Stipulations::known_tags(), YieldData::known_tags(), AllocGrp::known_tags(),
44 ],
45 );
46 &TAGS
47 }
48
49 pub fn from_raw(raw: RawMessage) -> Self {
50 Self(raw)
51 }
52
53 pub fn raw(&self) -> &RawMessage {
54 &self.0
55 }
56
57 pub fn header(&self) -> Header<'_> {
58 Header(self.0.scope(), Self::known_tags().get())
59 }
60
61 pub fn trailer(&self) -> Trailer<'_> {
62 Trailer(self.0.scope())
63 }
64
65 #[doc(alias = "AllocReportID")]
67 pub fn alloc_report_id(&self) -> Result<Option<&str>, InvalidValue> {
68 self.0.get_str(Tag(755))
69 }
70
71 #[doc(alias = "AllocID")]
73 pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
74 self.0.get_str(Tag(70))
75 }
76
77 #[doc(alias = "AllocTransType")]
79 pub fn alloc_trans_type(&self) -> Result<Option<AllocTransType<'_>>, InvalidValue> {
80 Ok(self.0.get_str(Tag(71))?.map(AllocTransType::from_value))
81 }
82
83 #[doc(alias = "AllocReportRefID")]
85 pub fn alloc_report_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
86 self.0.get_str(Tag(795))
87 }
88
89 #[doc(alias = "AllocCancReplaceReason")]
91 pub fn alloc_canc_replace_reason(&self) -> Result<Option<AllocCancReplaceReason>, InvalidValue> {
92 Ok(self.0.get_int(Tag(796))?.map(AllocCancReplaceReason::from_value))
93 }
94
95 #[doc(alias = "SecondaryAllocID")]
97 pub fn secondary_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
98 self.0.get_str(Tag(793))
99 }
100
101 #[doc(alias = "AllocReportType")]
103 pub fn alloc_report_type(&self) -> Result<Option<AllocReportType>, InvalidValue> {
104 Ok(self.0.get_int(Tag(794))?.map(AllocReportType::from_value))
105 }
106
107 #[doc(alias = "AllocStatus")]
109 pub fn alloc_status(&self) -> Result<Option<AllocStatus>, InvalidValue> {
110 Ok(self.0.get_int(Tag(87))?.map(AllocStatus::from_value))
111 }
112
113 #[doc(alias = "AllocRejCode")]
115 pub fn alloc_rej_code(&self) -> Result<Option<AllocRejCode>, InvalidValue> {
116 Ok(self.0.get_int(Tag(88))?.map(AllocRejCode::from_value))
117 }
118
119 #[doc(alias = "RefAllocID")]
121 pub fn ref_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
122 self.0.get_str(Tag(72))
123 }
124
125 #[doc(alias = "AllocIntermedReqType")]
127 pub fn alloc_intermed_req_type(&self) -> Result<Option<AllocIntermedReqType>, InvalidValue> {
128 Ok(self.0.get_int(Tag(808))?.map(AllocIntermedReqType::from_value))
129 }
130
131 #[doc(alias = "AllocLinkID")]
133 pub fn alloc_link_id(&self) -> Result<Option<&str>, InvalidValue> {
134 self.0.get_str(Tag(196))
135 }
136
137 #[doc(alias = "AllocLinkType")]
139 pub fn alloc_link_type(&self) -> Result<Option<AllocLinkType>, InvalidValue> {
140 Ok(self.0.get_int(Tag(197))?.map(AllocLinkType::from_value))
141 }
142
143 #[doc(alias = "BookingRefID")]
145 pub fn booking_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
146 self.0.get_str(Tag(466))
147 }
148
149 #[doc(alias = "AllocNoOrdersType")]
151 pub fn alloc_no_orders_type(&self) -> Result<Option<AllocNoOrdersType>, InvalidValue> {
152 Ok(self.0.get_int(Tag(857))?.map(AllocNoOrdersType::from_value))
153 }
154
155 #[doc(alias = "NoOrders")]
157 pub fn orders(&self) -> Result<Instances<'_, OrdAllocGrp<'_>>, InvalidValue> {
158 self.0.get_group(&OrdAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
159 }
160
161 #[doc(alias = "NoExecs")]
163 pub fn execs(&self) -> Result<Instances<'_, ExecAllocGrp<'_>>, InvalidValue> {
164 self.0.get_group(&ExecAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
165 }
166
167 #[doc(alias = "PreviouslyReported")]
169 pub fn previously_reported(&self) -> Result<Option<bool>, InvalidValue> {
170 self.0.get_bool(Tag(570))
171 }
172
173 #[doc(alias = "ReversalIndicator")]
175 pub fn reversal_indicator(&self) -> Result<Option<bool>, InvalidValue> {
176 self.0.get_bool(Tag(700))
177 }
178
179 #[doc(alias = "MatchType")]
181 pub fn match_type(&self) -> Result<Option<MatchType<'_>>, InvalidValue> {
182 Ok(self.0.get_str(Tag(574))?.map(MatchType::from_value))
183 }
184
185 #[doc(alias = "Side")]
187 pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
188 Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
189 }
190
191 pub fn instrument(&self) -> Instrument<'_> {
193 Instrument(self.0.scope(), Self::known_tags().get())
194 }
195
196 pub fn instrument_extension(&self) -> InstrumentExtension<'_> {
198 InstrumentExtension(self.0.scope(), Self::known_tags().get())
199 }
200
201 pub fn financing_details(&self) -> FinancingDetails<'_> {
203 FinancingDetails(self.0.scope())
204 }
205
206 #[doc(alias = "NoUnderlyings")]
208 pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
209 self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
210 }
211
212 #[doc(alias = "NoLegs")]
214 pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
215 self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
216 }
217
218 #[doc(alias = "Quantity")]
220 pub fn quantity(&self) -> Result<Option<Decimal>, InvalidValue> {
221 self.0.get_decimal(Tag(53))
222 }
223
224 #[doc(alias = "QtyType")]
226 pub fn qty_type(&self) -> Result<Option<QtyType>, InvalidValue> {
227 Ok(self.0.get_int(Tag(854))?.map(QtyType::from_value))
228 }
229
230 #[doc(alias = "LastMkt")]
232 pub fn last_mkt(&self) -> Result<Option<&str>, InvalidValue> {
233 self.0.get_str(Tag(30))
234 }
235
236 #[doc(alias = "TradeOriginationDate")]
238 pub fn trade_origination_date(&self) -> Result<Option<Date>, InvalidValue> {
239 self.0.get_date(Tag(229))
240 }
241
242 #[doc(alias = "TradingSessionID")]
244 pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
245 self.0.get_str(Tag(336))
246 }
247
248 #[doc(alias = "TradingSessionSubID")]
250 pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
251 self.0.get_str(Tag(625))
252 }
253
254 #[doc(alias = "PriceType")]
256 pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
257 Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
258 }
259
260 #[doc(alias = "AvgPx")]
262 pub fn avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
263 self.0.get_decimal(Tag(6))
264 }
265
266 #[doc(alias = "AvgParPx")]
268 pub fn avg_par_px(&self) -> Result<Option<Decimal>, InvalidValue> {
269 self.0.get_decimal(Tag(860))
270 }
271
272 pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
274 SpreadOrBenchmarkCurveData(self.0.scope())
275 }
276
277 #[doc(alias = "Currency")]
279 pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
280 self.0.get_str(Tag(15))
281 }
282
283 #[doc(alias = "AvgPxPrecision")]
285 pub fn avg_px_precision(&self) -> Result<Option<i64>, InvalidValue> {
286 self.0.get_int(Tag(74))
287 }
288
289 #[doc(alias = "NoPartyIDs")]
291 pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
292 self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
293 }
294
295 #[doc(alias = "TradeDate")]
297 pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
298 self.0.get_date(Tag(75))
299 }
300
301 #[doc(alias = "TransactTime")]
303 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
304 self.0.get_utc_timestamp(Tag(60))
305 }
306
307 #[doc(alias = "SettlType")]
309 pub fn settl_type(&self) -> Result<Option<SettlType<'_>>, InvalidValue> {
310 Ok(self.0.get_str(Tag(63))?.map(SettlType::from_value))
311 }
312
313 #[doc(alias = "SettlDate")]
315 pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
316 self.0.get_date(Tag(64))
317 }
318
319 #[doc(alias = "BookingType")]
321 pub fn booking_type(&self) -> Result<Option<BookingType>, InvalidValue> {
322 Ok(self.0.get_int(Tag(775))?.map(BookingType::from_value))
323 }
324
325 #[doc(alias = "GrossTradeAmt")]
327 pub fn gross_trade_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
328 self.0.get_decimal(Tag(381))
329 }
330
331 #[doc(alias = "Concession")]
333 pub fn concession(&self) -> Result<Option<Decimal>, InvalidValue> {
334 self.0.get_decimal(Tag(238))
335 }
336
337 #[doc(alias = "TotalTakedown")]
339 pub fn total_takedown(&self) -> Result<Option<Decimal>, InvalidValue> {
340 self.0.get_decimal(Tag(237))
341 }
342
343 #[doc(alias = "NetMoney")]
345 pub fn net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
346 self.0.get_decimal(Tag(118))
347 }
348
349 #[doc(alias = "PositionEffect")]
351 pub fn position_effect(&self) -> Result<Option<PositionEffect<'_>>, InvalidValue> {
352 Ok(self.0.get_str(Tag(77))?.map(PositionEffect::from_value))
353 }
354
355 #[doc(alias = "AutoAcceptIndicator")]
357 pub fn auto_accept_indicator(&self) -> Result<Option<bool>, InvalidValue> {
358 self.0.get_bool(Tag(754))
359 }
360
361 #[doc(alias = "Text")]
363 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
364 self.0.get_str(Tag(58))
365 }
366
367 #[doc(alias = "EncodedTextLen")]
369 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
370 self.0.get_int(Tag(354))
371 }
372
373 #[doc(alias = "EncodedText")]
375 pub fn encoded_text(&self) -> Option<&[u8]> {
376 self.0.get(Tag(355))
377 }
378
379 #[doc(alias = "NumDaysInterest")]
381 pub fn num_days_interest(&self) -> Result<Option<i64>, InvalidValue> {
382 self.0.get_int(Tag(157))
383 }
384
385 #[doc(alias = "AccruedInterestRate")]
387 pub fn accrued_interest_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
388 self.0.get_decimal(Tag(158))
389 }
390
391 #[doc(alias = "AccruedInterestAmt")]
393 pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
394 self.0.get_decimal(Tag(159))
395 }
396
397 #[doc(alias = "TotalAccruedInterestAmt")]
399 pub fn total_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
400 self.0.get_decimal(Tag(540))
401 }
402
403 #[doc(alias = "InterestAtMaturity")]
405 pub fn interest_at_maturity(&self) -> Result<Option<Decimal>, InvalidValue> {
406 self.0.get_decimal(Tag(738))
407 }
408
409 #[doc(alias = "EndAccruedInterestAmt")]
411 pub fn end_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
412 self.0.get_decimal(Tag(920))
413 }
414
415 #[doc(alias = "StartCash")]
417 pub fn start_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
418 self.0.get_decimal(Tag(921))
419 }
420
421 #[doc(alias = "EndCash")]
423 pub fn end_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
424 self.0.get_decimal(Tag(922))
425 }
426
427 #[doc(alias = "LegalConfirm")]
429 pub fn legal_confirm(&self) -> Result<Option<bool>, InvalidValue> {
430 self.0.get_bool(Tag(650))
431 }
432
433 #[doc(alias = "NoStipulations")]
435 pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
436 self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
437 }
438
439 pub fn yield_data(&self) -> YieldData<'_> {
441 YieldData(self.0.scope())
442 }
443
444 #[doc(alias = "TotNoAllocs")]
446 pub fn tot_no_allocs(&self) -> Result<Option<i64>, InvalidValue> {
447 self.0.get_int(Tag(892))
448 }
449
450 #[doc(alias = "LastFragment")]
452 pub fn last_fragment(&self) -> Result<Option<bool>, InvalidValue> {
453 self.0.get_bool(Tag(893))
454 }
455
456 #[doc(alias = "NoAllocs")]
458 pub fn allocs(&self) -> Result<Instances<'_, AllocGrp<'_>>, InvalidValue> {
459 self.0.get_group(&AllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
460 }
461}
462
463impl std::fmt::Debug for AllocationReport {
464 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
465 write!(f, "AllocationReport({})", self.0)
466 }
467}
468
469impl std::fmt::Display for AllocationReport {
470 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
471 std::fmt::Display::fmt(&self.0, f)
472 }
473}