Skip to main content

fixer_fix/fix41/
new_order_single.rs

1// Code generated by fixer-gen. DO NOT EDIT.
2#![allow(clippy::new_without_default)]
3#![allow(clippy::needless_pass_by_value)]
4#![allow(clippy::too_many_arguments)]
5#![allow(unused_imports)]
6
7use fixer::message::Message;
8use fixer::fix_string::FIXString;
9use fixer::errors::MessageRejectErrorEnum;
10use fixer::session::session_id::SessionID;
11
12use rust_decimal::Decimal;
13
14
15use jiff::Timestamp;
16
17use crate::field;
18use crate::tag;
19
20/// `NewOrderSingle` is the `fix41` `NewOrderSingle` type, `MsgType` = D.
21pub struct NewOrderSingle {
22    pub message: Message,
23}
24
25impl NewOrderSingle {
26    /// Creates a new `NewOrderSingle` with required fields.
27    pub fn new(cl_ord_id: field::ClOrdIDField, handl_inst: field::HandlInstField, symbol: field::SymbolField, side: field::SideField, ord_type: field::OrdTypeField) -> Self {
28        let mut msg = Message::new();
29        msg.header.set_field(tag::MSG_TYPE, FIXString::from("D".to_string()));
30
31        msg.body.set_field(tag::CL_ORD_ID, cl_ord_id.0);
32
33        msg.body.set_field(tag::HANDL_INST, handl_inst.0);
34
35        msg.body.set_field(tag::SYMBOL, symbol.0);
36
37        msg.body.set_field(tag::SIDE, side.0);
38
39        msg.body.set_field(tag::ORD_TYPE, ord_type.0);
40
41        Self { message: msg }
42    }
43
44    /// Creates a `NewOrderSingle` from an existing `Message`.
45    pub fn from_message(msg: Message) -> Self {
46        Self { message: msg }
47    }
48
49    /// Returns the underlying `Message`.
50    pub fn to_message(self) -> Message {
51        self.message
52    }
53
54
55
56
57    /// Sets `Account`, Tag 1.
58    pub fn set_account(&mut self, v: String) {
59        self.message.body.set_field(tag::ACCOUNT, FIXString::from(v));
60    }
61
62    /// Gets `Account`, Tag 1.
63    pub fn get_account(&self) -> Result<String, MessageRejectErrorEnum> {
64        let mut fld = field::AccountField::new(String::new());
65        self.message.body.get_field(tag::ACCOUNT, &mut fld.0)?;
66        Ok(fld.value().to_string())
67    }
68
69
70    /// Returns true if `Account` is present, Tag 1.
71    pub fn has_account(&self) -> bool {
72        self.message.body.has(tag::ACCOUNT)
73    }
74
75
76
77
78    /// Sets `CashOrderQty`, Tag 152.
79    pub fn set_cash_order_qty(&mut self, val: Decimal, scale: i32) {
80        self.message.body.set_field(tag::CASH_ORDER_QTY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
81    }
82
83    /// Gets `CashOrderQty`, Tag 152.
84    pub fn get_cash_order_qty(&self) -> Result<Decimal, MessageRejectErrorEnum> {
85        let mut fld = field::CashOrderQtyField::new(Decimal::ZERO, 0);
86        self.message.body.get_field(tag::CASH_ORDER_QTY, &mut fld.0)?;
87        Ok(fld.value())
88    }
89
90
91    /// Returns true if `CashOrderQty` is present, Tag 152.
92    pub fn has_cash_order_qty(&self) -> bool {
93        self.message.body.has(tag::CASH_ORDER_QTY)
94    }
95
96
97
98
99    /// Sets `ClOrdID`, Tag 11.
100    pub fn set_cl_ord_id(&mut self, v: String) {
101        self.message.body.set_field(tag::CL_ORD_ID, FIXString::from(v));
102    }
103
104    /// Gets `ClOrdID`, Tag 11.
105    pub fn get_cl_ord_id(&self) -> Result<String, MessageRejectErrorEnum> {
106        let mut fld = field::ClOrdIDField::new(String::new());
107        self.message.body.get_field(tag::CL_ORD_ID, &mut fld.0)?;
108        Ok(fld.value().to_string())
109    }
110
111
112    /// Returns true if `ClOrdID` is present, Tag 11.
113    pub fn has_cl_ord_id(&self) -> bool {
114        self.message.body.has(tag::CL_ORD_ID)
115    }
116
117
118
119
120    /// Sets `ClientID`, Tag 109.
121    pub fn set_client_id(&mut self, v: String) {
122        self.message.body.set_field(tag::CLIENT_ID, FIXString::from(v));
123    }
124
125    /// Gets `ClientID`, Tag 109.
126    pub fn get_client_id(&self) -> Result<String, MessageRejectErrorEnum> {
127        let mut fld = field::ClientIDField::new(String::new());
128        self.message.body.get_field(tag::CLIENT_ID, &mut fld.0)?;
129        Ok(fld.value().to_string())
130    }
131
132
133    /// Returns true if `ClientID` is present, Tag 109.
134    pub fn has_client_id(&self) -> bool {
135        self.message.body.has(tag::CLIENT_ID)
136    }
137
138
139
140
141    /// Sets `CommType`, Tag 13.
142    pub fn set_comm_type(&mut self, v: String) {
143        self.message.body.set_field(tag::COMM_TYPE, FIXString::from(v));
144    }
145
146    /// Gets `CommType`, Tag 13.
147    pub fn get_comm_type(&self) -> Result<String, MessageRejectErrorEnum> {
148        let mut fld = field::CommTypeField::new(String::new());
149        self.message.body.get_field(tag::COMM_TYPE, &mut fld.0)?;
150        Ok(fld.value().to_string())
151    }
152
153
154    /// Returns true if `CommType` is present, Tag 13.
155    pub fn has_comm_type(&self) -> bool {
156        self.message.body.has(tag::COMM_TYPE)
157    }
158
159
160
161
162    /// Sets `Commission`, Tag 12.
163    pub fn set_commission(&mut self, val: Decimal, scale: i32) {
164        self.message.body.set_field(tag::COMMISSION, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
165    }
166
167    /// Gets `Commission`, Tag 12.
168    pub fn get_commission(&self) -> Result<Decimal, MessageRejectErrorEnum> {
169        let mut fld = field::CommissionField::new(Decimal::ZERO, 0);
170        self.message.body.get_field(tag::COMMISSION, &mut fld.0)?;
171        Ok(fld.value())
172    }
173
174
175    /// Returns true if `Commission` is present, Tag 12.
176    pub fn has_commission(&self) -> bool {
177        self.message.body.has(tag::COMMISSION)
178    }
179
180
181
182
183    /// Sets `CoveredOrUncovered`, Tag 203.
184    pub fn set_covered_or_uncovered(&mut self, v: isize) {
185        self.message.body.set_field(tag::COVERED_OR_UNCOVERED, fixer::fix_int::FIXInt::from(v));
186    }
187
188    /// Gets `CoveredOrUncovered`, Tag 203.
189    pub fn get_covered_or_uncovered(&self) -> Result<isize, MessageRejectErrorEnum> {
190        let mut fld = field::CoveredOrUncoveredField::new(0);
191        self.message.body.get_field(tag::COVERED_OR_UNCOVERED, &mut fld.0)?;
192        Ok(fld.value())
193    }
194
195
196    /// Returns true if `CoveredOrUncovered` is present, Tag 203.
197    pub fn has_covered_or_uncovered(&self) -> bool {
198        self.message.body.has(tag::COVERED_OR_UNCOVERED)
199    }
200
201
202
203
204    /// Sets `Currency`, Tag 15.
205    pub fn set_currency(&mut self, v: String) {
206        self.message.body.set_field(tag::CURRENCY, FIXString::from(v));
207    }
208
209    /// Gets `Currency`, Tag 15.
210    pub fn get_currency(&self) -> Result<String, MessageRejectErrorEnum> {
211        let mut fld = field::CurrencyField::new(String::new());
212        self.message.body.get_field(tag::CURRENCY, &mut fld.0)?;
213        Ok(fld.value().to_string())
214    }
215
216
217    /// Returns true if `Currency` is present, Tag 15.
218    pub fn has_currency(&self) -> bool {
219        self.message.body.has(tag::CURRENCY)
220    }
221
222
223
224
225    /// Sets `CustomerOrFirm`, Tag 204.
226    pub fn set_customer_or_firm(&mut self, v: isize) {
227        self.message.body.set_field(tag::CUSTOMER_OR_FIRM, fixer::fix_int::FIXInt::from(v));
228    }
229
230    /// Gets `CustomerOrFirm`, Tag 204.
231    pub fn get_customer_or_firm(&self) -> Result<isize, MessageRejectErrorEnum> {
232        let mut fld = field::CustomerOrFirmField::new(0);
233        self.message.body.get_field(tag::CUSTOMER_OR_FIRM, &mut fld.0)?;
234        Ok(fld.value())
235    }
236
237
238    /// Returns true if `CustomerOrFirm` is present, Tag 204.
239    pub fn has_customer_or_firm(&self) -> bool {
240        self.message.body.has(tag::CUSTOMER_OR_FIRM)
241    }
242
243
244
245
246    /// Sets `ExDestination`, Tag 100.
247    pub fn set_ex_destination(&mut self, v: String) {
248        self.message.body.set_field(tag::EX_DESTINATION, FIXString::from(v));
249    }
250
251    /// Gets `ExDestination`, Tag 100.
252    pub fn get_ex_destination(&self) -> Result<String, MessageRejectErrorEnum> {
253        let mut fld = field::ExDestinationField::new(String::new());
254        self.message.body.get_field(tag::EX_DESTINATION, &mut fld.0)?;
255        Ok(fld.value().to_string())
256    }
257
258
259    /// Returns true if `ExDestination` is present, Tag 100.
260    pub fn has_ex_destination(&self) -> bool {
261        self.message.body.has(tag::EX_DESTINATION)
262    }
263
264
265
266
267    /// Sets `ExecBroker`, Tag 76.
268    pub fn set_exec_broker(&mut self, v: String) {
269        self.message.body.set_field(tag::EXEC_BROKER, FIXString::from(v));
270    }
271
272    /// Gets `ExecBroker`, Tag 76.
273    pub fn get_exec_broker(&self) -> Result<String, MessageRejectErrorEnum> {
274        let mut fld = field::ExecBrokerField::new(String::new());
275        self.message.body.get_field(tag::EXEC_BROKER, &mut fld.0)?;
276        Ok(fld.value().to_string())
277    }
278
279
280    /// Returns true if `ExecBroker` is present, Tag 76.
281    pub fn has_exec_broker(&self) -> bool {
282        self.message.body.has(tag::EXEC_BROKER)
283    }
284
285
286
287
288    /// Sets `ExecInst`, Tag 18.
289    pub fn set_exec_inst(&mut self, v: String) {
290        self.message.body.set_field(tag::EXEC_INST, FIXString::from(v));
291    }
292
293    /// Gets `ExecInst`, Tag 18.
294    pub fn get_exec_inst(&self) -> Result<String, MessageRejectErrorEnum> {
295        let mut fld = field::ExecInstField::new(String::new());
296        self.message.body.get_field(tag::EXEC_INST, &mut fld.0)?;
297        Ok(fld.value().to_string())
298    }
299
300
301    /// Returns true if `ExecInst` is present, Tag 18.
302    pub fn has_exec_inst(&self) -> bool {
303        self.message.body.has(tag::EXEC_INST)
304    }
305
306
307
308
309    /// Sets `ExpireTime`, Tag 126.
310    pub fn set_expire_time(&mut self, v: Timestamp) {
311        self.message.body.set_field(tag::EXPIRE_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
312            time: v,
313            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
314        });
315    }
316
317    /// Gets `ExpireTime`, Tag 126.
318    pub fn get_expire_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
319        let mut fld = field::ExpireTimeField::new(Timestamp::UNIX_EPOCH);
320        self.message.body.get_field(tag::EXPIRE_TIME, &mut fld.0)?;
321        Ok(fld.value())
322    }
323
324
325    /// Returns true if `ExpireTime` is present, Tag 126.
326    pub fn has_expire_time(&self) -> bool {
327        self.message.body.has(tag::EXPIRE_TIME)
328    }
329
330
331
332
333    /// Sets `ForexReq`, Tag 121.
334    pub fn set_forex_req(&mut self, v: bool) {
335        self.message.body.set_field(tag::FOREX_REQ, fixer::fix_boolean::FIXBoolean::from(v));
336    }
337
338    /// Gets `ForexReq`, Tag 121.
339    pub fn get_forex_req(&self) -> Result<bool, MessageRejectErrorEnum> {
340        let mut fld = field::ForexReqField::new(false);
341        self.message.body.get_field(tag::FOREX_REQ, &mut fld.0)?;
342        Ok(fld.value())
343    }
344
345
346    /// Returns true if `ForexReq` is present, Tag 121.
347    pub fn has_forex_req(&self) -> bool {
348        self.message.body.has(tag::FOREX_REQ)
349    }
350
351
352
353
354    /// Sets `FutSettDate`, Tag 64.
355    pub fn set_fut_sett_date(&mut self, v: String) {
356        self.message.body.set_field(tag::FUT_SETT_DATE, FIXString::from(v));
357    }
358
359    /// Gets `FutSettDate`, Tag 64.
360    pub fn get_fut_sett_date(&self) -> Result<String, MessageRejectErrorEnum> {
361        let mut fld = field::FutSettDateField::new(String::new());
362        self.message.body.get_field(tag::FUT_SETT_DATE, &mut fld.0)?;
363        Ok(fld.value().to_string())
364    }
365
366
367    /// Returns true if `FutSettDate` is present, Tag 64.
368    pub fn has_fut_sett_date(&self) -> bool {
369        self.message.body.has(tag::FUT_SETT_DATE)
370    }
371
372
373
374
375    /// Sets `FutSettDate2`, Tag 193.
376    pub fn set_fut_sett_date2(&mut self, v: String) {
377        self.message.body.set_field(tag::FUT_SETT_DATE2, FIXString::from(v));
378    }
379
380    /// Gets `FutSettDate2`, Tag 193.
381    pub fn get_fut_sett_date2(&self) -> Result<String, MessageRejectErrorEnum> {
382        let mut fld = field::FutSettDate2Field::new(String::new());
383        self.message.body.get_field(tag::FUT_SETT_DATE2, &mut fld.0)?;
384        Ok(fld.value().to_string())
385    }
386
387
388    /// Returns true if `FutSettDate2` is present, Tag 193.
389    pub fn has_fut_sett_date2(&self) -> bool {
390        self.message.body.has(tag::FUT_SETT_DATE2)
391    }
392
393
394
395
396    /// Sets `HandlInst`, Tag 21.
397    pub fn set_handl_inst(&mut self, v: String) {
398        self.message.body.set_field(tag::HANDL_INST, FIXString::from(v));
399    }
400
401    /// Gets `HandlInst`, Tag 21.
402    pub fn get_handl_inst(&self) -> Result<String, MessageRejectErrorEnum> {
403        let mut fld = field::HandlInstField::new(String::new());
404        self.message.body.get_field(tag::HANDL_INST, &mut fld.0)?;
405        Ok(fld.value().to_string())
406    }
407
408
409    /// Returns true if `HandlInst` is present, Tag 21.
410    pub fn has_handl_inst(&self) -> bool {
411        self.message.body.has(tag::HANDL_INST)
412    }
413
414
415
416
417    /// Sets `IDSource`, Tag 22.
418    pub fn set_id_source(&mut self, v: String) {
419        self.message.body.set_field(tag::ID_SOURCE, FIXString::from(v));
420    }
421
422    /// Gets `IDSource`, Tag 22.
423    pub fn get_id_source(&self) -> Result<String, MessageRejectErrorEnum> {
424        let mut fld = field::IDSourceField::new(String::new());
425        self.message.body.get_field(tag::ID_SOURCE, &mut fld.0)?;
426        Ok(fld.value().to_string())
427    }
428
429
430    /// Returns true if `IDSource` is present, Tag 22.
431    pub fn has_id_source(&self) -> bool {
432        self.message.body.has(tag::ID_SOURCE)
433    }
434
435
436
437
438    /// Sets `IOIid`, Tag 23.
439    pub fn set_io_iid(&mut self, v: String) {
440        self.message.body.set_field(tag::IO_IID, FIXString::from(v));
441    }
442
443    /// Gets `IOIid`, Tag 23.
444    pub fn get_io_iid(&self) -> Result<String, MessageRejectErrorEnum> {
445        let mut fld = field::IOIidField::new(String::new());
446        self.message.body.get_field(tag::IO_IID, &mut fld.0)?;
447        Ok(fld.value().to_string())
448    }
449
450
451    /// Returns true if `IOIid` is present, Tag 23.
452    pub fn has_io_iid(&self) -> bool {
453        self.message.body.has(tag::IO_IID)
454    }
455
456
457
458
459    /// Sets `Issuer`, Tag 106.
460    pub fn set_issuer(&mut self, v: String) {
461        self.message.body.set_field(tag::ISSUER, FIXString::from(v));
462    }
463
464    /// Gets `Issuer`, Tag 106.
465    pub fn get_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
466        let mut fld = field::IssuerField::new(String::new());
467        self.message.body.get_field(tag::ISSUER, &mut fld.0)?;
468        Ok(fld.value().to_string())
469    }
470
471
472    /// Returns true if `Issuer` is present, Tag 106.
473    pub fn has_issuer(&self) -> bool {
474        self.message.body.has(tag::ISSUER)
475    }
476
477
478
479
480    /// Sets `LocateReqd`, Tag 114.
481    pub fn set_locate_reqd(&mut self, v: bool) {
482        self.message.body.set_field(tag::LOCATE_REQD, fixer::fix_boolean::FIXBoolean::from(v));
483    }
484
485    /// Gets `LocateReqd`, Tag 114.
486    pub fn get_locate_reqd(&self) -> Result<bool, MessageRejectErrorEnum> {
487        let mut fld = field::LocateReqdField::new(false);
488        self.message.body.get_field(tag::LOCATE_REQD, &mut fld.0)?;
489        Ok(fld.value())
490    }
491
492
493    /// Returns true if `LocateReqd` is present, Tag 114.
494    pub fn has_locate_reqd(&self) -> bool {
495        self.message.body.has(tag::LOCATE_REQD)
496    }
497
498
499
500
501    /// Sets `MaturityDay`, Tag 205.
502    pub fn set_maturity_day(&mut self, v: isize) {
503        self.message.body.set_field(tag::MATURITY_DAY, fixer::fix_int::FIXInt::from(v));
504    }
505
506    /// Gets `MaturityDay`, Tag 205.
507    pub fn get_maturity_day(&self) -> Result<isize, MessageRejectErrorEnum> {
508        let mut fld = field::MaturityDayField::new(0);
509        self.message.body.get_field(tag::MATURITY_DAY, &mut fld.0)?;
510        Ok(fld.value())
511    }
512
513
514    /// Returns true if `MaturityDay` is present, Tag 205.
515    pub fn has_maturity_day(&self) -> bool {
516        self.message.body.has(tag::MATURITY_DAY)
517    }
518
519
520
521
522    /// Sets `MaturityMonthYear`, Tag 200.
523    pub fn set_maturity_month_year(&mut self, v: String) {
524        self.message.body.set_field(tag::MATURITY_MONTH_YEAR, FIXString::from(v));
525    }
526
527    /// Gets `MaturityMonthYear`, Tag 200.
528    pub fn get_maturity_month_year(&self) -> Result<String, MessageRejectErrorEnum> {
529        let mut fld = field::MaturityMonthYearField::new(String::new());
530        self.message.body.get_field(tag::MATURITY_MONTH_YEAR, &mut fld.0)?;
531        Ok(fld.value().to_string())
532    }
533
534
535    /// Returns true if `MaturityMonthYear` is present, Tag 200.
536    pub fn has_maturity_month_year(&self) -> bool {
537        self.message.body.has(tag::MATURITY_MONTH_YEAR)
538    }
539
540
541
542
543    /// Sets `MaxFloor`, Tag 111.
544    pub fn set_max_floor(&mut self, val: Decimal, scale: i32) {
545        self.message.body.set_field(tag::MAX_FLOOR, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
546    }
547
548    /// Gets `MaxFloor`, Tag 111.
549    pub fn get_max_floor(&self) -> Result<Decimal, MessageRejectErrorEnum> {
550        let mut fld = field::MaxFloorField::new(Decimal::ZERO, 0);
551        self.message.body.get_field(tag::MAX_FLOOR, &mut fld.0)?;
552        Ok(fld.value())
553    }
554
555
556    /// Returns true if `MaxFloor` is present, Tag 111.
557    pub fn has_max_floor(&self) -> bool {
558        self.message.body.has(tag::MAX_FLOOR)
559    }
560
561
562
563
564    /// Sets `MaxShow`, Tag 210.
565    pub fn set_max_show(&mut self, val: Decimal, scale: i32) {
566        self.message.body.set_field(tag::MAX_SHOW, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
567    }
568
569    /// Gets `MaxShow`, Tag 210.
570    pub fn get_max_show(&self) -> Result<Decimal, MessageRejectErrorEnum> {
571        let mut fld = field::MaxShowField::new(Decimal::ZERO, 0);
572        self.message.body.get_field(tag::MAX_SHOW, &mut fld.0)?;
573        Ok(fld.value())
574    }
575
576
577    /// Returns true if `MaxShow` is present, Tag 210.
578    pub fn has_max_show(&self) -> bool {
579        self.message.body.has(tag::MAX_SHOW)
580    }
581
582
583
584
585    /// Sets `MinQty`, Tag 110.
586    pub fn set_min_qty(&mut self, val: Decimal, scale: i32) {
587        self.message.body.set_field(tag::MIN_QTY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
588    }
589
590    /// Gets `MinQty`, Tag 110.
591    pub fn get_min_qty(&self) -> Result<Decimal, MessageRejectErrorEnum> {
592        let mut fld = field::MinQtyField::new(Decimal::ZERO, 0);
593        self.message.body.get_field(tag::MIN_QTY, &mut fld.0)?;
594        Ok(fld.value())
595    }
596
597
598    /// Returns true if `MinQty` is present, Tag 110.
599    pub fn has_min_qty(&self) -> bool {
600        self.message.body.has(tag::MIN_QTY)
601    }
602
603
604
605
606    /// Sets `OpenClose`, Tag 77.
607    pub fn set_open_close(&mut self, v: String) {
608        self.message.body.set_field(tag::OPEN_CLOSE, FIXString::from(v));
609    }
610
611    /// Gets `OpenClose`, Tag 77.
612    pub fn get_open_close(&self) -> Result<String, MessageRejectErrorEnum> {
613        let mut fld = field::OpenCloseField::new(String::new());
614        self.message.body.get_field(tag::OPEN_CLOSE, &mut fld.0)?;
615        Ok(fld.value().to_string())
616    }
617
618
619    /// Returns true if `OpenClose` is present, Tag 77.
620    pub fn has_open_close(&self) -> bool {
621        self.message.body.has(tag::OPEN_CLOSE)
622    }
623
624
625
626
627    /// Sets `OptAttribute`, Tag 206.
628    pub fn set_opt_attribute(&mut self, v: String) {
629        self.message.body.set_field(tag::OPT_ATTRIBUTE, FIXString::from(v));
630    }
631
632    /// Gets `OptAttribute`, Tag 206.
633    pub fn get_opt_attribute(&self) -> Result<String, MessageRejectErrorEnum> {
634        let mut fld = field::OptAttributeField::new(String::new());
635        self.message.body.get_field(tag::OPT_ATTRIBUTE, &mut fld.0)?;
636        Ok(fld.value().to_string())
637    }
638
639
640    /// Returns true if `OptAttribute` is present, Tag 206.
641    pub fn has_opt_attribute(&self) -> bool {
642        self.message.body.has(tag::OPT_ATTRIBUTE)
643    }
644
645
646
647
648    /// Sets `OrdType`, Tag 40.
649    pub fn set_ord_type(&mut self, v: String) {
650        self.message.body.set_field(tag::ORD_TYPE, FIXString::from(v));
651    }
652
653    /// Gets `OrdType`, Tag 40.
654    pub fn get_ord_type(&self) -> Result<String, MessageRejectErrorEnum> {
655        let mut fld = field::OrdTypeField::new(String::new());
656        self.message.body.get_field(tag::ORD_TYPE, &mut fld.0)?;
657        Ok(fld.value().to_string())
658    }
659
660
661    /// Returns true if `OrdType` is present, Tag 40.
662    pub fn has_ord_type(&self) -> bool {
663        self.message.body.has(tag::ORD_TYPE)
664    }
665
666
667
668
669    /// Sets `OrderQty`, Tag 38.
670    pub fn set_order_qty(&mut self, val: Decimal, scale: i32) {
671        self.message.body.set_field(tag::ORDER_QTY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
672    }
673
674    /// Gets `OrderQty`, Tag 38.
675    pub fn get_order_qty(&self) -> Result<Decimal, MessageRejectErrorEnum> {
676        let mut fld = field::OrderQtyField::new(Decimal::ZERO, 0);
677        self.message.body.get_field(tag::ORDER_QTY, &mut fld.0)?;
678        Ok(fld.value())
679    }
680
681
682    /// Returns true if `OrderQty` is present, Tag 38.
683    pub fn has_order_qty(&self) -> bool {
684        self.message.body.has(tag::ORDER_QTY)
685    }
686
687
688
689
690    /// Sets `OrderQty2`, Tag 192.
691    pub fn set_order_qty2(&mut self, val: Decimal, scale: i32) {
692        self.message.body.set_field(tag::ORDER_QTY2, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
693    }
694
695    /// Gets `OrderQty2`, Tag 192.
696    pub fn get_order_qty2(&self) -> Result<Decimal, MessageRejectErrorEnum> {
697        let mut fld = field::OrderQty2Field::new(Decimal::ZERO, 0);
698        self.message.body.get_field(tag::ORDER_QTY2, &mut fld.0)?;
699        Ok(fld.value())
700    }
701
702
703    /// Returns true if `OrderQty2` is present, Tag 192.
704    pub fn has_order_qty2(&self) -> bool {
705        self.message.body.has(tag::ORDER_QTY2)
706    }
707
708
709
710
711    /// Sets `PegDifference`, Tag 211.
712    pub fn set_peg_difference(&mut self, val: Decimal, scale: i32) {
713        self.message.body.set_field(tag::PEG_DIFFERENCE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
714    }
715
716    /// Gets `PegDifference`, Tag 211.
717    pub fn get_peg_difference(&self) -> Result<Decimal, MessageRejectErrorEnum> {
718        let mut fld = field::PegDifferenceField::new(Decimal::ZERO, 0);
719        self.message.body.get_field(tag::PEG_DIFFERENCE, &mut fld.0)?;
720        Ok(fld.value())
721    }
722
723
724    /// Returns true if `PegDifference` is present, Tag 211.
725    pub fn has_peg_difference(&self) -> bool {
726        self.message.body.has(tag::PEG_DIFFERENCE)
727    }
728
729
730
731
732    /// Sets `PrevClosePx`, Tag 140.
733    pub fn set_prev_close_px(&mut self, val: Decimal, scale: i32) {
734        self.message.body.set_field(tag::PREV_CLOSE_PX, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
735    }
736
737    /// Gets `PrevClosePx`, Tag 140.
738    pub fn get_prev_close_px(&self) -> Result<Decimal, MessageRejectErrorEnum> {
739        let mut fld = field::PrevClosePxField::new(Decimal::ZERO, 0);
740        self.message.body.get_field(tag::PREV_CLOSE_PX, &mut fld.0)?;
741        Ok(fld.value())
742    }
743
744
745    /// Returns true if `PrevClosePx` is present, Tag 140.
746    pub fn has_prev_close_px(&self) -> bool {
747        self.message.body.has(tag::PREV_CLOSE_PX)
748    }
749
750
751
752
753    /// Sets `Price`, Tag 44.
754    pub fn set_price(&mut self, val: Decimal, scale: i32) {
755        self.message.body.set_field(tag::PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
756    }
757
758    /// Gets `Price`, Tag 44.
759    pub fn get_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
760        let mut fld = field::PriceField::new(Decimal::ZERO, 0);
761        self.message.body.get_field(tag::PRICE, &mut fld.0)?;
762        Ok(fld.value())
763    }
764
765
766    /// Returns true if `Price` is present, Tag 44.
767    pub fn has_price(&self) -> bool {
768        self.message.body.has(tag::PRICE)
769    }
770
771
772
773
774    /// Sets `ProcessCode`, Tag 81.
775    pub fn set_process_code(&mut self, v: String) {
776        self.message.body.set_field(tag::PROCESS_CODE, FIXString::from(v));
777    }
778
779    /// Gets `ProcessCode`, Tag 81.
780    pub fn get_process_code(&self) -> Result<String, MessageRejectErrorEnum> {
781        let mut fld = field::ProcessCodeField::new(String::new());
782        self.message.body.get_field(tag::PROCESS_CODE, &mut fld.0)?;
783        Ok(fld.value().to_string())
784    }
785
786
787    /// Returns true if `ProcessCode` is present, Tag 81.
788    pub fn has_process_code(&self) -> bool {
789        self.message.body.has(tag::PROCESS_CODE)
790    }
791
792
793
794
795    /// Sets `PutOrCall`, Tag 201.
796    pub fn set_put_or_call(&mut self, v: isize) {
797        self.message.body.set_field(tag::PUT_OR_CALL, fixer::fix_int::FIXInt::from(v));
798    }
799
800    /// Gets `PutOrCall`, Tag 201.
801    pub fn get_put_or_call(&self) -> Result<isize, MessageRejectErrorEnum> {
802        let mut fld = field::PutOrCallField::new(0);
803        self.message.body.get_field(tag::PUT_OR_CALL, &mut fld.0)?;
804        Ok(fld.value())
805    }
806
807
808    /// Returns true if `PutOrCall` is present, Tag 201.
809    pub fn has_put_or_call(&self) -> bool {
810        self.message.body.has(tag::PUT_OR_CALL)
811    }
812
813
814
815
816    /// Sets `QuoteID`, Tag 117.
817    pub fn set_quote_id(&mut self, v: String) {
818        self.message.body.set_field(tag::QUOTE_ID, FIXString::from(v));
819    }
820
821    /// Gets `QuoteID`, Tag 117.
822    pub fn get_quote_id(&self) -> Result<String, MessageRejectErrorEnum> {
823        let mut fld = field::QuoteIDField::new(String::new());
824        self.message.body.get_field(tag::QUOTE_ID, &mut fld.0)?;
825        Ok(fld.value().to_string())
826    }
827
828
829    /// Returns true if `QuoteID` is present, Tag 117.
830    pub fn has_quote_id(&self) -> bool {
831        self.message.body.has(tag::QUOTE_ID)
832    }
833
834
835
836
837    /// Sets `Rule80A`, Tag 47.
838    pub fn set_rule80_a(&mut self, v: String) {
839        self.message.body.set_field(tag::RULE80_A, FIXString::from(v));
840    }
841
842    /// Gets `Rule80A`, Tag 47.
843    pub fn get_rule80_a(&self) -> Result<String, MessageRejectErrorEnum> {
844        let mut fld = field::Rule80AField::new(String::new());
845        self.message.body.get_field(tag::RULE80_A, &mut fld.0)?;
846        Ok(fld.value().to_string())
847    }
848
849
850    /// Returns true if `Rule80A` is present, Tag 47.
851    pub fn has_rule80_a(&self) -> bool {
852        self.message.body.has(tag::RULE80_A)
853    }
854
855
856
857
858    /// Sets `SecurityDesc`, Tag 107.
859    pub fn set_security_desc(&mut self, v: String) {
860        self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
861    }
862
863    /// Gets `SecurityDesc`, Tag 107.
864    pub fn get_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
865        let mut fld = field::SecurityDescField::new(String::new());
866        self.message.body.get_field(tag::SECURITY_DESC, &mut fld.0)?;
867        Ok(fld.value().to_string())
868    }
869
870
871    /// Returns true if `SecurityDesc` is present, Tag 107.
872    pub fn has_security_desc(&self) -> bool {
873        self.message.body.has(tag::SECURITY_DESC)
874    }
875
876
877
878
879    /// Sets `SecurityExchange`, Tag 207.
880    pub fn set_security_exchange(&mut self, v: String) {
881        self.message.body.set_field(tag::SECURITY_EXCHANGE, FIXString::from(v));
882    }
883
884    /// Gets `SecurityExchange`, Tag 207.
885    pub fn get_security_exchange(&self) -> Result<String, MessageRejectErrorEnum> {
886        let mut fld = field::SecurityExchangeField::new(String::new());
887        self.message.body.get_field(tag::SECURITY_EXCHANGE, &mut fld.0)?;
888        Ok(fld.value().to_string())
889    }
890
891
892    /// Returns true if `SecurityExchange` is present, Tag 207.
893    pub fn has_security_exchange(&self) -> bool {
894        self.message.body.has(tag::SECURITY_EXCHANGE)
895    }
896
897
898
899
900    /// Sets `SecurityID`, Tag 48.
901    pub fn set_security_id(&mut self, v: String) {
902        self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
903    }
904
905    /// Gets `SecurityID`, Tag 48.
906    pub fn get_security_id(&self) -> Result<String, MessageRejectErrorEnum> {
907        let mut fld = field::SecurityIDField::new(String::new());
908        self.message.body.get_field(tag::SECURITY_ID, &mut fld.0)?;
909        Ok(fld.value().to_string())
910    }
911
912
913    /// Returns true if `SecurityID` is present, Tag 48.
914    pub fn has_security_id(&self) -> bool {
915        self.message.body.has(tag::SECURITY_ID)
916    }
917
918
919
920
921    /// Sets `SecurityType`, Tag 167.
922    pub fn set_security_type(&mut self, v: String) {
923        self.message.body.set_field(tag::SECURITY_TYPE, FIXString::from(v));
924    }
925
926    /// Gets `SecurityType`, Tag 167.
927    pub fn get_security_type(&self) -> Result<String, MessageRejectErrorEnum> {
928        let mut fld = field::SecurityTypeField::new(String::new());
929        self.message.body.get_field(tag::SECURITY_TYPE, &mut fld.0)?;
930        Ok(fld.value().to_string())
931    }
932
933
934    /// Returns true if `SecurityType` is present, Tag 167.
935    pub fn has_security_type(&self) -> bool {
936        self.message.body.has(tag::SECURITY_TYPE)
937    }
938
939
940
941
942    /// Sets `SettlCurrency`, Tag 120.
943    pub fn set_settl_currency(&mut self, v: String) {
944        self.message.body.set_field(tag::SETTL_CURRENCY, FIXString::from(v));
945    }
946
947    /// Gets `SettlCurrency`, Tag 120.
948    pub fn get_settl_currency(&self) -> Result<String, MessageRejectErrorEnum> {
949        let mut fld = field::SettlCurrencyField::new(String::new());
950        self.message.body.get_field(tag::SETTL_CURRENCY, &mut fld.0)?;
951        Ok(fld.value().to_string())
952    }
953
954
955    /// Returns true if `SettlCurrency` is present, Tag 120.
956    pub fn has_settl_currency(&self) -> bool {
957        self.message.body.has(tag::SETTL_CURRENCY)
958    }
959
960
961
962
963    /// Sets `SettlmntTyp`, Tag 63.
964    pub fn set_settlmnt_typ(&mut self, v: String) {
965        self.message.body.set_field(tag::SETTLMNT_TYP, FIXString::from(v));
966    }
967
968    /// Gets `SettlmntTyp`, Tag 63.
969    pub fn get_settlmnt_typ(&self) -> Result<String, MessageRejectErrorEnum> {
970        let mut fld = field::SettlmntTypField::new(String::new());
971        self.message.body.get_field(tag::SETTLMNT_TYP, &mut fld.0)?;
972        Ok(fld.value().to_string())
973    }
974
975
976    /// Returns true if `SettlmntTyp` is present, Tag 63.
977    pub fn has_settlmnt_typ(&self) -> bool {
978        self.message.body.has(tag::SETTLMNT_TYP)
979    }
980
981
982
983
984    /// Sets `Side`, Tag 54.
985    pub fn set_side(&mut self, v: String) {
986        self.message.body.set_field(tag::SIDE, FIXString::from(v));
987    }
988
989    /// Gets `Side`, Tag 54.
990    pub fn get_side(&self) -> Result<String, MessageRejectErrorEnum> {
991        let mut fld = field::SideField::new(String::new());
992        self.message.body.get_field(tag::SIDE, &mut fld.0)?;
993        Ok(fld.value().to_string())
994    }
995
996
997    /// Returns true if `Side` is present, Tag 54.
998    pub fn has_side(&self) -> bool {
999        self.message.body.has(tag::SIDE)
1000    }
1001
1002
1003
1004
1005    /// Sets `StopPx`, Tag 99.
1006    pub fn set_stop_px(&mut self, val: Decimal, scale: i32) {
1007        self.message.body.set_field(tag::STOP_PX, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
1008    }
1009
1010    /// Gets `StopPx`, Tag 99.
1011    pub fn get_stop_px(&self) -> Result<Decimal, MessageRejectErrorEnum> {
1012        let mut fld = field::StopPxField::new(Decimal::ZERO, 0);
1013        self.message.body.get_field(tag::STOP_PX, &mut fld.0)?;
1014        Ok(fld.value())
1015    }
1016
1017
1018    /// Returns true if `StopPx` is present, Tag 99.
1019    pub fn has_stop_px(&self) -> bool {
1020        self.message.body.has(tag::STOP_PX)
1021    }
1022
1023
1024
1025
1026    /// Sets `StrikePrice`, Tag 202.
1027    pub fn set_strike_price(&mut self, val: Decimal, scale: i32) {
1028        self.message.body.set_field(tag::STRIKE_PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
1029    }
1030
1031    /// Gets `StrikePrice`, Tag 202.
1032    pub fn get_strike_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
1033        let mut fld = field::StrikePriceField::new(Decimal::ZERO, 0);
1034        self.message.body.get_field(tag::STRIKE_PRICE, &mut fld.0)?;
1035        Ok(fld.value())
1036    }
1037
1038
1039    /// Returns true if `StrikePrice` is present, Tag 202.
1040    pub fn has_strike_price(&self) -> bool {
1041        self.message.body.has(tag::STRIKE_PRICE)
1042    }
1043
1044
1045
1046
1047    /// Sets `Symbol`, Tag 55.
1048    pub fn set_symbol(&mut self, v: String) {
1049        self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
1050    }
1051
1052    /// Gets `Symbol`, Tag 55.
1053    pub fn get_symbol(&self) -> Result<String, MessageRejectErrorEnum> {
1054        let mut fld = field::SymbolField::new(String::new());
1055        self.message.body.get_field(tag::SYMBOL, &mut fld.0)?;
1056        Ok(fld.value().to_string())
1057    }
1058
1059
1060    /// Returns true if `Symbol` is present, Tag 55.
1061    pub fn has_symbol(&self) -> bool {
1062        self.message.body.has(tag::SYMBOL)
1063    }
1064
1065
1066
1067
1068    /// Sets `SymbolSfx`, Tag 65.
1069    pub fn set_symbol_sfx(&mut self, v: String) {
1070        self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
1071    }
1072
1073    /// Gets `SymbolSfx`, Tag 65.
1074    pub fn get_symbol_sfx(&self) -> Result<String, MessageRejectErrorEnum> {
1075        let mut fld = field::SymbolSfxField::new(String::new());
1076        self.message.body.get_field(tag::SYMBOL_SFX, &mut fld.0)?;
1077        Ok(fld.value().to_string())
1078    }
1079
1080
1081    /// Returns true if `SymbolSfx` is present, Tag 65.
1082    pub fn has_symbol_sfx(&self) -> bool {
1083        self.message.body.has(tag::SYMBOL_SFX)
1084    }
1085
1086
1087
1088
1089    /// Sets `Text`, Tag 58.
1090    pub fn set_text(&mut self, v: String) {
1091        self.message.body.set_field(tag::TEXT, FIXString::from(v));
1092    }
1093
1094    /// Gets `Text`, Tag 58.
1095    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
1096        let mut fld = field::TextField::new(String::new());
1097        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
1098        Ok(fld.value().to_string())
1099    }
1100
1101
1102    /// Returns true if `Text` is present, Tag 58.
1103    pub fn has_text(&self) -> bool {
1104        self.message.body.has(tag::TEXT)
1105    }
1106
1107
1108
1109
1110    /// Sets `TimeInForce`, Tag 59.
1111    pub fn set_time_in_force(&mut self, v: String) {
1112        self.message.body.set_field(tag::TIME_IN_FORCE, FIXString::from(v));
1113    }
1114
1115    /// Gets `TimeInForce`, Tag 59.
1116    pub fn get_time_in_force(&self) -> Result<String, MessageRejectErrorEnum> {
1117        let mut fld = field::TimeInForceField::new(String::new());
1118        self.message.body.get_field(tag::TIME_IN_FORCE, &mut fld.0)?;
1119        Ok(fld.value().to_string())
1120    }
1121
1122
1123    /// Returns true if `TimeInForce` is present, Tag 59.
1124    pub fn has_time_in_force(&self) -> bool {
1125        self.message.body.has(tag::TIME_IN_FORCE)
1126    }
1127
1128
1129}
1130
1131/// `RouteOut` is the callback type for routing `NewOrderSingle` messages.
1132pub type RouteOut = fn(msg: NewOrderSingle, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
1133
1134/// Route type returned by the `route` function.
1135pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
1136
1137/// Returns the begin string, message type, and route function for `NewOrderSingle`.
1138pub fn route(router: RouteOut) -> Route {
1139    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
1140        router(NewOrderSingle::from_message(msg.clone()), session_id)
1141    };
1142    ("FIX.4.1", "D", Box::new(r))
1143}