Skip to main content

fixer_fix/fix40/
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 `fix40` `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, order_qty: field::OrderQtyField, 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::ORDER_QTY, order_qty.0);
40
41        msg.body.set_field(tag::ORD_TYPE, ord_type.0);
42
43        Self { message: msg }
44    }
45
46    /// Creates a `NewOrderSingle` from an existing `Message`.
47    pub fn from_message(msg: Message) -> Self {
48        Self { message: msg }
49    }
50
51    /// Returns the underlying `Message`.
52    pub fn to_message(self) -> Message {
53        self.message
54    }
55
56
57
58
59    /// Sets `Account`, Tag 1.
60    pub fn set_account(&mut self, v: String) {
61        self.message.body.set_field(tag::ACCOUNT, FIXString::from(v));
62    }
63
64    /// Gets `Account`, Tag 1.
65    pub fn get_account(&self) -> Result<String, MessageRejectErrorEnum> {
66        let mut fld = field::AccountField::new(String::new());
67        self.message.body.get_field(tag::ACCOUNT, &mut fld.0)?;
68        Ok(fld.value().to_string())
69    }
70
71
72    /// Returns true if `Account` is present, Tag 1.
73    pub fn has_account(&self) -> bool {
74        self.message.body.has(tag::ACCOUNT)
75    }
76
77
78
79
80    /// Sets `ClOrdID`, Tag 11.
81    pub fn set_cl_ord_id(&mut self, v: String) {
82        self.message.body.set_field(tag::CL_ORD_ID, FIXString::from(v));
83    }
84
85    /// Gets `ClOrdID`, Tag 11.
86    pub fn get_cl_ord_id(&self) -> Result<String, MessageRejectErrorEnum> {
87        let mut fld = field::ClOrdIDField::new(String::new());
88        self.message.body.get_field(tag::CL_ORD_ID, &mut fld.0)?;
89        Ok(fld.value().to_string())
90    }
91
92
93    /// Returns true if `ClOrdID` is present, Tag 11.
94    pub fn has_cl_ord_id(&self) -> bool {
95        self.message.body.has(tag::CL_ORD_ID)
96    }
97
98
99
100
101    /// Sets `ClientID`, Tag 109.
102    pub fn set_client_id(&mut self, v: String) {
103        self.message.body.set_field(tag::CLIENT_ID, FIXString::from(v));
104    }
105
106    /// Gets `ClientID`, Tag 109.
107    pub fn get_client_id(&self) -> Result<String, MessageRejectErrorEnum> {
108        let mut fld = field::ClientIDField::new(String::new());
109        self.message.body.get_field(tag::CLIENT_ID, &mut fld.0)?;
110        Ok(fld.value().to_string())
111    }
112
113
114    /// Returns true if `ClientID` is present, Tag 109.
115    pub fn has_client_id(&self) -> bool {
116        self.message.body.has(tag::CLIENT_ID)
117    }
118
119
120
121
122    /// Sets `CommType`, Tag 13.
123    pub fn set_comm_type(&mut self, v: String) {
124        self.message.body.set_field(tag::COMM_TYPE, FIXString::from(v));
125    }
126
127    /// Gets `CommType`, Tag 13.
128    pub fn get_comm_type(&self) -> Result<String, MessageRejectErrorEnum> {
129        let mut fld = field::CommTypeField::new(String::new());
130        self.message.body.get_field(tag::COMM_TYPE, &mut fld.0)?;
131        Ok(fld.value().to_string())
132    }
133
134
135    /// Returns true if `CommType` is present, Tag 13.
136    pub fn has_comm_type(&self) -> bool {
137        self.message.body.has(tag::COMM_TYPE)
138    }
139
140
141
142
143    /// Sets `Commission`, Tag 12.
144    pub fn set_commission(&mut self, val: Decimal, scale: i32) {
145        self.message.body.set_field(tag::COMMISSION, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
146    }
147
148    /// Gets `Commission`, Tag 12.
149    pub fn get_commission(&self) -> Result<Decimal, MessageRejectErrorEnum> {
150        let mut fld = field::CommissionField::new(Decimal::ZERO, 0);
151        self.message.body.get_field(tag::COMMISSION, &mut fld.0)?;
152        Ok(fld.value())
153    }
154
155
156    /// Returns true if `Commission` is present, Tag 12.
157    pub fn has_commission(&self) -> bool {
158        self.message.body.has(tag::COMMISSION)
159    }
160
161
162
163
164    /// Sets `Currency`, Tag 15.
165    pub fn set_currency(&mut self, v: String) {
166        self.message.body.set_field(tag::CURRENCY, FIXString::from(v));
167    }
168
169    /// Gets `Currency`, Tag 15.
170    pub fn get_currency(&self) -> Result<String, MessageRejectErrorEnum> {
171        let mut fld = field::CurrencyField::new(String::new());
172        self.message.body.get_field(tag::CURRENCY, &mut fld.0)?;
173        Ok(fld.value().to_string())
174    }
175
176
177    /// Returns true if `Currency` is present, Tag 15.
178    pub fn has_currency(&self) -> bool {
179        self.message.body.has(tag::CURRENCY)
180    }
181
182
183
184
185    /// Sets `ExDestination`, Tag 100.
186    pub fn set_ex_destination(&mut self, v: String) {
187        self.message.body.set_field(tag::EX_DESTINATION, FIXString::from(v));
188    }
189
190    /// Gets `ExDestination`, Tag 100.
191    pub fn get_ex_destination(&self) -> Result<String, MessageRejectErrorEnum> {
192        let mut fld = field::ExDestinationField::new(String::new());
193        self.message.body.get_field(tag::EX_DESTINATION, &mut fld.0)?;
194        Ok(fld.value().to_string())
195    }
196
197
198    /// Returns true if `ExDestination` is present, Tag 100.
199    pub fn has_ex_destination(&self) -> bool {
200        self.message.body.has(tag::EX_DESTINATION)
201    }
202
203
204
205
206    /// Sets `ExecBroker`, Tag 76.
207    pub fn set_exec_broker(&mut self, v: String) {
208        self.message.body.set_field(tag::EXEC_BROKER, FIXString::from(v));
209    }
210
211    /// Gets `ExecBroker`, Tag 76.
212    pub fn get_exec_broker(&self) -> Result<String, MessageRejectErrorEnum> {
213        let mut fld = field::ExecBrokerField::new(String::new());
214        self.message.body.get_field(tag::EXEC_BROKER, &mut fld.0)?;
215        Ok(fld.value().to_string())
216    }
217
218
219    /// Returns true if `ExecBroker` is present, Tag 76.
220    pub fn has_exec_broker(&self) -> bool {
221        self.message.body.has(tag::EXEC_BROKER)
222    }
223
224
225
226
227    /// Sets `ExecInst`, Tag 18.
228    pub fn set_exec_inst(&mut self, v: String) {
229        self.message.body.set_field(tag::EXEC_INST, FIXString::from(v));
230    }
231
232    /// Gets `ExecInst`, Tag 18.
233    pub fn get_exec_inst(&self) -> Result<String, MessageRejectErrorEnum> {
234        let mut fld = field::ExecInstField::new(String::new());
235        self.message.body.get_field(tag::EXEC_INST, &mut fld.0)?;
236        Ok(fld.value().to_string())
237    }
238
239
240    /// Returns true if `ExecInst` is present, Tag 18.
241    pub fn has_exec_inst(&self) -> bool {
242        self.message.body.has(tag::EXEC_INST)
243    }
244
245
246
247
248    /// Sets `ExpireTime`, Tag 126.
249    pub fn set_expire_time(&mut self, v: Timestamp) {
250        self.message.body.set_field(tag::EXPIRE_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
251            time: v,
252            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
253        });
254    }
255
256    /// Gets `ExpireTime`, Tag 126.
257    pub fn get_expire_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
258        let mut fld = field::ExpireTimeField::new(Timestamp::UNIX_EPOCH);
259        self.message.body.get_field(tag::EXPIRE_TIME, &mut fld.0)?;
260        Ok(fld.value())
261    }
262
263
264    /// Returns true if `ExpireTime` is present, Tag 126.
265    pub fn has_expire_time(&self) -> bool {
266        self.message.body.has(tag::EXPIRE_TIME)
267    }
268
269
270
271
272    /// Sets `ForexReq`, Tag 121.
273    pub fn set_forex_req(&mut self, v: bool) {
274        self.message.body.set_field(tag::FOREX_REQ, fixer::fix_boolean::FIXBoolean::from(v));
275    }
276
277    /// Gets `ForexReq`, Tag 121.
278    pub fn get_forex_req(&self) -> Result<bool, MessageRejectErrorEnum> {
279        let mut fld = field::ForexReqField::new(false);
280        self.message.body.get_field(tag::FOREX_REQ, &mut fld.0)?;
281        Ok(fld.value())
282    }
283
284
285    /// Returns true if `ForexReq` is present, Tag 121.
286    pub fn has_forex_req(&self) -> bool {
287        self.message.body.has(tag::FOREX_REQ)
288    }
289
290
291
292
293    /// Sets `FutSettDate`, Tag 64.
294    pub fn set_fut_sett_date(&mut self, v: String) {
295        self.message.body.set_field(tag::FUT_SETT_DATE, FIXString::from(v));
296    }
297
298    /// Gets `FutSettDate`, Tag 64.
299    pub fn get_fut_sett_date(&self) -> Result<String, MessageRejectErrorEnum> {
300        let mut fld = field::FutSettDateField::new(String::new());
301        self.message.body.get_field(tag::FUT_SETT_DATE, &mut fld.0)?;
302        Ok(fld.value().to_string())
303    }
304
305
306    /// Returns true if `FutSettDate` is present, Tag 64.
307    pub fn has_fut_sett_date(&self) -> bool {
308        self.message.body.has(tag::FUT_SETT_DATE)
309    }
310
311
312
313
314    /// Sets `HandlInst`, Tag 21.
315    pub fn set_handl_inst(&mut self, v: String) {
316        self.message.body.set_field(tag::HANDL_INST, FIXString::from(v));
317    }
318
319    /// Gets `HandlInst`, Tag 21.
320    pub fn get_handl_inst(&self) -> Result<String, MessageRejectErrorEnum> {
321        let mut fld = field::HandlInstField::new(String::new());
322        self.message.body.get_field(tag::HANDL_INST, &mut fld.0)?;
323        Ok(fld.value().to_string())
324    }
325
326
327    /// Returns true if `HandlInst` is present, Tag 21.
328    pub fn has_handl_inst(&self) -> bool {
329        self.message.body.has(tag::HANDL_INST)
330    }
331
332
333
334
335    /// Sets `IDSource`, Tag 22.
336    pub fn set_id_source(&mut self, v: String) {
337        self.message.body.set_field(tag::ID_SOURCE, FIXString::from(v));
338    }
339
340    /// Gets `IDSource`, Tag 22.
341    pub fn get_id_source(&self) -> Result<String, MessageRejectErrorEnum> {
342        let mut fld = field::IDSourceField::new(String::new());
343        self.message.body.get_field(tag::ID_SOURCE, &mut fld.0)?;
344        Ok(fld.value().to_string())
345    }
346
347
348    /// Returns true if `IDSource` is present, Tag 22.
349    pub fn has_id_source(&self) -> bool {
350        self.message.body.has(tag::ID_SOURCE)
351    }
352
353
354
355
356    /// Sets `IOIid`, Tag 23.
357    pub fn set_io_iid(&mut self, v: String) {
358        self.message.body.set_field(tag::IO_IID, FIXString::from(v));
359    }
360
361    /// Gets `IOIid`, Tag 23.
362    pub fn get_io_iid(&self) -> Result<String, MessageRejectErrorEnum> {
363        let mut fld = field::IOIidField::new(String::new());
364        self.message.body.get_field(tag::IO_IID, &mut fld.0)?;
365        Ok(fld.value().to_string())
366    }
367
368
369    /// Returns true if `IOIid` is present, Tag 23.
370    pub fn has_io_iid(&self) -> bool {
371        self.message.body.has(tag::IO_IID)
372    }
373
374
375
376
377    /// Sets `Issuer`, Tag 106.
378    pub fn set_issuer(&mut self, v: String) {
379        self.message.body.set_field(tag::ISSUER, FIXString::from(v));
380    }
381
382    /// Gets `Issuer`, Tag 106.
383    pub fn get_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
384        let mut fld = field::IssuerField::new(String::new());
385        self.message.body.get_field(tag::ISSUER, &mut fld.0)?;
386        Ok(fld.value().to_string())
387    }
388
389
390    /// Returns true if `Issuer` is present, Tag 106.
391    pub fn has_issuer(&self) -> bool {
392        self.message.body.has(tag::ISSUER)
393    }
394
395
396
397
398    /// Sets `LocateReqd`, Tag 114.
399    pub fn set_locate_reqd(&mut self, v: bool) {
400        self.message.body.set_field(tag::LOCATE_REQD, fixer::fix_boolean::FIXBoolean::from(v));
401    }
402
403    /// Gets `LocateReqd`, Tag 114.
404    pub fn get_locate_reqd(&self) -> Result<bool, MessageRejectErrorEnum> {
405        let mut fld = field::LocateReqdField::new(false);
406        self.message.body.get_field(tag::LOCATE_REQD, &mut fld.0)?;
407        Ok(fld.value())
408    }
409
410
411    /// Returns true if `LocateReqd` is present, Tag 114.
412    pub fn has_locate_reqd(&self) -> bool {
413        self.message.body.has(tag::LOCATE_REQD)
414    }
415
416
417
418
419    /// Sets `MaxFloor`, Tag 111.
420    pub fn set_max_floor(&mut self, val: Decimal, scale: i32) {
421        self.message.body.set_field(tag::MAX_FLOOR, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
422    }
423
424    /// Gets `MaxFloor`, Tag 111.
425    pub fn get_max_floor(&self) -> Result<Decimal, MessageRejectErrorEnum> {
426        let mut fld = field::MaxFloorField::new(Decimal::ZERO, 0);
427        self.message.body.get_field(tag::MAX_FLOOR, &mut fld.0)?;
428        Ok(fld.value())
429    }
430
431
432    /// Returns true if `MaxFloor` is present, Tag 111.
433    pub fn has_max_floor(&self) -> bool {
434        self.message.body.has(tag::MAX_FLOOR)
435    }
436
437
438
439
440    /// Sets `MinQty`, Tag 110.
441    pub fn set_min_qty(&mut self, val: Decimal, scale: i32) {
442        self.message.body.set_field(tag::MIN_QTY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
443    }
444
445    /// Gets `MinQty`, Tag 110.
446    pub fn get_min_qty(&self) -> Result<Decimal, MessageRejectErrorEnum> {
447        let mut fld = field::MinQtyField::new(Decimal::ZERO, 0);
448        self.message.body.get_field(tag::MIN_QTY, &mut fld.0)?;
449        Ok(fld.value())
450    }
451
452
453    /// Returns true if `MinQty` is present, Tag 110.
454    pub fn has_min_qty(&self) -> bool {
455        self.message.body.has(tag::MIN_QTY)
456    }
457
458
459
460
461    /// Sets `OrdType`, Tag 40.
462    pub fn set_ord_type(&mut self, v: String) {
463        self.message.body.set_field(tag::ORD_TYPE, FIXString::from(v));
464    }
465
466    /// Gets `OrdType`, Tag 40.
467    pub fn get_ord_type(&self) -> Result<String, MessageRejectErrorEnum> {
468        let mut fld = field::OrdTypeField::new(String::new());
469        self.message.body.get_field(tag::ORD_TYPE, &mut fld.0)?;
470        Ok(fld.value().to_string())
471    }
472
473
474    /// Returns true if `OrdType` is present, Tag 40.
475    pub fn has_ord_type(&self) -> bool {
476        self.message.body.has(tag::ORD_TYPE)
477    }
478
479
480
481
482    /// Sets `OrderQty`, Tag 38.
483    pub fn set_order_qty(&mut self, val: Decimal, scale: i32) {
484        self.message.body.set_field(tag::ORDER_QTY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
485    }
486
487    /// Gets `OrderQty`, Tag 38.
488    pub fn get_order_qty(&self) -> Result<Decimal, MessageRejectErrorEnum> {
489        let mut fld = field::OrderQtyField::new(Decimal::ZERO, 0);
490        self.message.body.get_field(tag::ORDER_QTY, &mut fld.0)?;
491        Ok(fld.value())
492    }
493
494
495    /// Returns true if `OrderQty` is present, Tag 38.
496    pub fn has_order_qty(&self) -> bool {
497        self.message.body.has(tag::ORDER_QTY)
498    }
499
500
501
502
503    /// Sets `PrevClosePx`, Tag 140.
504    pub fn set_prev_close_px(&mut self, val: Decimal, scale: i32) {
505        self.message.body.set_field(tag::PREV_CLOSE_PX, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
506    }
507
508    /// Gets `PrevClosePx`, Tag 140.
509    pub fn get_prev_close_px(&self) -> Result<Decimal, MessageRejectErrorEnum> {
510        let mut fld = field::PrevClosePxField::new(Decimal::ZERO, 0);
511        self.message.body.get_field(tag::PREV_CLOSE_PX, &mut fld.0)?;
512        Ok(fld.value())
513    }
514
515
516    /// Returns true if `PrevClosePx` is present, Tag 140.
517    pub fn has_prev_close_px(&self) -> bool {
518        self.message.body.has(tag::PREV_CLOSE_PX)
519    }
520
521
522
523
524    /// Sets `Price`, Tag 44.
525    pub fn set_price(&mut self, val: Decimal, scale: i32) {
526        self.message.body.set_field(tag::PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
527    }
528
529    /// Gets `Price`, Tag 44.
530    pub fn get_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
531        let mut fld = field::PriceField::new(Decimal::ZERO, 0);
532        self.message.body.get_field(tag::PRICE, &mut fld.0)?;
533        Ok(fld.value())
534    }
535
536
537    /// Returns true if `Price` is present, Tag 44.
538    pub fn has_price(&self) -> bool {
539        self.message.body.has(tag::PRICE)
540    }
541
542
543
544
545    /// Sets `ProcessCode`, Tag 81.
546    pub fn set_process_code(&mut self, v: String) {
547        self.message.body.set_field(tag::PROCESS_CODE, FIXString::from(v));
548    }
549
550    /// Gets `ProcessCode`, Tag 81.
551    pub fn get_process_code(&self) -> Result<String, MessageRejectErrorEnum> {
552        let mut fld = field::ProcessCodeField::new(String::new());
553        self.message.body.get_field(tag::PROCESS_CODE, &mut fld.0)?;
554        Ok(fld.value().to_string())
555    }
556
557
558    /// Returns true if `ProcessCode` is present, Tag 81.
559    pub fn has_process_code(&self) -> bool {
560        self.message.body.has(tag::PROCESS_CODE)
561    }
562
563
564
565
566    /// Sets `QuoteID`, Tag 117.
567    pub fn set_quote_id(&mut self, v: String) {
568        self.message.body.set_field(tag::QUOTE_ID, FIXString::from(v));
569    }
570
571    /// Gets `QuoteID`, Tag 117.
572    pub fn get_quote_id(&self) -> Result<String, MessageRejectErrorEnum> {
573        let mut fld = field::QuoteIDField::new(String::new());
574        self.message.body.get_field(tag::QUOTE_ID, &mut fld.0)?;
575        Ok(fld.value().to_string())
576    }
577
578
579    /// Returns true if `QuoteID` is present, Tag 117.
580    pub fn has_quote_id(&self) -> bool {
581        self.message.body.has(tag::QUOTE_ID)
582    }
583
584
585
586
587    /// Sets `Rule80A`, Tag 47.
588    pub fn set_rule80_a(&mut self, v: String) {
589        self.message.body.set_field(tag::RULE80_A, FIXString::from(v));
590    }
591
592    /// Gets `Rule80A`, Tag 47.
593    pub fn get_rule80_a(&self) -> Result<String, MessageRejectErrorEnum> {
594        let mut fld = field::Rule80AField::new(String::new());
595        self.message.body.get_field(tag::RULE80_A, &mut fld.0)?;
596        Ok(fld.value().to_string())
597    }
598
599
600    /// Returns true if `Rule80A` is present, Tag 47.
601    pub fn has_rule80_a(&self) -> bool {
602        self.message.body.has(tag::RULE80_A)
603    }
604
605
606
607
608    /// Sets `SecurityDesc`, Tag 107.
609    pub fn set_security_desc(&mut self, v: String) {
610        self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
611    }
612
613    /// Gets `SecurityDesc`, Tag 107.
614    pub fn get_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
615        let mut fld = field::SecurityDescField::new(String::new());
616        self.message.body.get_field(tag::SECURITY_DESC, &mut fld.0)?;
617        Ok(fld.value().to_string())
618    }
619
620
621    /// Returns true if `SecurityDesc` is present, Tag 107.
622    pub fn has_security_desc(&self) -> bool {
623        self.message.body.has(tag::SECURITY_DESC)
624    }
625
626
627
628
629    /// Sets `SecurityID`, Tag 48.
630    pub fn set_security_id(&mut self, v: String) {
631        self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
632    }
633
634    /// Gets `SecurityID`, Tag 48.
635    pub fn get_security_id(&self) -> Result<String, MessageRejectErrorEnum> {
636        let mut fld = field::SecurityIDField::new(String::new());
637        self.message.body.get_field(tag::SECURITY_ID, &mut fld.0)?;
638        Ok(fld.value().to_string())
639    }
640
641
642    /// Returns true if `SecurityID` is present, Tag 48.
643    pub fn has_security_id(&self) -> bool {
644        self.message.body.has(tag::SECURITY_ID)
645    }
646
647
648
649
650    /// Sets `SettlCurrency`, Tag 120.
651    pub fn set_settl_currency(&mut self, v: String) {
652        self.message.body.set_field(tag::SETTL_CURRENCY, FIXString::from(v));
653    }
654
655    /// Gets `SettlCurrency`, Tag 120.
656    pub fn get_settl_currency(&self) -> Result<String, MessageRejectErrorEnum> {
657        let mut fld = field::SettlCurrencyField::new(String::new());
658        self.message.body.get_field(tag::SETTL_CURRENCY, &mut fld.0)?;
659        Ok(fld.value().to_string())
660    }
661
662
663    /// Returns true if `SettlCurrency` is present, Tag 120.
664    pub fn has_settl_currency(&self) -> bool {
665        self.message.body.has(tag::SETTL_CURRENCY)
666    }
667
668
669
670
671    /// Sets `SettlmntTyp`, Tag 63.
672    pub fn set_settlmnt_typ(&mut self, v: String) {
673        self.message.body.set_field(tag::SETTLMNT_TYP, FIXString::from(v));
674    }
675
676    /// Gets `SettlmntTyp`, Tag 63.
677    pub fn get_settlmnt_typ(&self) -> Result<String, MessageRejectErrorEnum> {
678        let mut fld = field::SettlmntTypField::new(String::new());
679        self.message.body.get_field(tag::SETTLMNT_TYP, &mut fld.0)?;
680        Ok(fld.value().to_string())
681    }
682
683
684    /// Returns true if `SettlmntTyp` is present, Tag 63.
685    pub fn has_settlmnt_typ(&self) -> bool {
686        self.message.body.has(tag::SETTLMNT_TYP)
687    }
688
689
690
691
692    /// Sets `Side`, Tag 54.
693    pub fn set_side(&mut self, v: String) {
694        self.message.body.set_field(tag::SIDE, FIXString::from(v));
695    }
696
697    /// Gets `Side`, Tag 54.
698    pub fn get_side(&self) -> Result<String, MessageRejectErrorEnum> {
699        let mut fld = field::SideField::new(String::new());
700        self.message.body.get_field(tag::SIDE, &mut fld.0)?;
701        Ok(fld.value().to_string())
702    }
703
704
705    /// Returns true if `Side` is present, Tag 54.
706    pub fn has_side(&self) -> bool {
707        self.message.body.has(tag::SIDE)
708    }
709
710
711
712
713    /// Sets `StopPx`, Tag 99.
714    pub fn set_stop_px(&mut self, val: Decimal, scale: i32) {
715        self.message.body.set_field(tag::STOP_PX, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
716    }
717
718    /// Gets `StopPx`, Tag 99.
719    pub fn get_stop_px(&self) -> Result<Decimal, MessageRejectErrorEnum> {
720        let mut fld = field::StopPxField::new(Decimal::ZERO, 0);
721        self.message.body.get_field(tag::STOP_PX, &mut fld.0)?;
722        Ok(fld.value())
723    }
724
725
726    /// Returns true if `StopPx` is present, Tag 99.
727    pub fn has_stop_px(&self) -> bool {
728        self.message.body.has(tag::STOP_PX)
729    }
730
731
732
733
734    /// Sets `Symbol`, Tag 55.
735    pub fn set_symbol(&mut self, v: String) {
736        self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
737    }
738
739    /// Gets `Symbol`, Tag 55.
740    pub fn get_symbol(&self) -> Result<String, MessageRejectErrorEnum> {
741        let mut fld = field::SymbolField::new(String::new());
742        self.message.body.get_field(tag::SYMBOL, &mut fld.0)?;
743        Ok(fld.value().to_string())
744    }
745
746
747    /// Returns true if `Symbol` is present, Tag 55.
748    pub fn has_symbol(&self) -> bool {
749        self.message.body.has(tag::SYMBOL)
750    }
751
752
753
754
755    /// Sets `SymbolSfx`, Tag 65.
756    pub fn set_symbol_sfx(&mut self, v: String) {
757        self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
758    }
759
760    /// Gets `SymbolSfx`, Tag 65.
761    pub fn get_symbol_sfx(&self) -> Result<String, MessageRejectErrorEnum> {
762        let mut fld = field::SymbolSfxField::new(String::new());
763        self.message.body.get_field(tag::SYMBOL_SFX, &mut fld.0)?;
764        Ok(fld.value().to_string())
765    }
766
767
768    /// Returns true if `SymbolSfx` is present, Tag 65.
769    pub fn has_symbol_sfx(&self) -> bool {
770        self.message.body.has(tag::SYMBOL_SFX)
771    }
772
773
774
775
776    /// Sets `Text`, Tag 58.
777    pub fn set_text(&mut self, v: String) {
778        self.message.body.set_field(tag::TEXT, FIXString::from(v));
779    }
780
781    /// Gets `Text`, Tag 58.
782    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
783        let mut fld = field::TextField::new(String::new());
784        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
785        Ok(fld.value().to_string())
786    }
787
788
789    /// Returns true if `Text` is present, Tag 58.
790    pub fn has_text(&self) -> bool {
791        self.message.body.has(tag::TEXT)
792    }
793
794
795
796
797    /// Sets `TimeInForce`, Tag 59.
798    pub fn set_time_in_force(&mut self, v: String) {
799        self.message.body.set_field(tag::TIME_IN_FORCE, FIXString::from(v));
800    }
801
802    /// Gets `TimeInForce`, Tag 59.
803    pub fn get_time_in_force(&self) -> Result<String, MessageRejectErrorEnum> {
804        let mut fld = field::TimeInForceField::new(String::new());
805        self.message.body.get_field(tag::TIME_IN_FORCE, &mut fld.0)?;
806        Ok(fld.value().to_string())
807    }
808
809
810    /// Returns true if `TimeInForce` is present, Tag 59.
811    pub fn has_time_in_force(&self) -> bool {
812        self.message.body.has(tag::TIME_IN_FORCE)
813    }
814
815
816}
817
818/// `RouteOut` is the callback type for routing `NewOrderSingle` messages.
819pub type RouteOut = fn(msg: NewOrderSingle, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
820
821/// Route type returned by the `route` function.
822pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
823
824/// Returns the begin string, message type, and route function for `NewOrderSingle`.
825pub fn route(router: RouteOut) -> Route {
826    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
827        router(NewOrderSingle::from_message(msg.clone()), session_id)
828    };
829    ("FIX.4.0", "D", Box::new(r))
830}