Skip to main content

fixer_fix/fix42/
allocation.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/// `Allocation` is the `fix42` `Allocation` type, `MsgType` = J.
21pub struct Allocation {
22    pub message: Message,
23}
24
25impl Allocation {
26    /// Creates a new `Allocation` with required fields.
27    pub fn new(alloc_id: field::AllocIDField, alloc_trans_type: field::AllocTransTypeField, side: field::SideField, symbol: field::SymbolField, shares: field::SharesField, avg_px: field::AvgPxField, trade_date: field::TradeDateField) -> Self {
28        let mut msg = Message::new();
29        msg.header.set_field(tag::MSG_TYPE, FIXString::from("J".to_string()));
30
31        msg.body.set_field(tag::ALLOC_ID, alloc_id.0);
32
33        msg.body.set_field(tag::ALLOC_TRANS_TYPE, alloc_trans_type.0);
34
35        msg.body.set_field(tag::SIDE, side.0);
36
37        msg.body.set_field(tag::SYMBOL, symbol.0);
38
39        msg.body.set_field(tag::SHARES, shares.0);
40
41        msg.body.set_field(tag::AVG_PX, avg_px.0);
42
43        msg.body.set_field(tag::TRADE_DATE, trade_date.0);
44
45        Self { message: msg }
46    }
47
48    /// Creates a `Allocation` from an existing `Message`.
49    pub fn from_message(msg: Message) -> Self {
50        Self { message: msg }
51    }
52
53    /// Returns the underlying `Message`.
54    pub fn to_message(self) -> Message {
55        self.message
56    }
57
58
59
60
61    /// Sets `AccruedInterestRate`, Tag 158.
62    pub fn set_accrued_interest_rate(&mut self, val: Decimal, scale: i32) {
63        self.message.body.set_field(tag::ACCRUED_INTEREST_RATE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
64    }
65
66    /// Gets `AccruedInterestRate`, Tag 158.
67    pub fn get_accrued_interest_rate(&self) -> Result<Decimal, MessageRejectErrorEnum> {
68        let mut fld = field::AccruedInterestRateField::new(Decimal::ZERO, 0);
69        self.message.body.get_field(tag::ACCRUED_INTEREST_RATE, &mut fld.0)?;
70        Ok(fld.value())
71    }
72
73
74    /// Returns true if `AccruedInterestRate` is present, Tag 158.
75    pub fn has_accrued_interest_rate(&self) -> bool {
76        self.message.body.has(tag::ACCRUED_INTEREST_RATE)
77    }
78
79
80
81
82    /// Sets `AllocID`, Tag 70.
83    pub fn set_alloc_id(&mut self, v: String) {
84        self.message.body.set_field(tag::ALLOC_ID, FIXString::from(v));
85    }
86
87    /// Gets `AllocID`, Tag 70.
88    pub fn get_alloc_id(&self) -> Result<String, MessageRejectErrorEnum> {
89        let mut fld = field::AllocIDField::new(String::new());
90        self.message.body.get_field(tag::ALLOC_ID, &mut fld.0)?;
91        Ok(fld.value().to_string())
92    }
93
94
95    /// Returns true if `AllocID` is present, Tag 70.
96    pub fn has_alloc_id(&self) -> bool {
97        self.message.body.has(tag::ALLOC_ID)
98    }
99
100
101
102
103    /// Sets `AllocLinkID`, Tag 196.
104    pub fn set_alloc_link_id(&mut self, v: String) {
105        self.message.body.set_field(tag::ALLOC_LINK_ID, FIXString::from(v));
106    }
107
108    /// Gets `AllocLinkID`, Tag 196.
109    pub fn get_alloc_link_id(&self) -> Result<String, MessageRejectErrorEnum> {
110        let mut fld = field::AllocLinkIDField::new(String::new());
111        self.message.body.get_field(tag::ALLOC_LINK_ID, &mut fld.0)?;
112        Ok(fld.value().to_string())
113    }
114
115
116    /// Returns true if `AllocLinkID` is present, Tag 196.
117    pub fn has_alloc_link_id(&self) -> bool {
118        self.message.body.has(tag::ALLOC_LINK_ID)
119    }
120
121
122
123
124    /// Sets `AllocLinkType`, Tag 197.
125    pub fn set_alloc_link_type(&mut self, v: isize) {
126        self.message.body.set_field(tag::ALLOC_LINK_TYPE, fixer::fix_int::FIXInt::from(v));
127    }
128
129    /// Gets `AllocLinkType`, Tag 197.
130    pub fn get_alloc_link_type(&self) -> Result<isize, MessageRejectErrorEnum> {
131        let mut fld = field::AllocLinkTypeField::new(0);
132        self.message.body.get_field(tag::ALLOC_LINK_TYPE, &mut fld.0)?;
133        Ok(fld.value())
134    }
135
136
137    /// Returns true if `AllocLinkType` is present, Tag 197.
138    pub fn has_alloc_link_type(&self) -> bool {
139        self.message.body.has(tag::ALLOC_LINK_TYPE)
140    }
141
142
143
144
145    /// Sets `AllocTransType`, Tag 71.
146    pub fn set_alloc_trans_type(&mut self, v: String) {
147        self.message.body.set_field(tag::ALLOC_TRANS_TYPE, FIXString::from(v));
148    }
149
150    /// Gets `AllocTransType`, Tag 71.
151    pub fn get_alloc_trans_type(&self) -> Result<String, MessageRejectErrorEnum> {
152        let mut fld = field::AllocTransTypeField::new(String::new());
153        self.message.body.get_field(tag::ALLOC_TRANS_TYPE, &mut fld.0)?;
154        Ok(fld.value().to_string())
155    }
156
157
158    /// Returns true if `AllocTransType` is present, Tag 71.
159    pub fn has_alloc_trans_type(&self) -> bool {
160        self.message.body.has(tag::ALLOC_TRANS_TYPE)
161    }
162
163
164
165
166    /// Sets `AvgPrxPrecision`, Tag 74.
167    pub fn set_avg_prx_precision(&mut self, v: isize) {
168        self.message.body.set_field(tag::AVG_PRX_PRECISION, fixer::fix_int::FIXInt::from(v));
169    }
170
171    /// Gets `AvgPrxPrecision`, Tag 74.
172    pub fn get_avg_prx_precision(&self) -> Result<isize, MessageRejectErrorEnum> {
173        let mut fld = field::AvgPrxPrecisionField::new(0);
174        self.message.body.get_field(tag::AVG_PRX_PRECISION, &mut fld.0)?;
175        Ok(fld.value())
176    }
177
178
179    /// Returns true if `AvgPrxPrecision` is present, Tag 74.
180    pub fn has_avg_prx_precision(&self) -> bool {
181        self.message.body.has(tag::AVG_PRX_PRECISION)
182    }
183
184
185
186
187    /// Sets `AvgPx`, Tag 6.
188    pub fn set_avg_px(&mut self, val: Decimal, scale: i32) {
189        self.message.body.set_field(tag::AVG_PX, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
190    }
191
192    /// Gets `AvgPx`, Tag 6.
193    pub fn get_avg_px(&self) -> Result<Decimal, MessageRejectErrorEnum> {
194        let mut fld = field::AvgPxField::new(Decimal::ZERO, 0);
195        self.message.body.get_field(tag::AVG_PX, &mut fld.0)?;
196        Ok(fld.value())
197    }
198
199
200    /// Returns true if `AvgPx` is present, Tag 6.
201    pub fn has_avg_px(&self) -> bool {
202        self.message.body.has(tag::AVG_PX)
203    }
204
205
206
207
208    /// Sets `ContractMultiplier`, Tag 231.
209    pub fn set_contract_multiplier(&mut self, val: Decimal, scale: i32) {
210        self.message.body.set_field(tag::CONTRACT_MULTIPLIER, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
211    }
212
213    /// Gets `ContractMultiplier`, Tag 231.
214    pub fn get_contract_multiplier(&self) -> Result<Decimal, MessageRejectErrorEnum> {
215        let mut fld = field::ContractMultiplierField::new(Decimal::ZERO, 0);
216        self.message.body.get_field(tag::CONTRACT_MULTIPLIER, &mut fld.0)?;
217        Ok(fld.value())
218    }
219
220
221    /// Returns true if `ContractMultiplier` is present, Tag 231.
222    pub fn has_contract_multiplier(&self) -> bool {
223        self.message.body.has(tag::CONTRACT_MULTIPLIER)
224    }
225
226
227
228
229    /// Sets `CouponRate`, Tag 223.
230    pub fn set_coupon_rate(&mut self, val: Decimal, scale: i32) {
231        self.message.body.set_field(tag::COUPON_RATE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
232    }
233
234    /// Gets `CouponRate`, Tag 223.
235    pub fn get_coupon_rate(&self) -> Result<Decimal, MessageRejectErrorEnum> {
236        let mut fld = field::CouponRateField::new(Decimal::ZERO, 0);
237        self.message.body.get_field(tag::COUPON_RATE, &mut fld.0)?;
238        Ok(fld.value())
239    }
240
241
242    /// Returns true if `CouponRate` is present, Tag 223.
243    pub fn has_coupon_rate(&self) -> bool {
244        self.message.body.has(tag::COUPON_RATE)
245    }
246
247
248
249
250    /// Sets `Currency`, Tag 15.
251    pub fn set_currency(&mut self, v: String) {
252        self.message.body.set_field(tag::CURRENCY, FIXString::from(v));
253    }
254
255    /// Gets `Currency`, Tag 15.
256    pub fn get_currency(&self) -> Result<String, MessageRejectErrorEnum> {
257        let mut fld = field::CurrencyField::new(String::new());
258        self.message.body.get_field(tag::CURRENCY, &mut fld.0)?;
259        Ok(fld.value().to_string())
260    }
261
262
263    /// Returns true if `Currency` is present, Tag 15.
264    pub fn has_currency(&self) -> bool {
265        self.message.body.has(tag::CURRENCY)
266    }
267
268
269
270
271    /// Sets `EncodedIssuer`, Tag 349.
272    pub fn set_encoded_issuer(&mut self, v: String) {
273        self.message.body.set_field(tag::ENCODED_ISSUER, FIXString::from(v));
274    }
275
276    /// Gets `EncodedIssuer`, Tag 349.
277    pub fn get_encoded_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
278        let mut fld = field::EncodedIssuerField::new(String::new());
279        self.message.body.get_field(tag::ENCODED_ISSUER, &mut fld.0)?;
280        Ok(fld.value().to_string())
281    }
282
283
284    /// Returns true if `EncodedIssuer` is present, Tag 349.
285    pub fn has_encoded_issuer(&self) -> bool {
286        self.message.body.has(tag::ENCODED_ISSUER)
287    }
288
289
290
291
292    /// Sets `EncodedIssuerLen`, Tag 348.
293    pub fn set_encoded_issuer_len(&mut self, v: isize) {
294        self.message.body.set_field(tag::ENCODED_ISSUER_LEN, fixer::fix_int::FIXInt::from(v));
295    }
296
297    /// Gets `EncodedIssuerLen`, Tag 348.
298    pub fn get_encoded_issuer_len(&self) -> Result<isize, MessageRejectErrorEnum> {
299        let mut fld = field::EncodedIssuerLenField::new(0);
300        self.message.body.get_field(tag::ENCODED_ISSUER_LEN, &mut fld.0)?;
301        Ok(fld.value())
302    }
303
304
305    /// Returns true if `EncodedIssuerLen` is present, Tag 348.
306    pub fn has_encoded_issuer_len(&self) -> bool {
307        self.message.body.has(tag::ENCODED_ISSUER_LEN)
308    }
309
310
311
312
313    /// Sets `EncodedSecurityDesc`, Tag 351.
314    pub fn set_encoded_security_desc(&mut self, v: String) {
315        self.message.body.set_field(tag::ENCODED_SECURITY_DESC, FIXString::from(v));
316    }
317
318    /// Gets `EncodedSecurityDesc`, Tag 351.
319    pub fn get_encoded_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
320        let mut fld = field::EncodedSecurityDescField::new(String::new());
321        self.message.body.get_field(tag::ENCODED_SECURITY_DESC, &mut fld.0)?;
322        Ok(fld.value().to_string())
323    }
324
325
326    /// Returns true if `EncodedSecurityDesc` is present, Tag 351.
327    pub fn has_encoded_security_desc(&self) -> bool {
328        self.message.body.has(tag::ENCODED_SECURITY_DESC)
329    }
330
331
332
333
334    /// Sets `EncodedSecurityDescLen`, Tag 350.
335    pub fn set_encoded_security_desc_len(&mut self, v: isize) {
336        self.message.body.set_field(tag::ENCODED_SECURITY_DESC_LEN, fixer::fix_int::FIXInt::from(v));
337    }
338
339    /// Gets `EncodedSecurityDescLen`, Tag 350.
340    pub fn get_encoded_security_desc_len(&self) -> Result<isize, MessageRejectErrorEnum> {
341        let mut fld = field::EncodedSecurityDescLenField::new(0);
342        self.message.body.get_field(tag::ENCODED_SECURITY_DESC_LEN, &mut fld.0)?;
343        Ok(fld.value())
344    }
345
346
347    /// Returns true if `EncodedSecurityDescLen` is present, Tag 350.
348    pub fn has_encoded_security_desc_len(&self) -> bool {
349        self.message.body.has(tag::ENCODED_SECURITY_DESC_LEN)
350    }
351
352
353
354
355    /// Sets `EncodedText`, Tag 355.
356    pub fn set_encoded_text(&mut self, v: String) {
357        self.message.body.set_field(tag::ENCODED_TEXT, FIXString::from(v));
358    }
359
360    /// Gets `EncodedText`, Tag 355.
361    pub fn get_encoded_text(&self) -> Result<String, MessageRejectErrorEnum> {
362        let mut fld = field::EncodedTextField::new(String::new());
363        self.message.body.get_field(tag::ENCODED_TEXT, &mut fld.0)?;
364        Ok(fld.value().to_string())
365    }
366
367
368    /// Returns true if `EncodedText` is present, Tag 355.
369    pub fn has_encoded_text(&self) -> bool {
370        self.message.body.has(tag::ENCODED_TEXT)
371    }
372
373
374
375
376    /// Sets `EncodedTextLen`, Tag 354.
377    pub fn set_encoded_text_len(&mut self, v: isize) {
378        self.message.body.set_field(tag::ENCODED_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
379    }
380
381    /// Gets `EncodedTextLen`, Tag 354.
382    pub fn get_encoded_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
383        let mut fld = field::EncodedTextLenField::new(0);
384        self.message.body.get_field(tag::ENCODED_TEXT_LEN, &mut fld.0)?;
385        Ok(fld.value())
386    }
387
388
389    /// Returns true if `EncodedTextLen` is present, Tag 354.
390    pub fn has_encoded_text_len(&self) -> bool {
391        self.message.body.has(tag::ENCODED_TEXT_LEN)
392    }
393
394
395
396
397    /// Sets `FutSettDate`, Tag 64.
398    pub fn set_fut_sett_date(&mut self, v: String) {
399        self.message.body.set_field(tag::FUT_SETT_DATE, FIXString::from(v));
400    }
401
402    /// Gets `FutSettDate`, Tag 64.
403    pub fn get_fut_sett_date(&self) -> Result<String, MessageRejectErrorEnum> {
404        let mut fld = field::FutSettDateField::new(String::new());
405        self.message.body.get_field(tag::FUT_SETT_DATE, &mut fld.0)?;
406        Ok(fld.value().to_string())
407    }
408
409
410    /// Returns true if `FutSettDate` is present, Tag 64.
411    pub fn has_fut_sett_date(&self) -> bool {
412        self.message.body.has(tag::FUT_SETT_DATE)
413    }
414
415
416
417
418    /// Sets `GrossTradeAmt`, Tag 381.
419    pub fn set_gross_trade_amt(&mut self, val: Decimal, scale: i32) {
420        self.message.body.set_field(tag::GROSS_TRADE_AMT, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
421    }
422
423    /// Gets `GrossTradeAmt`, Tag 381.
424    pub fn get_gross_trade_amt(&self) -> Result<Decimal, MessageRejectErrorEnum> {
425        let mut fld = field::GrossTradeAmtField::new(Decimal::ZERO, 0);
426        self.message.body.get_field(tag::GROSS_TRADE_AMT, &mut fld.0)?;
427        Ok(fld.value())
428    }
429
430
431    /// Returns true if `GrossTradeAmt` is present, Tag 381.
432    pub fn has_gross_trade_amt(&self) -> bool {
433        self.message.body.has(tag::GROSS_TRADE_AMT)
434    }
435
436
437
438
439    /// Sets `IDSource`, Tag 22.
440    pub fn set_id_source(&mut self, v: String) {
441        self.message.body.set_field(tag::ID_SOURCE, FIXString::from(v));
442    }
443
444    /// Gets `IDSource`, Tag 22.
445    pub fn get_id_source(&self) -> Result<String, MessageRejectErrorEnum> {
446        let mut fld = field::IDSourceField::new(String::new());
447        self.message.body.get_field(tag::ID_SOURCE, &mut fld.0)?;
448        Ok(fld.value().to_string())
449    }
450
451
452    /// Returns true if `IDSource` is present, Tag 22.
453    pub fn has_id_source(&self) -> bool {
454        self.message.body.has(tag::ID_SOURCE)
455    }
456
457
458
459
460    /// Sets `Issuer`, Tag 106.
461    pub fn set_issuer(&mut self, v: String) {
462        self.message.body.set_field(tag::ISSUER, FIXString::from(v));
463    }
464
465    /// Gets `Issuer`, Tag 106.
466    pub fn get_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
467        let mut fld = field::IssuerField::new(String::new());
468        self.message.body.get_field(tag::ISSUER, &mut fld.0)?;
469        Ok(fld.value().to_string())
470    }
471
472
473    /// Returns true if `Issuer` is present, Tag 106.
474    pub fn has_issuer(&self) -> bool {
475        self.message.body.has(tag::ISSUER)
476    }
477
478
479
480
481    /// Sets `LastMkt`, Tag 30.
482    pub fn set_last_mkt(&mut self, v: String) {
483        self.message.body.set_field(tag::LAST_MKT, FIXString::from(v));
484    }
485
486    /// Gets `LastMkt`, Tag 30.
487    pub fn get_last_mkt(&self) -> Result<String, MessageRejectErrorEnum> {
488        let mut fld = field::LastMktField::new(String::new());
489        self.message.body.get_field(tag::LAST_MKT, &mut fld.0)?;
490        Ok(fld.value().to_string())
491    }
492
493
494    /// Returns true if `LastMkt` is present, Tag 30.
495    pub fn has_last_mkt(&self) -> bool {
496        self.message.body.has(tag::LAST_MKT)
497    }
498
499
500
501
502    /// Sets `MaturityDay`, Tag 205.
503    pub fn set_maturity_day(&mut self, v: isize) {
504        self.message.body.set_field(tag::MATURITY_DAY, fixer::fix_int::FIXInt::from(v));
505    }
506
507    /// Gets `MaturityDay`, Tag 205.
508    pub fn get_maturity_day(&self) -> Result<isize, MessageRejectErrorEnum> {
509        let mut fld = field::MaturityDayField::new(0);
510        self.message.body.get_field(tag::MATURITY_DAY, &mut fld.0)?;
511        Ok(fld.value())
512    }
513
514
515    /// Returns true if `MaturityDay` is present, Tag 205.
516    pub fn has_maturity_day(&self) -> bool {
517        self.message.body.has(tag::MATURITY_DAY)
518    }
519
520
521
522
523    /// Sets `MaturityMonthYear`, Tag 200.
524    pub fn set_maturity_month_year(&mut self, v: String) {
525        self.message.body.set_field(tag::MATURITY_MONTH_YEAR, FIXString::from(v));
526    }
527
528    /// Gets `MaturityMonthYear`, Tag 200.
529    pub fn get_maturity_month_year(&self) -> Result<String, MessageRejectErrorEnum> {
530        let mut fld = field::MaturityMonthYearField::new(String::new());
531        self.message.body.get_field(tag::MATURITY_MONTH_YEAR, &mut fld.0)?;
532        Ok(fld.value().to_string())
533    }
534
535
536    /// Returns true if `MaturityMonthYear` is present, Tag 200.
537    pub fn has_maturity_month_year(&self) -> bool {
538        self.message.body.has(tag::MATURITY_MONTH_YEAR)
539    }
540
541
542
543
544    /// Sets `NetMoney`, Tag 118.
545    pub fn set_net_money(&mut self, val: Decimal, scale: i32) {
546        self.message.body.set_field(tag::NET_MONEY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
547    }
548
549    /// Gets `NetMoney`, Tag 118.
550    pub fn get_net_money(&self) -> Result<Decimal, MessageRejectErrorEnum> {
551        let mut fld = field::NetMoneyField::new(Decimal::ZERO, 0);
552        self.message.body.get_field(tag::NET_MONEY, &mut fld.0)?;
553        Ok(fld.value())
554    }
555
556
557    /// Returns true if `NetMoney` is present, Tag 118.
558    pub fn has_net_money(&self) -> bool {
559        self.message.body.has(tag::NET_MONEY)
560    }
561
562
563
564
565    /// Sets `NoAllocs`, Tag 78.
566    pub fn set_no_allocs(&mut self, v: isize) {
567        self.message.body.set_field(tag::NO_ALLOCS, fixer::fix_int::FIXInt::from(v));
568    }
569
570    /// Gets `NoAllocs`, Tag 78.
571    pub fn get_no_allocs(&self) -> Result<isize, MessageRejectErrorEnum> {
572        let mut fld = field::NoAllocsField::new(0);
573        self.message.body.get_field(tag::NO_ALLOCS, &mut fld.0)?;
574        Ok(fld.value())
575    }
576
577
578    /// Returns true if `NoAllocs` is present, Tag 78.
579    pub fn has_no_allocs(&self) -> bool {
580        self.message.body.has(tag::NO_ALLOCS)
581    }
582
583
584
585
586    /// Sets `NoExecs`, Tag 124.
587    pub fn set_no_execs(&mut self, v: isize) {
588        self.message.body.set_field(tag::NO_EXECS, fixer::fix_int::FIXInt::from(v));
589    }
590
591    /// Gets `NoExecs`, Tag 124.
592    pub fn get_no_execs(&self) -> Result<isize, MessageRejectErrorEnum> {
593        let mut fld = field::NoExecsField::new(0);
594        self.message.body.get_field(tag::NO_EXECS, &mut fld.0)?;
595        Ok(fld.value())
596    }
597
598
599    /// Returns true if `NoExecs` is present, Tag 124.
600    pub fn has_no_execs(&self) -> bool {
601        self.message.body.has(tag::NO_EXECS)
602    }
603
604
605
606
607    /// Sets `NoOrders`, Tag 73.
608    pub fn set_no_orders(&mut self, v: isize) {
609        self.message.body.set_field(tag::NO_ORDERS, fixer::fix_int::FIXInt::from(v));
610    }
611
612    /// Gets `NoOrders`, Tag 73.
613    pub fn get_no_orders(&self) -> Result<isize, MessageRejectErrorEnum> {
614        let mut fld = field::NoOrdersField::new(0);
615        self.message.body.get_field(tag::NO_ORDERS, &mut fld.0)?;
616        Ok(fld.value())
617    }
618
619
620    /// Returns true if `NoOrders` is present, Tag 73.
621    pub fn has_no_orders(&self) -> bool {
622        self.message.body.has(tag::NO_ORDERS)
623    }
624
625
626
627
628    /// Sets `NumDaysInterest`, Tag 157.
629    pub fn set_num_days_interest(&mut self, v: isize) {
630        self.message.body.set_field(tag::NUM_DAYS_INTEREST, fixer::fix_int::FIXInt::from(v));
631    }
632
633    /// Gets `NumDaysInterest`, Tag 157.
634    pub fn get_num_days_interest(&self) -> Result<isize, MessageRejectErrorEnum> {
635        let mut fld = field::NumDaysInterestField::new(0);
636        self.message.body.get_field(tag::NUM_DAYS_INTEREST, &mut fld.0)?;
637        Ok(fld.value())
638    }
639
640
641    /// Returns true if `NumDaysInterest` is present, Tag 157.
642    pub fn has_num_days_interest(&self) -> bool {
643        self.message.body.has(tag::NUM_DAYS_INTEREST)
644    }
645
646
647
648
649    /// Sets `OpenClose`, Tag 77.
650    pub fn set_open_close(&mut self, v: String) {
651        self.message.body.set_field(tag::OPEN_CLOSE, FIXString::from(v));
652    }
653
654    /// Gets `OpenClose`, Tag 77.
655    pub fn get_open_close(&self) -> Result<String, MessageRejectErrorEnum> {
656        let mut fld = field::OpenCloseField::new(String::new());
657        self.message.body.get_field(tag::OPEN_CLOSE, &mut fld.0)?;
658        Ok(fld.value().to_string())
659    }
660
661
662    /// Returns true if `OpenClose` is present, Tag 77.
663    pub fn has_open_close(&self) -> bool {
664        self.message.body.has(tag::OPEN_CLOSE)
665    }
666
667
668
669
670    /// Sets `OptAttribute`, Tag 206.
671    pub fn set_opt_attribute(&mut self, v: String) {
672        self.message.body.set_field(tag::OPT_ATTRIBUTE, FIXString::from(v));
673    }
674
675    /// Gets `OptAttribute`, Tag 206.
676    pub fn get_opt_attribute(&self) -> Result<String, MessageRejectErrorEnum> {
677        let mut fld = field::OptAttributeField::new(String::new());
678        self.message.body.get_field(tag::OPT_ATTRIBUTE, &mut fld.0)?;
679        Ok(fld.value().to_string())
680    }
681
682
683    /// Returns true if `OptAttribute` is present, Tag 206.
684    pub fn has_opt_attribute(&self) -> bool {
685        self.message.body.has(tag::OPT_ATTRIBUTE)
686    }
687
688
689
690
691    /// Sets `PutOrCall`, Tag 201.
692    pub fn set_put_or_call(&mut self, v: isize) {
693        self.message.body.set_field(tag::PUT_OR_CALL, fixer::fix_int::FIXInt::from(v));
694    }
695
696    /// Gets `PutOrCall`, Tag 201.
697    pub fn get_put_or_call(&self) -> Result<isize, MessageRejectErrorEnum> {
698        let mut fld = field::PutOrCallField::new(0);
699        self.message.body.get_field(tag::PUT_OR_CALL, &mut fld.0)?;
700        Ok(fld.value())
701    }
702
703
704    /// Returns true if `PutOrCall` is present, Tag 201.
705    pub fn has_put_or_call(&self) -> bool {
706        self.message.body.has(tag::PUT_OR_CALL)
707    }
708
709
710
711
712    /// Sets `RefAllocID`, Tag 72.
713    pub fn set_ref_alloc_id(&mut self, v: String) {
714        self.message.body.set_field(tag::REF_ALLOC_ID, FIXString::from(v));
715    }
716
717    /// Gets `RefAllocID`, Tag 72.
718    pub fn get_ref_alloc_id(&self) -> Result<String, MessageRejectErrorEnum> {
719        let mut fld = field::RefAllocIDField::new(String::new());
720        self.message.body.get_field(tag::REF_ALLOC_ID, &mut fld.0)?;
721        Ok(fld.value().to_string())
722    }
723
724
725    /// Returns true if `RefAllocID` is present, Tag 72.
726    pub fn has_ref_alloc_id(&self) -> bool {
727        self.message.body.has(tag::REF_ALLOC_ID)
728    }
729
730
731
732
733    /// Sets `SecurityDesc`, Tag 107.
734    pub fn set_security_desc(&mut self, v: String) {
735        self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
736    }
737
738    /// Gets `SecurityDesc`, Tag 107.
739    pub fn get_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
740        let mut fld = field::SecurityDescField::new(String::new());
741        self.message.body.get_field(tag::SECURITY_DESC, &mut fld.0)?;
742        Ok(fld.value().to_string())
743    }
744
745
746    /// Returns true if `SecurityDesc` is present, Tag 107.
747    pub fn has_security_desc(&self) -> bool {
748        self.message.body.has(tag::SECURITY_DESC)
749    }
750
751
752
753
754    /// Sets `SecurityExchange`, Tag 207.
755    pub fn set_security_exchange(&mut self, v: String) {
756        self.message.body.set_field(tag::SECURITY_EXCHANGE, FIXString::from(v));
757    }
758
759    /// Gets `SecurityExchange`, Tag 207.
760    pub fn get_security_exchange(&self) -> Result<String, MessageRejectErrorEnum> {
761        let mut fld = field::SecurityExchangeField::new(String::new());
762        self.message.body.get_field(tag::SECURITY_EXCHANGE, &mut fld.0)?;
763        Ok(fld.value().to_string())
764    }
765
766
767    /// Returns true if `SecurityExchange` is present, Tag 207.
768    pub fn has_security_exchange(&self) -> bool {
769        self.message.body.has(tag::SECURITY_EXCHANGE)
770    }
771
772
773
774
775    /// Sets `SecurityID`, Tag 48.
776    pub fn set_security_id(&mut self, v: String) {
777        self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
778    }
779
780    /// Gets `SecurityID`, Tag 48.
781    pub fn get_security_id(&self) -> Result<String, MessageRejectErrorEnum> {
782        let mut fld = field::SecurityIDField::new(String::new());
783        self.message.body.get_field(tag::SECURITY_ID, &mut fld.0)?;
784        Ok(fld.value().to_string())
785    }
786
787
788    /// Returns true if `SecurityID` is present, Tag 48.
789    pub fn has_security_id(&self) -> bool {
790        self.message.body.has(tag::SECURITY_ID)
791    }
792
793
794
795
796    /// Sets `SecurityType`, Tag 167.
797    pub fn set_security_type(&mut self, v: String) {
798        self.message.body.set_field(tag::SECURITY_TYPE, FIXString::from(v));
799    }
800
801    /// Gets `SecurityType`, Tag 167.
802    pub fn get_security_type(&self) -> Result<String, MessageRejectErrorEnum> {
803        let mut fld = field::SecurityTypeField::new(String::new());
804        self.message.body.get_field(tag::SECURITY_TYPE, &mut fld.0)?;
805        Ok(fld.value().to_string())
806    }
807
808
809    /// Returns true if `SecurityType` is present, Tag 167.
810    pub fn has_security_type(&self) -> bool {
811        self.message.body.has(tag::SECURITY_TYPE)
812    }
813
814
815
816
817    /// Sets `SettlmntTyp`, Tag 63.
818    pub fn set_settlmnt_typ(&mut self, v: String) {
819        self.message.body.set_field(tag::SETTLMNT_TYP, FIXString::from(v));
820    }
821
822    /// Gets `SettlmntTyp`, Tag 63.
823    pub fn get_settlmnt_typ(&self) -> Result<String, MessageRejectErrorEnum> {
824        let mut fld = field::SettlmntTypField::new(String::new());
825        self.message.body.get_field(tag::SETTLMNT_TYP, &mut fld.0)?;
826        Ok(fld.value().to_string())
827    }
828
829
830    /// Returns true if `SettlmntTyp` is present, Tag 63.
831    pub fn has_settlmnt_typ(&self) -> bool {
832        self.message.body.has(tag::SETTLMNT_TYP)
833    }
834
835
836
837
838    /// Sets `Shares`, Tag 53.
839    pub fn set_shares(&mut self, val: Decimal, scale: i32) {
840        self.message.body.set_field(tag::SHARES, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
841    }
842
843    /// Gets `Shares`, Tag 53.
844    pub fn get_shares(&self) -> Result<Decimal, MessageRejectErrorEnum> {
845        let mut fld = field::SharesField::new(Decimal::ZERO, 0);
846        self.message.body.get_field(tag::SHARES, &mut fld.0)?;
847        Ok(fld.value())
848    }
849
850
851    /// Returns true if `Shares` is present, Tag 53.
852    pub fn has_shares(&self) -> bool {
853        self.message.body.has(tag::SHARES)
854    }
855
856
857
858
859    /// Sets `Side`, Tag 54.
860    pub fn set_side(&mut self, v: String) {
861        self.message.body.set_field(tag::SIDE, FIXString::from(v));
862    }
863
864    /// Gets `Side`, Tag 54.
865    pub fn get_side(&self) -> Result<String, MessageRejectErrorEnum> {
866        let mut fld = field::SideField::new(String::new());
867        self.message.body.get_field(tag::SIDE, &mut fld.0)?;
868        Ok(fld.value().to_string())
869    }
870
871
872    /// Returns true if `Side` is present, Tag 54.
873    pub fn has_side(&self) -> bool {
874        self.message.body.has(tag::SIDE)
875    }
876
877
878
879
880    /// Sets `StrikePrice`, Tag 202.
881    pub fn set_strike_price(&mut self, val: Decimal, scale: i32) {
882        self.message.body.set_field(tag::STRIKE_PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
883    }
884
885    /// Gets `StrikePrice`, Tag 202.
886    pub fn get_strike_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
887        let mut fld = field::StrikePriceField::new(Decimal::ZERO, 0);
888        self.message.body.get_field(tag::STRIKE_PRICE, &mut fld.0)?;
889        Ok(fld.value())
890    }
891
892
893    /// Returns true if `StrikePrice` is present, Tag 202.
894    pub fn has_strike_price(&self) -> bool {
895        self.message.body.has(tag::STRIKE_PRICE)
896    }
897
898
899
900
901    /// Sets `Symbol`, Tag 55.
902    pub fn set_symbol(&mut self, v: String) {
903        self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
904    }
905
906    /// Gets `Symbol`, Tag 55.
907    pub fn get_symbol(&self) -> Result<String, MessageRejectErrorEnum> {
908        let mut fld = field::SymbolField::new(String::new());
909        self.message.body.get_field(tag::SYMBOL, &mut fld.0)?;
910        Ok(fld.value().to_string())
911    }
912
913
914    /// Returns true if `Symbol` is present, Tag 55.
915    pub fn has_symbol(&self) -> bool {
916        self.message.body.has(tag::SYMBOL)
917    }
918
919
920
921
922    /// Sets `SymbolSfx`, Tag 65.
923    pub fn set_symbol_sfx(&mut self, v: String) {
924        self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
925    }
926
927    /// Gets `SymbolSfx`, Tag 65.
928    pub fn get_symbol_sfx(&self) -> Result<String, MessageRejectErrorEnum> {
929        let mut fld = field::SymbolSfxField::new(String::new());
930        self.message.body.get_field(tag::SYMBOL_SFX, &mut fld.0)?;
931        Ok(fld.value().to_string())
932    }
933
934
935    /// Returns true if `SymbolSfx` is present, Tag 65.
936    pub fn has_symbol_sfx(&self) -> bool {
937        self.message.body.has(tag::SYMBOL_SFX)
938    }
939
940
941
942
943    /// Sets `Text`, Tag 58.
944    pub fn set_text(&mut self, v: String) {
945        self.message.body.set_field(tag::TEXT, FIXString::from(v));
946    }
947
948    /// Gets `Text`, Tag 58.
949    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
950        let mut fld = field::TextField::new(String::new());
951        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
952        Ok(fld.value().to_string())
953    }
954
955
956    /// Returns true if `Text` is present, Tag 58.
957    pub fn has_text(&self) -> bool {
958        self.message.body.has(tag::TEXT)
959    }
960
961
962
963
964    /// Sets `TradeDate`, Tag 75.
965    pub fn set_trade_date(&mut self, v: String) {
966        self.message.body.set_field(tag::TRADE_DATE, FIXString::from(v));
967    }
968
969    /// Gets `TradeDate`, Tag 75.
970    pub fn get_trade_date(&self) -> Result<String, MessageRejectErrorEnum> {
971        let mut fld = field::TradeDateField::new(String::new());
972        self.message.body.get_field(tag::TRADE_DATE, &mut fld.0)?;
973        Ok(fld.value().to_string())
974    }
975
976
977    /// Returns true if `TradeDate` is present, Tag 75.
978    pub fn has_trade_date(&self) -> bool {
979        self.message.body.has(tag::TRADE_DATE)
980    }
981
982
983
984
985    /// Sets `TradingSessionID`, Tag 336.
986    pub fn set_trading_session_id(&mut self, v: String) {
987        self.message.body.set_field(tag::TRADING_SESSION_ID, FIXString::from(v));
988    }
989
990    /// Gets `TradingSessionID`, Tag 336.
991    pub fn get_trading_session_id(&self) -> Result<String, MessageRejectErrorEnum> {
992        let mut fld = field::TradingSessionIDField::new(String::new());
993        self.message.body.get_field(tag::TRADING_SESSION_ID, &mut fld.0)?;
994        Ok(fld.value().to_string())
995    }
996
997
998    /// Returns true if `TradingSessionID` is present, Tag 336.
999    pub fn has_trading_session_id(&self) -> bool {
1000        self.message.body.has(tag::TRADING_SESSION_ID)
1001    }
1002
1003
1004
1005
1006    /// Sets `TransactTime`, Tag 60.
1007    pub fn set_transact_time(&mut self, v: Timestamp) {
1008        self.message.body.set_field(tag::TRANSACT_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
1009            time: v,
1010            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
1011        });
1012    }
1013
1014    /// Gets `TransactTime`, Tag 60.
1015    pub fn get_transact_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
1016        let mut fld = field::TransactTimeField::new(Timestamp::UNIX_EPOCH);
1017        self.message.body.get_field(tag::TRANSACT_TIME, &mut fld.0)?;
1018        Ok(fld.value())
1019    }
1020
1021
1022    /// Returns true if `TransactTime` is present, Tag 60.
1023    pub fn has_transact_time(&self) -> bool {
1024        self.message.body.has(tag::TRANSACT_TIME)
1025    }
1026
1027
1028}
1029
1030/// `RouteOut` is the callback type for routing `Allocation` messages.
1031pub type RouteOut = fn(msg: Allocation, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
1032
1033/// Route type returned by the `route` function.
1034pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
1035
1036/// Returns the begin string, message type, and route function for `Allocation`.
1037pub fn route(router: RouteOut) -> Route {
1038    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
1039        router(Allocation::from_message(msg.clone()), session_id)
1040    };
1041    ("FIX.4.2", "J", Box::new(r))
1042}