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
// @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::{
    FinancingDetails, Header, Instrument, OrderQtyData, PositionAmountData,
    SpreadOrBenchmarkCurveData, Trailer, TrdCapRptSideGrp, TrdInstrmtLegGrp, TrdRegTimestamps,
    UndInstrmtGrp, YieldData,
};
use super::super::enums::{
    AvgPxIndicator, ExecRestatementReason, ExecType, MatchStatus, MatchType, MultiLegReportingType,
    OrdStatus, PriceType, QtyType, SettlType, ShortSaleReason, SubscriptionRequestType,
    TradeReportType, TrdType,
};

/// The `TradeCaptureReport` (35=AE) message.
pub struct TradeCaptureReport(RawMessage);

impl TradeCaptureReport {
    pub const MSG_TYPE: &[u8] = b"AE";

    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
        static TAGS: LazyKnownTags = LazyKnownTags::new(
            &[
                Tag(571), Tag(487), Tag(856), Tag(568), Tag(828), Tag(829), Tag(855), Tag(830),
                Tag(150), Tag(748), Tag(912), Tag(325), Tag(263), Tag(572), Tag(881), Tag(818),
                Tag(820), Tag(880), Tag(17), Tag(39), Tag(527), Tag(378), Tag(570), Tag(423),
                Tag(854), Tag(711), Tag(822), Tag(823), Tag(32), Tag(31), Tag(669), Tag(194),
                Tag(195), Tag(30), Tag(75), Tag(715), Tag(6), Tag(819), Tag(753), Tag(442),
                Tag(824), Tag(555), Tag(60), Tag(768), Tag(63), Tag(64), Tag(573), Tag(574),
                Tag(552), Tag(797), Tag(852), Tag(853),
            ],
            &[
                Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
                FinancingDetails::known_tags(), OrderQtyData::known_tags(), YieldData::known_tags(),
                UndInstrmtGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
                PositionAmountData::known_tags(), TrdInstrmtLegGrp::known_tags(),
                TrdRegTimestamps::known_tags(), TrdCapRptSideGrp::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 `TradeReportID` (571) field.
    #[doc(alias = "TradeReportID")]
    pub fn trade_report_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(571))
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /// 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 `YieldData` component.
    pub fn yield_data(&self) -> YieldData<'_> {
        YieldData(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 `UnderlyingTradingSessionID` (822) field.
    #[doc(alias = "UnderlyingTradingSessionID")]
    pub fn underlying_trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
        self.0.get_str(Tag(822))
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /// 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 `MatchStatus` (573) field.
    #[doc(alias = "MatchStatus")]
    pub fn match_status(&self) -> Result<Option<MatchStatus<'_>>, InvalidValue> {
        Ok(self.0.get_str(Tag(573))?.map(MatchStatus::from_value))
    }

    /// 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 instances of the `NoSides` (552) group.
    #[doc(alias = "NoSides")]
    pub fn sides(&self) -> Result<Instances<'_, TrdCapRptSideGrp<'_>>, InvalidValue> {
        self.0.get_group(&TrdCapRptSideGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
    }

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

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

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

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

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