1#![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
20pub struct NewOrderSingle {
22 pub message: Message,
23}
24
25impl NewOrderSingle {
26 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 pub fn from_message(msg: Message) -> Self {
46 Self { message: msg }
47 }
48
49 pub fn to_message(self) -> Message {
51 self.message
52 }
53
54
55
56
57 pub fn set_account(&mut self, v: String) {
59 self.message.body.set_field(tag::ACCOUNT, FIXString::from(v));
60 }
61
62 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 pub fn has_account(&self) -> bool {
72 self.message.body.has(tag::ACCOUNT)
73 }
74
75
76
77
78 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 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 pub fn has_cash_order_qty(&self) -> bool {
93 self.message.body.has(tag::CASH_ORDER_QTY)
94 }
95
96
97
98
99 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 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 pub fn has_cl_ord_id(&self) -> bool {
114 self.message.body.has(tag::CL_ORD_ID)
115 }
116
117
118
119
120 pub fn set_client_id(&mut self, v: String) {
122 self.message.body.set_field(tag::CLIENT_ID, FIXString::from(v));
123 }
124
125 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 pub fn has_client_id(&self) -> bool {
135 self.message.body.has(tag::CLIENT_ID)
136 }
137
138
139
140
141 pub fn set_comm_type(&mut self, v: String) {
143 self.message.body.set_field(tag::COMM_TYPE, FIXString::from(v));
144 }
145
146 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 pub fn has_comm_type(&self) -> bool {
156 self.message.body.has(tag::COMM_TYPE)
157 }
158
159
160
161
162 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 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 pub fn has_commission(&self) -> bool {
177 self.message.body.has(tag::COMMISSION)
178 }
179
180
181
182
183 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 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 pub fn has_covered_or_uncovered(&self) -> bool {
198 self.message.body.has(tag::COVERED_OR_UNCOVERED)
199 }
200
201
202
203
204 pub fn set_currency(&mut self, v: String) {
206 self.message.body.set_field(tag::CURRENCY, FIXString::from(v));
207 }
208
209 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 pub fn has_currency(&self) -> bool {
219 self.message.body.has(tag::CURRENCY)
220 }
221
222
223
224
225 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 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 pub fn has_customer_or_firm(&self) -> bool {
240 self.message.body.has(tag::CUSTOMER_OR_FIRM)
241 }
242
243
244
245
246 pub fn set_ex_destination(&mut self, v: String) {
248 self.message.body.set_field(tag::EX_DESTINATION, FIXString::from(v));
249 }
250
251 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 pub fn has_ex_destination(&self) -> bool {
261 self.message.body.has(tag::EX_DESTINATION)
262 }
263
264
265
266
267 pub fn set_exec_broker(&mut self, v: String) {
269 self.message.body.set_field(tag::EXEC_BROKER, FIXString::from(v));
270 }
271
272 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 pub fn has_exec_broker(&self) -> bool {
282 self.message.body.has(tag::EXEC_BROKER)
283 }
284
285
286
287
288 pub fn set_exec_inst(&mut self, v: String) {
290 self.message.body.set_field(tag::EXEC_INST, FIXString::from(v));
291 }
292
293 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 pub fn has_exec_inst(&self) -> bool {
303 self.message.body.has(tag::EXEC_INST)
304 }
305
306
307
308
309 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 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 pub fn has_expire_time(&self) -> bool {
327 self.message.body.has(tag::EXPIRE_TIME)
328 }
329
330
331
332
333 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 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 pub fn has_forex_req(&self) -> bool {
348 self.message.body.has(tag::FOREX_REQ)
349 }
350
351
352
353
354 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 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 pub fn has_fut_sett_date(&self) -> bool {
369 self.message.body.has(tag::FUT_SETT_DATE)
370 }
371
372
373
374
375 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 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 pub fn has_fut_sett_date2(&self) -> bool {
390 self.message.body.has(tag::FUT_SETT_DATE2)
391 }
392
393
394
395
396 pub fn set_handl_inst(&mut self, v: String) {
398 self.message.body.set_field(tag::HANDL_INST, FIXString::from(v));
399 }
400
401 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 pub fn has_handl_inst(&self) -> bool {
411 self.message.body.has(tag::HANDL_INST)
412 }
413
414
415
416
417 pub fn set_id_source(&mut self, v: String) {
419 self.message.body.set_field(tag::ID_SOURCE, FIXString::from(v));
420 }
421
422 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 pub fn has_id_source(&self) -> bool {
432 self.message.body.has(tag::ID_SOURCE)
433 }
434
435
436
437
438 pub fn set_io_iid(&mut self, v: String) {
440 self.message.body.set_field(tag::IO_IID, FIXString::from(v));
441 }
442
443 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 pub fn has_io_iid(&self) -> bool {
453 self.message.body.has(tag::IO_IID)
454 }
455
456
457
458
459 pub fn set_issuer(&mut self, v: String) {
461 self.message.body.set_field(tag::ISSUER, FIXString::from(v));
462 }
463
464 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 pub fn has_issuer(&self) -> bool {
474 self.message.body.has(tag::ISSUER)
475 }
476
477
478
479
480 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 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 pub fn has_locate_reqd(&self) -> bool {
495 self.message.body.has(tag::LOCATE_REQD)
496 }
497
498
499
500
501 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 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 pub fn has_maturity_day(&self) -> bool {
516 self.message.body.has(tag::MATURITY_DAY)
517 }
518
519
520
521
522 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 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 pub fn has_maturity_month_year(&self) -> bool {
537 self.message.body.has(tag::MATURITY_MONTH_YEAR)
538 }
539
540
541
542
543 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 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 pub fn has_max_floor(&self) -> bool {
558 self.message.body.has(tag::MAX_FLOOR)
559 }
560
561
562
563
564 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 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 pub fn has_max_show(&self) -> bool {
579 self.message.body.has(tag::MAX_SHOW)
580 }
581
582
583
584
585 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 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 pub fn has_min_qty(&self) -> bool {
600 self.message.body.has(tag::MIN_QTY)
601 }
602
603
604
605
606 pub fn set_open_close(&mut self, v: String) {
608 self.message.body.set_field(tag::OPEN_CLOSE, FIXString::from(v));
609 }
610
611 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 pub fn has_open_close(&self) -> bool {
621 self.message.body.has(tag::OPEN_CLOSE)
622 }
623
624
625
626
627 pub fn set_opt_attribute(&mut self, v: String) {
629 self.message.body.set_field(tag::OPT_ATTRIBUTE, FIXString::from(v));
630 }
631
632 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 pub fn has_opt_attribute(&self) -> bool {
642 self.message.body.has(tag::OPT_ATTRIBUTE)
643 }
644
645
646
647
648 pub fn set_ord_type(&mut self, v: String) {
650 self.message.body.set_field(tag::ORD_TYPE, FIXString::from(v));
651 }
652
653 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 pub fn has_ord_type(&self) -> bool {
663 self.message.body.has(tag::ORD_TYPE)
664 }
665
666
667
668
669 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 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 pub fn has_order_qty(&self) -> bool {
684 self.message.body.has(tag::ORDER_QTY)
685 }
686
687
688
689
690 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 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 pub fn has_order_qty2(&self) -> bool {
705 self.message.body.has(tag::ORDER_QTY2)
706 }
707
708
709
710
711 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 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 pub fn has_peg_difference(&self) -> bool {
726 self.message.body.has(tag::PEG_DIFFERENCE)
727 }
728
729
730
731
732 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 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 pub fn has_prev_close_px(&self) -> bool {
747 self.message.body.has(tag::PREV_CLOSE_PX)
748 }
749
750
751
752
753 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 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 pub fn has_price(&self) -> bool {
768 self.message.body.has(tag::PRICE)
769 }
770
771
772
773
774 pub fn set_process_code(&mut self, v: String) {
776 self.message.body.set_field(tag::PROCESS_CODE, FIXString::from(v));
777 }
778
779 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 pub fn has_process_code(&self) -> bool {
789 self.message.body.has(tag::PROCESS_CODE)
790 }
791
792
793
794
795 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 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 pub fn has_put_or_call(&self) -> bool {
810 self.message.body.has(tag::PUT_OR_CALL)
811 }
812
813
814
815
816 pub fn set_quote_id(&mut self, v: String) {
818 self.message.body.set_field(tag::QUOTE_ID, FIXString::from(v));
819 }
820
821 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 pub fn has_quote_id(&self) -> bool {
831 self.message.body.has(tag::QUOTE_ID)
832 }
833
834
835
836
837 pub fn set_rule80_a(&mut self, v: String) {
839 self.message.body.set_field(tag::RULE80_A, FIXString::from(v));
840 }
841
842 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 pub fn has_rule80_a(&self) -> bool {
852 self.message.body.has(tag::RULE80_A)
853 }
854
855
856
857
858 pub fn set_security_desc(&mut self, v: String) {
860 self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
861 }
862
863 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 pub fn has_security_desc(&self) -> bool {
873 self.message.body.has(tag::SECURITY_DESC)
874 }
875
876
877
878
879 pub fn set_security_exchange(&mut self, v: String) {
881 self.message.body.set_field(tag::SECURITY_EXCHANGE, FIXString::from(v));
882 }
883
884 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 pub fn has_security_exchange(&self) -> bool {
894 self.message.body.has(tag::SECURITY_EXCHANGE)
895 }
896
897
898
899
900 pub fn set_security_id(&mut self, v: String) {
902 self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
903 }
904
905 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 pub fn has_security_id(&self) -> bool {
915 self.message.body.has(tag::SECURITY_ID)
916 }
917
918
919
920
921 pub fn set_security_type(&mut self, v: String) {
923 self.message.body.set_field(tag::SECURITY_TYPE, FIXString::from(v));
924 }
925
926 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 pub fn has_security_type(&self) -> bool {
936 self.message.body.has(tag::SECURITY_TYPE)
937 }
938
939
940
941
942 pub fn set_settl_currency(&mut self, v: String) {
944 self.message.body.set_field(tag::SETTL_CURRENCY, FIXString::from(v));
945 }
946
947 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 pub fn has_settl_currency(&self) -> bool {
957 self.message.body.has(tag::SETTL_CURRENCY)
958 }
959
960
961
962
963 pub fn set_settlmnt_typ(&mut self, v: String) {
965 self.message.body.set_field(tag::SETTLMNT_TYP, FIXString::from(v));
966 }
967
968 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 pub fn has_settlmnt_typ(&self) -> bool {
978 self.message.body.has(tag::SETTLMNT_TYP)
979 }
980
981
982
983
984 pub fn set_side(&mut self, v: String) {
986 self.message.body.set_field(tag::SIDE, FIXString::from(v));
987 }
988
989 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 pub fn has_side(&self) -> bool {
999 self.message.body.has(tag::SIDE)
1000 }
1001
1002
1003
1004
1005 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 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 pub fn has_stop_px(&self) -> bool {
1020 self.message.body.has(tag::STOP_PX)
1021 }
1022
1023
1024
1025
1026 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 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 pub fn has_strike_price(&self) -> bool {
1041 self.message.body.has(tag::STRIKE_PRICE)
1042 }
1043
1044
1045
1046
1047 pub fn set_symbol(&mut self, v: String) {
1049 self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
1050 }
1051
1052 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 pub fn has_symbol(&self) -> bool {
1062 self.message.body.has(tag::SYMBOL)
1063 }
1064
1065
1066
1067
1068 pub fn set_symbol_sfx(&mut self, v: String) {
1070 self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
1071 }
1072
1073 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 pub fn has_symbol_sfx(&self) -> bool {
1083 self.message.body.has(tag::SYMBOL_SFX)
1084 }
1085
1086
1087
1088
1089 pub fn set_text(&mut self, v: String) {
1091 self.message.body.set_field(tag::TEXT, FIXString::from(v));
1092 }
1093
1094 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 pub fn has_text(&self) -> bool {
1104 self.message.body.has(tag::TEXT)
1105 }
1106
1107
1108
1109
1110 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 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 pub fn has_time_in_force(&self) -> bool {
1125 self.message.body.has(tag::TIME_IN_FORCE)
1126 }
1127
1128
1129}
1130
1131pub type RouteOut = fn(msg: NewOrderSingle, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
1133
1134pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
1136
1137pub 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}