refix-fix44 0.12.0

Typed FIX 4.4 protocol messages for the ReFIX engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
// @generated by refix codegen from FIX44.xml. Do not edit.
#![cfg_attr(rustfmt, rustfmt::skip)]

use refix_message::{
    Date, Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp,
};

use super::super::components::{
    AllocGrp, ExecAllocGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument,
    InstrumentExtension, OrdAllocGrp, Parties, SpreadOrBenchmarkCurveData, Stipulations, Trailer,
    UndInstrmtGrp, YieldData,
};
use super::super::enums::{
    AllocCancReplaceReason, AllocIntermedReqType, AllocLinkType, AllocNoOrdersType, AllocTransType,
    AllocType, BookingType, MatchType, PositionEffect, PriceType, QtyType, SettlType, Side,
};

/// The `AllocationInstruction` (35=J) message.
pub struct AllocationInstruction(RawMessage);

impl AllocationInstruction {
    pub const MSG_TYPE: &[u8] = b"J";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(70), Tag(71), Tag(626), Tag(793), Tag(72), Tag(796), Tag(808), Tag(196),
                Tag(197), Tag(466), Tag(857), Tag(73), Tag(124), Tag(570), Tag(700), Tag(574),
                Tag(54), Tag(711), Tag(555), Tag(53), Tag(854), Tag(30), Tag(229), Tag(336),
                Tag(625), Tag(423), Tag(6), Tag(860), Tag(15), Tag(74), Tag(453), Tag(75), Tag(60),
                Tag(63), Tag(64), Tag(775), Tag(381), Tag(238), Tag(237), Tag(118), Tag(77),
                Tag(754), Tag(58), Tag(354), Tag(355), Tag(157), Tag(158), Tag(159), Tag(540),
                Tag(738), Tag(920), Tag(921), Tag(922), Tag(650), Tag(232), Tag(892), Tag(893),
                Tag(78),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), OrdAllocGrp::known_tags(),
                ExecAllocGrp::known_tags(), Instrument::known_tags(),
                InstrumentExtension::known_tags(), FinancingDetails::known_tags(),
                UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(),
                SpreadOrBenchmarkCurveData::known_tags(), Parties::known_tags(),
                Stipulations::known_tags(), YieldData::known_tags(), AllocGrp::known_tags(),
            ],
        );
        &TAGS
    }

    pub fn from_raw(raw: RawMessage) -> Self {
        Self(raw)
    }

    pub fn raw(&self) -> &RawMessage {
        &self.0
    }

    pub fn header(&self) -> Header<'_> {
        Header(self.0.scope(), Self::known_tags().get())
    }

    pub fn trailer(&self) -> Trailer<'_> {
        Trailer(self.0.scope())
    }

    /// The `AllocID` (70) field.
    #[doc(alias = "AllocID")]
    pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(70))
    }

    /// The `AllocTransType` (71) field.
    #[doc(alias = "AllocTransType")]
    pub fn alloc_trans_type(&self) -> Result<Option<AllocTransType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(71))?.map(AllocTransType::from_value))
    }

    /// The `AllocType` (626) field.
    #[doc(alias = "AllocType")]
    pub fn alloc_type(&self) -> Result<Option<AllocType>, InvalidValue> {
        Ok(self.0.get_int(Tag(626))?.map(AllocType::from_value))
    }

    /// The `SecondaryAllocID` (793) field.
    #[doc(alias = "SecondaryAllocID")]
    pub fn secondary_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(793))
    }

    /// The `RefAllocID` (72) field.
    #[doc(alias = "RefAllocID")]
    pub fn ref_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(72))
    }

    /// The `AllocCancReplaceReason` (796) field.
    #[doc(alias = "AllocCancReplaceReason")]
    pub fn alloc_canc_replace_reason(&self) -> Result<Option<AllocCancReplaceReason>, InvalidValue> {
        Ok(self.0.get_int(Tag(796))?.map(AllocCancReplaceReason::from_value))
    }

    /// The `AllocIntermedReqType` (808) field.
    #[doc(alias = "AllocIntermedReqType")]
    pub fn alloc_intermed_req_type(&self) -> Result<Option<AllocIntermedReqType>, InvalidValue> {
        Ok(self.0.get_int(Tag(808))?.map(AllocIntermedReqType::from_value))
    }

    /// The `AllocLinkID` (196) field.
    #[doc(alias = "AllocLinkID")]
    pub fn alloc_link_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(196))
    }

    /// The `AllocLinkType` (197) field.
    #[doc(alias = "AllocLinkType")]
    pub fn alloc_link_type(&self) -> Result<Option<AllocLinkType>, InvalidValue> {
        Ok(self.0.get_int(Tag(197))?.map(AllocLinkType::from_value))
    }

    /// The `BookingRefID` (466) field.
    #[doc(alias = "BookingRefID")]
    pub fn booking_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(466))
    }

    /// The `AllocNoOrdersType` (857) field.
    #[doc(alias = "AllocNoOrdersType")]
    pub fn alloc_no_orders_type(&self) -> Result<Option<AllocNoOrdersType>, InvalidValue> {
        Ok(self.0.get_int(Tag(857))?.map(AllocNoOrdersType::from_value))
    }

    /// The instances of the `NoOrders` (73) group.
    #[doc(alias = "NoOrders")]
    pub fn orders(&self) -> Result<Instances<'_, OrdAllocGrp<'_>>, InvalidValue> {
        self.0.get_group(&OrdAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The instances of the `NoExecs` (124) group.
    #[doc(alias = "NoExecs")]
    pub fn execs(&self) -> Result<Instances<'_, ExecAllocGrp<'_>>, InvalidValue> {
        self.0.get_group(&ExecAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The `PreviouslyReported` (570) field.
    #[doc(alias = "PreviouslyReported")]
    pub fn previously_reported(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(570))
    }

    /// The `ReversalIndicator` (700) field.
    #[doc(alias = "ReversalIndicator")]
    pub fn reversal_indicator(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(700))
    }

    /// The `MatchType` (574) field.
    #[doc(alias = "MatchType")]
    pub fn match_type(&self) -> Result<Option<MatchType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(574))?.map(MatchType::from_value))
    }

    /// The `Side` (54) field.
    #[doc(alias = "Side")]
    pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
    }

    /// The `Instrument` component.
    pub fn instrument(&self) -> Instrument<'_> {
        Instrument(self.0.scope(), Self::known_tags().get())
    }

    /// The `InstrumentExtension` component.
    pub fn instrument_extension(&self) -> InstrumentExtension<'_> {
        InstrumentExtension(self.0.scope(), Self::known_tags().get())
    }

    /// The `FinancingDetails` component.
    pub fn financing_details(&self) -> FinancingDetails<'_> {
        FinancingDetails(self.0.scope())
    }

    /// The instances of the `NoUnderlyings` (711) group.
    #[doc(alias = "NoUnderlyings")]
    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The instances of the `NoLegs` (555) group.
    #[doc(alias = "NoLegs")]
    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The `Quantity` (53) field.
    #[doc(alias = "Quantity")]
    pub fn quantity(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(53))
    }

    /// The `QtyType` (854) field.
    #[doc(alias = "QtyType")]
    pub fn qty_type(&self) -> Result<Option<QtyType>, InvalidValue> {
        Ok(self.0.get_int(Tag(854))?.map(QtyType::from_value))
    }

    /// The `LastMkt` (30) field.
    #[doc(alias = "LastMkt")]
    pub fn last_mkt(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(30))
    }

    /// The `TradeOriginationDate` (229) field.
    #[doc(alias = "TradeOriginationDate")]
    pub fn trade_origination_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(229))
    }

    /// The `TradingSessionID` (336) field.
    #[doc(alias = "TradingSessionID")]
    pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(336))
    }

    /// The `TradingSessionSubID` (625) field.
    #[doc(alias = "TradingSessionSubID")]
    pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(625))
    }

    /// The `PriceType` (423) field.
    #[doc(alias = "PriceType")]
    pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
        Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
    }

    /// The `AvgPx` (6) field.
    #[doc(alias = "AvgPx")]
    pub fn avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(6))
    }

    /// The `AvgParPx` (860) field.
    #[doc(alias = "AvgParPx")]
    pub fn avg_par_px(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(860))
    }

    /// The `SpreadOrBenchmarkCurveData` component.
    pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
        SpreadOrBenchmarkCurveData(self.0.scope())
    }

    /// The `Currency` (15) field.
    #[doc(alias = "Currency")]
    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(15))
    }

    /// The `AvgPxPrecision` (74) field.
    #[doc(alias = "AvgPxPrecision")]
    pub fn avg_px_precision(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(74))
    }

    /// The instances of the `NoPartyIDs` (453) group.
    #[doc(alias = "NoPartyIDs")]
    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The `TradeDate` (75) field.
    #[doc(alias = "TradeDate")]
    pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(75))
    }

    /// The `TransactTime` (60) field.
    #[doc(alias = "TransactTime")]
    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
        self.0.get_utc_timestamp(Tag(60))
    }

    /// The `SettlType` (63) field.
    #[doc(alias = "SettlType")]
    pub fn settl_type(&self) -> Result<Option<SettlType<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(63))?.map(SettlType::from_value))
    }

    /// The `SettlDate` (64) field.
    #[doc(alias = "SettlDate")]
    pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
        self.0.get_date(Tag(64))
    }

    /// The `BookingType` (775) field.
    #[doc(alias = "BookingType")]
    pub fn booking_type(&self) -> Result<Option<BookingType>, InvalidValue> {
        Ok(self.0.get_int(Tag(775))?.map(BookingType::from_value))
    }

    /// The `GrossTradeAmt` (381) field.
    #[doc(alias = "GrossTradeAmt")]
    pub fn gross_trade_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(381))
    }

    /// The `Concession` (238) field.
    #[doc(alias = "Concession")]
    pub fn concession(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(238))
    }

    /// The `TotalTakedown` (237) field.
    #[doc(alias = "TotalTakedown")]
    pub fn total_takedown(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(237))
    }

    /// The `NetMoney` (118) field.
    #[doc(alias = "NetMoney")]
    pub fn net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(118))
    }

    /// The `PositionEffect` (77) field.
    #[doc(alias = "PositionEffect")]
    pub fn position_effect(&self) -> Result<Option<PositionEffect<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(77))?.map(PositionEffect::from_value))
    }

    /// The `AutoAcceptIndicator` (754) field.
    #[doc(alias = "AutoAcceptIndicator")]
    pub fn auto_accept_indicator(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(754))
    }

    /// The `Text` (58) field.
    #[doc(alias = "Text")]
    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(58))
    }

    /// The `EncodedTextLen` (354) field.
    #[doc(alias = "EncodedTextLen")]
    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(354))
    }

    /// The `EncodedText` (355) field.
    #[doc(alias = "EncodedText")]
    pub fn encoded_text(&self) -> Option<&[u8]> {
        self.0.get(Tag(355))
    }

    /// The `NumDaysInterest` (157) field.
    #[doc(alias = "NumDaysInterest")]
    pub fn num_days_interest(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(157))
    }

    /// The `AccruedInterestRate` (158) field.
    #[doc(alias = "AccruedInterestRate")]
    pub fn accrued_interest_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(158))
    }

    /// The `AccruedInterestAmt` (159) field.
    #[doc(alias = "AccruedInterestAmt")]
    pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(159))
    }

    /// The `TotalAccruedInterestAmt` (540) field.
    #[doc(alias = "TotalAccruedInterestAmt")]
    pub fn total_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(540))
    }

    /// The `InterestAtMaturity` (738) field.
    #[doc(alias = "InterestAtMaturity")]
    pub fn interest_at_maturity(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(738))
    }

    /// The `EndAccruedInterestAmt` (920) field.
    #[doc(alias = "EndAccruedInterestAmt")]
    pub fn end_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(920))
    }

    /// The `StartCash` (921) field.
    #[doc(alias = "StartCash")]
    pub fn start_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(921))
    }

    /// The `EndCash` (922) field.
    #[doc(alias = "EndCash")]
    pub fn end_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
        self.0.get_decimal(Tag(922))
    }

    /// The `LegalConfirm` (650) field.
    #[doc(alias = "LegalConfirm")]
    pub fn legal_confirm(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(650))
    }

    /// The instances of the `NoStipulations` (232) group.
    #[doc(alias = "NoStipulations")]
    pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
        self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

    /// The `YieldData` component.
    pub fn yield_data(&self) -> YieldData<'_> {
        YieldData(self.0.scope())
    }

    /// The `TotNoAllocs` (892) field.
    #[doc(alias = "TotNoAllocs")]
    pub fn tot_no_allocs(&self) -> Result<Option<i64>, InvalidValue> {
        self.0.get_int(Tag(892))
    }

    /// The `LastFragment` (893) field.
    #[doc(alias = "LastFragment")]
    pub fn last_fragment(&self) -> Result<Option<bool>, InvalidValue> {
        self.0.get_bool(Tag(893))
    }

    /// The instances of the `NoAllocs` (78) group.
    #[doc(alias = "NoAllocs")]
    pub fn allocs(&self) -> Result<Instances<'_, AllocGrp<'_>>, InvalidValue> {
        self.0.get_group(&AllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }
}

impl std::fmt::Debug for AllocationInstruction {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "AllocationInstruction({})", self.0)
    }
}

impl std::fmt::Display for AllocationInstruction {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        std::fmt::Display::fmt(&self.0, f)
    }
}