Skip to main content

refix_fix44/generated/messages/
allocation_instruction.rs

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