Skip to main content

refix_fix44/generated/messages/
new_order_single.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, MultipleValues, RawMessage, Tag,
6    UtcTimestamp,
7};
8
9use super::super::components::{
10    CommissionData, DiscretionInstructions, FinancingDetails, Header, Instrument, OrderQtyData,
11    Parties, PegInstructions, PreAllocGrp, SpreadOrBenchmarkCurveData, Stipulations, Trailer,
12    TrdgSesGrp, UndInstrmtGrp, YieldData,
13};
14use super::super::enums::{
15    AccountType, AcctIDSource, BookingType, BookingUnit, CancellationRights, CashMargin,
16    ClearingFeeIndicator, CoveredOrUncovered, CustOrderCapacity, DayBookingInst, ExecInst,
17    GTBookingInst, HandlInst, MoneyLaunderingStatus, OrdType, OrderCapacity, OrderRestrictions,
18    PositionEffect, PreallocMethod, PriceType, ProcessCode, QtyType, SettlType, Side,
19    TargetStrategy, TimeInForce,
20};
21
22/// The `NewOrderSingle` (35=D) message.
23pub struct NewOrderSingle(RawMessage);
24
25impl NewOrderSingle {
26    pub const MSG_TYPE: &[u8] = b"D";
27
28    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
29        static TAGS: LazyKnownTags = LazyKnownTags::new(
30            &[
31                Tag(11), Tag(526), Tag(583), Tag(453), Tag(229), Tag(75), Tag(1), Tag(660),
32                Tag(581), Tag(589), Tag(590), Tag(591), Tag(70), Tag(78), Tag(63), Tag(64),
33                Tag(544), Tag(635), Tag(21), Tag(18), Tag(110), Tag(111), Tag(100), Tag(386),
34                Tag(81), Tag(711), Tag(140), Tag(54), Tag(114), Tag(60), Tag(232), Tag(854),
35                Tag(40), Tag(423), Tag(44), Tag(99), Tag(15), Tag(376), Tag(377), Tag(23), Tag(117),
36                Tag(59), Tag(168), Tag(432), Tag(126), Tag(427), Tag(528), Tag(529), Tag(582),
37                Tag(121), Tag(120), Tag(775), Tag(58), Tag(354), Tag(355), Tag(193), Tag(192),
38                Tag(640), Tag(77), Tag(203), Tag(210), Tag(847), Tag(848), Tag(849), Tag(480),
39                Tag(481), Tag(513), Tag(494),
40            ],
41            &[
42                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
43                PreAllocGrp::known_tags(), TrdgSesGrp::known_tags(), Instrument::known_tags(),
44                FinancingDetails::known_tags(), UndInstrmtGrp::known_tags(),
45                Stipulations::known_tags(), OrderQtyData::known_tags(),
46                SpreadOrBenchmarkCurveData::known_tags(), YieldData::known_tags(),
47                CommissionData::known_tags(), PegInstructions::known_tags(),
48                DiscretionInstructions::known_tags(),
49            ],
50        );
51        &TAGS
52    }
53
54    pub fn from_raw(raw: RawMessage) -> Self {
55        Self(raw)
56    }
57
58    pub fn raw(&self) -> &RawMessage {
59        &self.0
60    }
61
62    pub fn header(&self) -> Header<'_> {
63        Header(self.0.scope(), Self::known_tags().get())
64    }
65
66    pub fn trailer(&self) -> Trailer<'_> {
67        Trailer(self.0.scope())
68    }
69
70    /// The `ClOrdID` (11) field.
71    #[doc(alias = "ClOrdID")]
72    pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
73        self.0.get_str(Tag(11))
74    }
75
76    /// The `SecondaryClOrdID` (526) field.
77    #[doc(alias = "SecondaryClOrdID")]
78    pub fn secondary_cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
79        self.0.get_str(Tag(526))
80    }
81
82    /// The `ClOrdLinkID` (583) field.
83    #[doc(alias = "ClOrdLinkID")]
84    pub fn cl_ord_link_id(&self) -> Result<Option<&str>, InvalidValue> {
85        self.0.get_str(Tag(583))
86    }
87
88    /// The instances of the `NoPartyIDs` (453) group.
89    #[doc(alias = "NoPartyIDs")]
90    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
91        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
92    }
93
94    /// The `TradeOriginationDate` (229) field.
95    #[doc(alias = "TradeOriginationDate")]
96    pub fn trade_origination_date(&self) -> Result<Option<Date>, InvalidValue> {
97        self.0.get_date(Tag(229))
98    }
99
100    /// The `TradeDate` (75) field.
101    #[doc(alias = "TradeDate")]
102    pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
103        self.0.get_date(Tag(75))
104    }
105
106    /// The `Account` (1) field.
107    #[doc(alias = "Account")]
108    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
109        self.0.get_str(Tag(1))
110    }
111
112    /// The `AcctIDSource` (660) field.
113    #[doc(alias = "AcctIDSource")]
114    pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
115        Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
116    }
117
118    /// The `AccountType` (581) field.
119    #[doc(alias = "AccountType")]
120    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
121        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
122    }
123
124    /// The `DayBookingInst` (589) field.
125    #[doc(alias = "DayBookingInst")]
126    pub fn day_booking_inst(&self) -> Result<Option<DayBookingInst<'_>>, InvalidValue> {
127        Ok(self.0.get_str(Tag(589))?.map(DayBookingInst::from_value))
128    }
129
130    /// The `BookingUnit` (590) field.
131    #[doc(alias = "BookingUnit")]
132    pub fn booking_unit(&self) -> Result<Option<BookingUnit<'_>>, InvalidValue> {
133        Ok(self.0.get_str(Tag(590))?.map(BookingUnit::from_value))
134    }
135
136    /// The `PreallocMethod` (591) field.
137    #[doc(alias = "PreallocMethod")]
138    pub fn prealloc_method(&self) -> Result<Option<PreallocMethod<'_>>, InvalidValue> {
139        Ok(self.0.get_str(Tag(591))?.map(PreallocMethod::from_value))
140    }
141
142    /// The `AllocID` (70) field.
143    #[doc(alias = "AllocID")]
144    pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
145        self.0.get_str(Tag(70))
146    }
147
148    /// The instances of the `NoAllocs` (78) group.
149    #[doc(alias = "NoAllocs")]
150    pub fn allocs(&self) -> Result<Instances<'_, PreAllocGrp<'_>>, InvalidValue> {
151        self.0.get_group(&PreAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
152    }
153
154    /// The `SettlType` (63) field.
155    #[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    /// The `SettlDate` (64) field.
161    #[doc(alias = "SettlDate")]
162    pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
163        self.0.get_date(Tag(64))
164    }
165
166    /// The `CashMargin` (544) field.
167    #[doc(alias = "CashMargin")]
168    pub fn cash_margin(&self) -> Result<Option<CashMargin<'_>>, InvalidValue> {
169        Ok(self.0.get_str(Tag(544))?.map(CashMargin::from_value))
170    }
171
172    /// The `ClearingFeeIndicator` (635) field.
173    #[doc(alias = "ClearingFeeIndicator")]
174    pub fn clearing_fee_indicator(&self) -> Result<Option<ClearingFeeIndicator<'_>>, InvalidValue> {
175        Ok(self.0.get_str(Tag(635))?.map(ClearingFeeIndicator::from_value))
176    }
177
178    /// The `HandlInst` (21) field.
179    #[doc(alias = "HandlInst")]
180    pub fn handl_inst(&self) -> Result<Option<HandlInst<'_>>, InvalidValue> {
181        Ok(self.0.get_str(Tag(21))?.map(HandlInst::from_value))
182    }
183
184    /// The `ExecInst` (18) field.
185    #[doc(alias = "ExecInst")]
186    pub fn exec_inst(&self) -> Result<Option<MultipleValues<'_, ExecInst<'_>>>, InvalidValue> {
187        self.0.get_multiple_values(Tag(18))
188    }
189
190    /// The `MinQty` (110) field.
191    #[doc(alias = "MinQty")]
192    pub fn min_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
193        self.0.get_decimal(Tag(110))
194    }
195
196    /// The `MaxFloor` (111) field.
197    #[doc(alias = "MaxFloor")]
198    pub fn max_floor(&self) -> Result<Option<Decimal>, InvalidValue> {
199        self.0.get_decimal(Tag(111))
200    }
201
202    /// The `ExDestination` (100) field.
203    #[doc(alias = "ExDestination")]
204    pub fn ex_destination(&self) -> Result<Option<&str>, InvalidValue> {
205        self.0.get_str(Tag(100))
206    }
207
208    /// The instances of the `NoTradingSessions` (386) group.
209    #[doc(alias = "NoTradingSessions")]
210    pub fn trading_sessions(&self) -> Result<Instances<'_, TrdgSesGrp<'_>>, InvalidValue> {
211        self.0.get_group(&TrdgSesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
212    }
213
214    /// The `ProcessCode` (81) field.
215    #[doc(alias = "ProcessCode")]
216    pub fn process_code(&self) -> Result<Option<ProcessCode<'_>>, InvalidValue> {
217        Ok(self.0.get_str(Tag(81))?.map(ProcessCode::from_value))
218    }
219
220    /// The `Instrument` component.
221    pub fn instrument(&self) -> Instrument<'_> {
222        Instrument(self.0.scope(), Self::known_tags().get())
223    }
224
225    /// The `FinancingDetails` component.
226    pub fn financing_details(&self) -> FinancingDetails<'_> {
227        FinancingDetails(self.0.scope())
228    }
229
230    /// The instances of the `NoUnderlyings` (711) group.
231    #[doc(alias = "NoUnderlyings")]
232    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
233        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
234    }
235
236    /// The `PrevClosePx` (140) field.
237    #[doc(alias = "PrevClosePx")]
238    pub fn prev_close_px(&self) -> Result<Option<Decimal>, InvalidValue> {
239        self.0.get_decimal(Tag(140))
240    }
241
242    /// The `Side` (54) field.
243    #[doc(alias = "Side")]
244    pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
245        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
246    }
247
248    /// The `LocateReqd` (114) field.
249    #[doc(alias = "LocateReqd")]
250    pub fn locate_reqd(&self) -> Result<Option<bool>, InvalidValue> {
251        self.0.get_bool(Tag(114))
252    }
253
254    /// The `TransactTime` (60) field.
255    #[doc(alias = "TransactTime")]
256    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
257        self.0.get_utc_timestamp(Tag(60))
258    }
259
260    /// The instances of the `NoStipulations` (232) group.
261    #[doc(alias = "NoStipulations")]
262    pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
263        self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
264    }
265
266    /// The `QtyType` (854) field.
267    #[doc(alias = "QtyType")]
268    pub fn qty_type(&self) -> Result<Option<QtyType>, InvalidValue> {
269        Ok(self.0.get_int(Tag(854))?.map(QtyType::from_value))
270    }
271
272    /// The `OrderQtyData` component.
273    pub fn order_qty_data(&self) -> OrderQtyData<'_> {
274        OrderQtyData(self.0.scope())
275    }
276
277    /// The `OrdType` (40) field.
278    #[doc(alias = "OrdType")]
279    pub fn ord_type(&self) -> Result<Option<OrdType<'_>>, InvalidValue> {
280        Ok(self.0.get_str(Tag(40))?.map(OrdType::from_value))
281    }
282
283    /// The `PriceType` (423) field.
284    #[doc(alias = "PriceType")]
285    pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
286        Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
287    }
288
289    /// The `Price` (44) field.
290    #[doc(alias = "Price")]
291    pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
292        self.0.get_decimal(Tag(44))
293    }
294
295    /// The `StopPx` (99) field.
296    #[doc(alias = "StopPx")]
297    pub fn stop_px(&self) -> Result<Option<Decimal>, InvalidValue> {
298        self.0.get_decimal(Tag(99))
299    }
300
301    /// The `SpreadOrBenchmarkCurveData` component.
302    pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
303        SpreadOrBenchmarkCurveData(self.0.scope())
304    }
305
306    /// The `YieldData` component.
307    pub fn yield_data(&self) -> YieldData<'_> {
308        YieldData(self.0.scope())
309    }
310
311    /// The `Currency` (15) field.
312    #[doc(alias = "Currency")]
313    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
314        self.0.get_str(Tag(15))
315    }
316
317    /// The `ComplianceID` (376) field.
318    #[doc(alias = "ComplianceID")]
319    pub fn compliance_id(&self) -> Result<Option<&str>, InvalidValue> {
320        self.0.get_str(Tag(376))
321    }
322
323    /// The `SolicitedFlag` (377) field.
324    #[doc(alias = "SolicitedFlag")]
325    pub fn solicited_flag(&self) -> Result<Option<bool>, InvalidValue> {
326        self.0.get_bool(Tag(377))
327    }
328
329    /// The `IOIID` (23) field.
330    #[doc(alias = "IOIID")]
331    pub fn ioiid(&self) -> Result<Option<&str>, InvalidValue> {
332        self.0.get_str(Tag(23))
333    }
334
335    /// The `QuoteID` (117) field.
336    #[doc(alias = "QuoteID")]
337    pub fn quote_id(&self) -> Result<Option<&str>, InvalidValue> {
338        self.0.get_str(Tag(117))
339    }
340
341    /// The `TimeInForce` (59) field.
342    #[doc(alias = "TimeInForce")]
343    pub fn time_in_force(&self) -> Result<Option<TimeInForce<'_>>, InvalidValue> {
344        Ok(self.0.get_str(Tag(59))?.map(TimeInForce::from_value))
345    }
346
347    /// The `EffectiveTime` (168) field.
348    #[doc(alias = "EffectiveTime")]
349    pub fn effective_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
350        self.0.get_utc_timestamp(Tag(168))
351    }
352
353    /// The `ExpireDate` (432) field.
354    #[doc(alias = "ExpireDate")]
355    pub fn expire_date(&self) -> Result<Option<Date>, InvalidValue> {
356        self.0.get_date(Tag(432))
357    }
358
359    /// The `ExpireTime` (126) field.
360    #[doc(alias = "ExpireTime")]
361    pub fn expire_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
362        self.0.get_utc_timestamp(Tag(126))
363    }
364
365    /// The `GTBookingInst` (427) field.
366    #[doc(alias = "GTBookingInst")]
367    pub fn gt_booking_inst(&self) -> Result<Option<GTBookingInst>, InvalidValue> {
368        Ok(self.0.get_int(Tag(427))?.map(GTBookingInst::from_value))
369    }
370
371    /// The `CommissionData` component.
372    pub fn commission_data(&self) -> CommissionData<'_> {
373        CommissionData(self.0.scope())
374    }
375
376    /// The `OrderCapacity` (528) field.
377    #[doc(alias = "OrderCapacity")]
378    pub fn order_capacity(&self) -> Result<Option<OrderCapacity<'_>>, InvalidValue> {
379        Ok(self.0.get_str(Tag(528))?.map(OrderCapacity::from_value))
380    }
381
382    /// The `OrderRestrictions` (529) field.
383    #[doc(alias = "OrderRestrictions")]
384    pub fn order_restrictions(&self) -> Result<Option<MultipleValues<'_, OrderRestrictions<'_>>>, InvalidValue> {
385        self.0.get_multiple_values(Tag(529))
386    }
387
388    /// The `CustOrderCapacity` (582) field.
389    #[doc(alias = "CustOrderCapacity")]
390    pub fn cust_order_capacity(&self) -> Result<Option<CustOrderCapacity>, InvalidValue> {
391        Ok(self.0.get_int(Tag(582))?.map(CustOrderCapacity::from_value))
392    }
393
394    /// The `ForexReq` (121) field.
395    #[doc(alias = "ForexReq")]
396    pub fn forex_req(&self) -> Result<Option<bool>, InvalidValue> {
397        self.0.get_bool(Tag(121))
398    }
399
400    /// The `SettlCurrency` (120) field.
401    #[doc(alias = "SettlCurrency")]
402    pub fn settl_currency(&self) -> Result<Option<&str>, InvalidValue> {
403        self.0.get_str(Tag(120))
404    }
405
406    /// The `BookingType` (775) field.
407    #[doc(alias = "BookingType")]
408    pub fn booking_type(&self) -> Result<Option<BookingType>, InvalidValue> {
409        Ok(self.0.get_int(Tag(775))?.map(BookingType::from_value))
410    }
411
412    /// The `Text` (58) field.
413    #[doc(alias = "Text")]
414    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
415        self.0.get_str(Tag(58))
416    }
417
418    /// The `EncodedTextLen` (354) field.
419    #[doc(alias = "EncodedTextLen")]
420    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
421        self.0.get_int(Tag(354))
422    }
423
424    /// The `EncodedText` (355) field.
425    #[doc(alias = "EncodedText")]
426    pub fn encoded_text(&self) -> Option<&[u8]> {
427        self.0.get(Tag(355))
428    }
429
430    /// The `SettlDate2` (193) field.
431    #[doc(alias = "SettlDate2")]
432    pub fn settl_date2(&self) -> Result<Option<Date>, InvalidValue> {
433        self.0.get_date(Tag(193))
434    }
435
436    /// The `OrderQty2` (192) field.
437    #[doc(alias = "OrderQty2")]
438    pub fn order_qty2(&self) -> Result<Option<Decimal>, InvalidValue> {
439        self.0.get_decimal(Tag(192))
440    }
441
442    /// The `Price2` (640) field.
443    #[doc(alias = "Price2")]
444    pub fn price2(&self) -> Result<Option<Decimal>, InvalidValue> {
445        self.0.get_decimal(Tag(640))
446    }
447
448    /// The `PositionEffect` (77) field.
449    #[doc(alias = "PositionEffect")]
450    pub fn position_effect(&self) -> Result<Option<PositionEffect<'_>>, InvalidValue> {
451        Ok(self.0.get_str(Tag(77))?.map(PositionEffect::from_value))
452    }
453
454    /// The `CoveredOrUncovered` (203) field.
455    #[doc(alias = "CoveredOrUncovered")]
456    pub fn covered_or_uncovered(&self) -> Result<Option<CoveredOrUncovered>, InvalidValue> {
457        Ok(self.0.get_int(Tag(203))?.map(CoveredOrUncovered::from_value))
458    }
459
460    /// The `MaxShow` (210) field.
461    #[doc(alias = "MaxShow")]
462    pub fn max_show(&self) -> Result<Option<Decimal>, InvalidValue> {
463        self.0.get_decimal(Tag(210))
464    }
465
466    /// The `PegInstructions` component.
467    pub fn peg_instructions(&self) -> PegInstructions<'_> {
468        PegInstructions(self.0.scope())
469    }
470
471    /// The `DiscretionInstructions` component.
472    pub fn discretion_instructions(&self) -> DiscretionInstructions<'_> {
473        DiscretionInstructions(self.0.scope())
474    }
475
476    /// The `TargetStrategy` (847) field.
477    #[doc(alias = "TargetStrategy")]
478    pub fn target_strategy(&self) -> Result<Option<TargetStrategy>, InvalidValue> {
479        Ok(self.0.get_int(Tag(847))?.map(TargetStrategy::from_value))
480    }
481
482    /// The `TargetStrategyParameters` (848) field.
483    #[doc(alias = "TargetStrategyParameters")]
484    pub fn target_strategy_parameters(&self) -> Result<Option<&str>, InvalidValue> {
485        self.0.get_str(Tag(848))
486    }
487
488    /// The `ParticipationRate` (849) field.
489    #[doc(alias = "ParticipationRate")]
490    pub fn participation_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
491        self.0.get_decimal(Tag(849))
492    }
493
494    /// The `CancellationRights` (480) field.
495    #[doc(alias = "CancellationRights")]
496    pub fn cancellation_rights(&self) -> Result<Option<CancellationRights<'_>>, InvalidValue> {
497        Ok(self.0.get_str(Tag(480))?.map(CancellationRights::from_value))
498    }
499
500    /// The `MoneyLaunderingStatus` (481) field.
501    #[doc(alias = "MoneyLaunderingStatus")]
502    pub fn money_laundering_status(&self) -> Result<Option<MoneyLaunderingStatus<'_>>, InvalidValue> {
503        Ok(self.0.get_str(Tag(481))?.map(MoneyLaunderingStatus::from_value))
504    }
505
506    /// The `RegistID` (513) field.
507    #[doc(alias = "RegistID")]
508    pub fn regist_id(&self) -> Result<Option<&str>, InvalidValue> {
509        self.0.get_str(Tag(513))
510    }
511
512    /// The `Designation` (494) field.
513    #[doc(alias = "Designation")]
514    pub fn designation(&self) -> Result<Option<&str>, InvalidValue> {
515        self.0.get_str(Tag(494))
516    }
517}
518
519impl std::fmt::Debug for NewOrderSingle {
520    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
521        write!(f, "NewOrderSingle({})", self.0)
522    }
523}
524
525impl std::fmt::Display for NewOrderSingle {
526    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
527        std::fmt::Display::fmt(&self.0, f)
528    }
529}