Skip to main content

fixer_fix/fix43/
advertisement.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/// `Advertisement` is the `fix43` `Advertisement` type, `MsgType` = 7.
21pub struct Advertisement {
22    pub message: Message,
23}
24
25impl Advertisement {
26    /// Creates a new `Advertisement` with required fields.
27    pub fn new(adv_id: field::AdvIdField, adv_trans_type: field::AdvTransTypeField, adv_side: field::AdvSideField, quantity: field::QuantityField) -> Self {
28        let mut msg = Message::new();
29        msg.header.set_field(tag::MSG_TYPE, FIXString::from("7".to_string()));
30
31        msg.body.set_field(tag::ADV_ID, adv_id.0);
32
33        msg.body.set_field(tag::ADV_TRANS_TYPE, adv_trans_type.0);
34
35        msg.body.set_field(tag::ADV_SIDE, adv_side.0);
36
37        msg.body.set_field(tag::QUANTITY, quantity.0);
38
39        Self { message: msg }
40    }
41
42    /// Creates a `Advertisement` from an existing `Message`.
43    pub fn from_message(msg: Message) -> Self {
44        Self { message: msg }
45    }
46
47    /// Returns the underlying `Message`.
48    pub fn to_message(self) -> Message {
49        self.message
50    }
51
52
53
54
55    /// Sets `AdvId`, Tag 2.
56    pub fn set_adv_id(&mut self, v: String) {
57        self.message.body.set_field(tag::ADV_ID, FIXString::from(v));
58    }
59
60    /// Gets `AdvId`, Tag 2.
61    pub fn get_adv_id(&self) -> Result<String, MessageRejectErrorEnum> {
62        let mut fld = field::AdvIdField::new(String::new());
63        self.message.body.get_field(tag::ADV_ID, &mut fld.0)?;
64        Ok(fld.value().to_string())
65    }
66
67
68    /// Returns true if `AdvId` is present, Tag 2.
69    pub fn has_adv_id(&self) -> bool {
70        self.message.body.has(tag::ADV_ID)
71    }
72
73
74
75
76    /// Sets `AdvRefID`, Tag 3.
77    pub fn set_adv_ref_id(&mut self, v: String) {
78        self.message.body.set_field(tag::ADV_REF_ID, FIXString::from(v));
79    }
80
81    /// Gets `AdvRefID`, Tag 3.
82    pub fn get_adv_ref_id(&self) -> Result<String, MessageRejectErrorEnum> {
83        let mut fld = field::AdvRefIDField::new(String::new());
84        self.message.body.get_field(tag::ADV_REF_ID, &mut fld.0)?;
85        Ok(fld.value().to_string())
86    }
87
88
89    /// Returns true if `AdvRefID` is present, Tag 3.
90    pub fn has_adv_ref_id(&self) -> bool {
91        self.message.body.has(tag::ADV_REF_ID)
92    }
93
94
95
96
97    /// Sets `AdvSide`, Tag 4.
98    pub fn set_adv_side(&mut self, v: String) {
99        self.message.body.set_field(tag::ADV_SIDE, FIXString::from(v));
100    }
101
102    /// Gets `AdvSide`, Tag 4.
103    pub fn get_adv_side(&self) -> Result<String, MessageRejectErrorEnum> {
104        let mut fld = field::AdvSideField::new(String::new());
105        self.message.body.get_field(tag::ADV_SIDE, &mut fld.0)?;
106        Ok(fld.value().to_string())
107    }
108
109
110    /// Returns true if `AdvSide` is present, Tag 4.
111    pub fn has_adv_side(&self) -> bool {
112        self.message.body.has(tag::ADV_SIDE)
113    }
114
115
116
117
118    /// Sets `AdvTransType`, Tag 5.
119    pub fn set_adv_trans_type(&mut self, v: String) {
120        self.message.body.set_field(tag::ADV_TRANS_TYPE, FIXString::from(v));
121    }
122
123    /// Gets `AdvTransType`, Tag 5.
124    pub fn get_adv_trans_type(&self) -> Result<String, MessageRejectErrorEnum> {
125        let mut fld = field::AdvTransTypeField::new(String::new());
126        self.message.body.get_field(tag::ADV_TRANS_TYPE, &mut fld.0)?;
127        Ok(fld.value().to_string())
128    }
129
130
131    /// Returns true if `AdvTransType` is present, Tag 5.
132    pub fn has_adv_trans_type(&self) -> bool {
133        self.message.body.has(tag::ADV_TRANS_TYPE)
134    }
135
136
137
138
139    /// Sets `CFICode`, Tag 461.
140    pub fn set_cfi_code(&mut self, v: String) {
141        self.message.body.set_field(tag::CFI_CODE, FIXString::from(v));
142    }
143
144    /// Gets `CFICode`, Tag 461.
145    pub fn get_cfi_code(&self) -> Result<String, MessageRejectErrorEnum> {
146        let mut fld = field::CFICodeField::new(String::new());
147        self.message.body.get_field(tag::CFI_CODE, &mut fld.0)?;
148        Ok(fld.value().to_string())
149    }
150
151
152    /// Returns true if `CFICode` is present, Tag 461.
153    pub fn has_cfi_code(&self) -> bool {
154        self.message.body.has(tag::CFI_CODE)
155    }
156
157
158
159
160    /// Sets `ContractMultiplier`, Tag 231.
161    pub fn set_contract_multiplier(&mut self, val: Decimal, scale: i32) {
162        self.message.body.set_field(tag::CONTRACT_MULTIPLIER, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
163    }
164
165    /// Gets `ContractMultiplier`, Tag 231.
166    pub fn get_contract_multiplier(&self) -> Result<Decimal, MessageRejectErrorEnum> {
167        let mut fld = field::ContractMultiplierField::new(Decimal::ZERO, 0);
168        self.message.body.get_field(tag::CONTRACT_MULTIPLIER, &mut fld.0)?;
169        Ok(fld.value())
170    }
171
172
173    /// Returns true if `ContractMultiplier` is present, Tag 231.
174    pub fn has_contract_multiplier(&self) -> bool {
175        self.message.body.has(tag::CONTRACT_MULTIPLIER)
176    }
177
178
179
180
181    /// Sets `CountryOfIssue`, Tag 470.
182    pub fn set_country_of_issue(&mut self, v: String) {
183        self.message.body.set_field(tag::COUNTRY_OF_ISSUE, FIXString::from(v));
184    }
185
186    /// Gets `CountryOfIssue`, Tag 470.
187    pub fn get_country_of_issue(&self) -> Result<String, MessageRejectErrorEnum> {
188        let mut fld = field::CountryOfIssueField::new(String::new());
189        self.message.body.get_field(tag::COUNTRY_OF_ISSUE, &mut fld.0)?;
190        Ok(fld.value().to_string())
191    }
192
193
194    /// Returns true if `CountryOfIssue` is present, Tag 470.
195    pub fn has_country_of_issue(&self) -> bool {
196        self.message.body.has(tag::COUNTRY_OF_ISSUE)
197    }
198
199
200
201
202    /// Sets `CouponPaymentDate`, Tag 224.
203    pub fn set_coupon_payment_date(&mut self, v: String) {
204        self.message.body.set_field(tag::COUPON_PAYMENT_DATE, FIXString::from(v));
205    }
206
207    /// Gets `CouponPaymentDate`, Tag 224.
208    pub fn get_coupon_payment_date(&self) -> Result<String, MessageRejectErrorEnum> {
209        let mut fld = field::CouponPaymentDateField::new(String::new());
210        self.message.body.get_field(tag::COUPON_PAYMENT_DATE, &mut fld.0)?;
211        Ok(fld.value().to_string())
212    }
213
214
215    /// Returns true if `CouponPaymentDate` is present, Tag 224.
216    pub fn has_coupon_payment_date(&self) -> bool {
217        self.message.body.has(tag::COUPON_PAYMENT_DATE)
218    }
219
220
221
222
223    /// Sets `CouponRate`, Tag 223.
224    pub fn set_coupon_rate(&mut self, val: Decimal, scale: i32) {
225        self.message.body.set_field(tag::COUPON_RATE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
226    }
227
228    /// Gets `CouponRate`, Tag 223.
229    pub fn get_coupon_rate(&self) -> Result<Decimal, MessageRejectErrorEnum> {
230        let mut fld = field::CouponRateField::new(Decimal::ZERO, 0);
231        self.message.body.get_field(tag::COUPON_RATE, &mut fld.0)?;
232        Ok(fld.value())
233    }
234
235
236    /// Returns true if `CouponRate` is present, Tag 223.
237    pub fn has_coupon_rate(&self) -> bool {
238        self.message.body.has(tag::COUPON_RATE)
239    }
240
241
242
243
244    /// Sets `CreditRating`, Tag 255.
245    pub fn set_credit_rating(&mut self, v: String) {
246        self.message.body.set_field(tag::CREDIT_RATING, FIXString::from(v));
247    }
248
249    /// Gets `CreditRating`, Tag 255.
250    pub fn get_credit_rating(&self) -> Result<String, MessageRejectErrorEnum> {
251        let mut fld = field::CreditRatingField::new(String::new());
252        self.message.body.get_field(tag::CREDIT_RATING, &mut fld.0)?;
253        Ok(fld.value().to_string())
254    }
255
256
257    /// Returns true if `CreditRating` is present, Tag 255.
258    pub fn has_credit_rating(&self) -> bool {
259        self.message.body.has(tag::CREDIT_RATING)
260    }
261
262
263
264
265    /// Sets `Currency`, Tag 15.
266    pub fn set_currency(&mut self, v: String) {
267        self.message.body.set_field(tag::CURRENCY, FIXString::from(v));
268    }
269
270    /// Gets `Currency`, Tag 15.
271    pub fn get_currency(&self) -> Result<String, MessageRejectErrorEnum> {
272        let mut fld = field::CurrencyField::new(String::new());
273        self.message.body.get_field(tag::CURRENCY, &mut fld.0)?;
274        Ok(fld.value().to_string())
275    }
276
277
278    /// Returns true if `Currency` is present, Tag 15.
279    pub fn has_currency(&self) -> bool {
280        self.message.body.has(tag::CURRENCY)
281    }
282
283
284
285
286    /// Sets `EncodedIssuer`, Tag 349.
287    pub fn set_encoded_issuer(&mut self, v: String) {
288        self.message.body.set_field(tag::ENCODED_ISSUER, FIXString::from(v));
289    }
290
291    /// Gets `EncodedIssuer`, Tag 349.
292    pub fn get_encoded_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
293        let mut fld = field::EncodedIssuerField::new(String::new());
294        self.message.body.get_field(tag::ENCODED_ISSUER, &mut fld.0)?;
295        Ok(fld.value().to_string())
296    }
297
298
299    /// Returns true if `EncodedIssuer` is present, Tag 349.
300    pub fn has_encoded_issuer(&self) -> bool {
301        self.message.body.has(tag::ENCODED_ISSUER)
302    }
303
304
305
306
307    /// Sets `EncodedIssuerLen`, Tag 348.
308    pub fn set_encoded_issuer_len(&mut self, v: isize) {
309        self.message.body.set_field(tag::ENCODED_ISSUER_LEN, fixer::fix_int::FIXInt::from(v));
310    }
311
312    /// Gets `EncodedIssuerLen`, Tag 348.
313    pub fn get_encoded_issuer_len(&self) -> Result<isize, MessageRejectErrorEnum> {
314        let mut fld = field::EncodedIssuerLenField::new(0);
315        self.message.body.get_field(tag::ENCODED_ISSUER_LEN, &mut fld.0)?;
316        Ok(fld.value())
317    }
318
319
320    /// Returns true if `EncodedIssuerLen` is present, Tag 348.
321    pub fn has_encoded_issuer_len(&self) -> bool {
322        self.message.body.has(tag::ENCODED_ISSUER_LEN)
323    }
324
325
326
327
328    /// Sets `EncodedSecurityDesc`, Tag 351.
329    pub fn set_encoded_security_desc(&mut self, v: String) {
330        self.message.body.set_field(tag::ENCODED_SECURITY_DESC, FIXString::from(v));
331    }
332
333    /// Gets `EncodedSecurityDesc`, Tag 351.
334    pub fn get_encoded_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
335        let mut fld = field::EncodedSecurityDescField::new(String::new());
336        self.message.body.get_field(tag::ENCODED_SECURITY_DESC, &mut fld.0)?;
337        Ok(fld.value().to_string())
338    }
339
340
341    /// Returns true if `EncodedSecurityDesc` is present, Tag 351.
342    pub fn has_encoded_security_desc(&self) -> bool {
343        self.message.body.has(tag::ENCODED_SECURITY_DESC)
344    }
345
346
347
348
349    /// Sets `EncodedSecurityDescLen`, Tag 350.
350    pub fn set_encoded_security_desc_len(&mut self, v: isize) {
351        self.message.body.set_field(tag::ENCODED_SECURITY_DESC_LEN, fixer::fix_int::FIXInt::from(v));
352    }
353
354    /// Gets `EncodedSecurityDescLen`, Tag 350.
355    pub fn get_encoded_security_desc_len(&self) -> Result<isize, MessageRejectErrorEnum> {
356        let mut fld = field::EncodedSecurityDescLenField::new(0);
357        self.message.body.get_field(tag::ENCODED_SECURITY_DESC_LEN, &mut fld.0)?;
358        Ok(fld.value())
359    }
360
361
362    /// Returns true if `EncodedSecurityDescLen` is present, Tag 350.
363    pub fn has_encoded_security_desc_len(&self) -> bool {
364        self.message.body.has(tag::ENCODED_SECURITY_DESC_LEN)
365    }
366
367
368
369
370    /// Sets `EncodedText`, Tag 355.
371    pub fn set_encoded_text(&mut self, v: String) {
372        self.message.body.set_field(tag::ENCODED_TEXT, FIXString::from(v));
373    }
374
375    /// Gets `EncodedText`, Tag 355.
376    pub fn get_encoded_text(&self) -> Result<String, MessageRejectErrorEnum> {
377        let mut fld = field::EncodedTextField::new(String::new());
378        self.message.body.get_field(tag::ENCODED_TEXT, &mut fld.0)?;
379        Ok(fld.value().to_string())
380    }
381
382
383    /// Returns true if `EncodedText` is present, Tag 355.
384    pub fn has_encoded_text(&self) -> bool {
385        self.message.body.has(tag::ENCODED_TEXT)
386    }
387
388
389
390
391    /// Sets `EncodedTextLen`, Tag 354.
392    pub fn set_encoded_text_len(&mut self, v: isize) {
393        self.message.body.set_field(tag::ENCODED_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
394    }
395
396    /// Gets `EncodedTextLen`, Tag 354.
397    pub fn get_encoded_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
398        let mut fld = field::EncodedTextLenField::new(0);
399        self.message.body.get_field(tag::ENCODED_TEXT_LEN, &mut fld.0)?;
400        Ok(fld.value())
401    }
402
403
404    /// Returns true if `EncodedTextLen` is present, Tag 354.
405    pub fn has_encoded_text_len(&self) -> bool {
406        self.message.body.has(tag::ENCODED_TEXT_LEN)
407    }
408
409
410
411
412    /// Sets `Factor`, Tag 228.
413    pub fn set_factor(&mut self, val: Decimal, scale: i32) {
414        self.message.body.set_field(tag::FACTOR, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
415    }
416
417    /// Gets `Factor`, Tag 228.
418    pub fn get_factor(&self) -> Result<Decimal, MessageRejectErrorEnum> {
419        let mut fld = field::FactorField::new(Decimal::ZERO, 0);
420        self.message.body.get_field(tag::FACTOR, &mut fld.0)?;
421        Ok(fld.value())
422    }
423
424
425    /// Returns true if `Factor` is present, Tag 228.
426    pub fn has_factor(&self) -> bool {
427        self.message.body.has(tag::FACTOR)
428    }
429
430
431
432
433    /// Sets `InstrRegistry`, Tag 543.
434    pub fn set_instr_registry(&mut self, v: String) {
435        self.message.body.set_field(tag::INSTR_REGISTRY, FIXString::from(v));
436    }
437
438    /// Gets `InstrRegistry`, Tag 543.
439    pub fn get_instr_registry(&self) -> Result<String, MessageRejectErrorEnum> {
440        let mut fld = field::InstrRegistryField::new(String::new());
441        self.message.body.get_field(tag::INSTR_REGISTRY, &mut fld.0)?;
442        Ok(fld.value().to_string())
443    }
444
445
446    /// Returns true if `InstrRegistry` is present, Tag 543.
447    pub fn has_instr_registry(&self) -> bool {
448        self.message.body.has(tag::INSTR_REGISTRY)
449    }
450
451
452
453
454    /// Sets `IssueDate`, Tag 225.
455    pub fn set_issue_date(&mut self, v: String) {
456        self.message.body.set_field(tag::ISSUE_DATE, FIXString::from(v));
457    }
458
459    /// Gets `IssueDate`, Tag 225.
460    pub fn get_issue_date(&self) -> Result<String, MessageRejectErrorEnum> {
461        let mut fld = field::IssueDateField::new(String::new());
462        self.message.body.get_field(tag::ISSUE_DATE, &mut fld.0)?;
463        Ok(fld.value().to_string())
464    }
465
466
467    /// Returns true if `IssueDate` is present, Tag 225.
468    pub fn has_issue_date(&self) -> bool {
469        self.message.body.has(tag::ISSUE_DATE)
470    }
471
472
473
474
475    /// Sets `Issuer`, Tag 106.
476    pub fn set_issuer(&mut self, v: String) {
477        self.message.body.set_field(tag::ISSUER, FIXString::from(v));
478    }
479
480    /// Gets `Issuer`, Tag 106.
481    pub fn get_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
482        let mut fld = field::IssuerField::new(String::new());
483        self.message.body.get_field(tag::ISSUER, &mut fld.0)?;
484        Ok(fld.value().to_string())
485    }
486
487
488    /// Returns true if `Issuer` is present, Tag 106.
489    pub fn has_issuer(&self) -> bool {
490        self.message.body.has(tag::ISSUER)
491    }
492
493
494
495
496    /// Sets `LastMkt`, Tag 30.
497    pub fn set_last_mkt(&mut self, v: String) {
498        self.message.body.set_field(tag::LAST_MKT, FIXString::from(v));
499    }
500
501    /// Gets `LastMkt`, Tag 30.
502    pub fn get_last_mkt(&self) -> Result<String, MessageRejectErrorEnum> {
503        let mut fld = field::LastMktField::new(String::new());
504        self.message.body.get_field(tag::LAST_MKT, &mut fld.0)?;
505        Ok(fld.value().to_string())
506    }
507
508
509    /// Returns true if `LastMkt` is present, Tag 30.
510    pub fn has_last_mkt(&self) -> bool {
511        self.message.body.has(tag::LAST_MKT)
512    }
513
514
515
516
517    /// Sets `LocaleOfIssue`, Tag 472.
518    pub fn set_locale_of_issue(&mut self, v: String) {
519        self.message.body.set_field(tag::LOCALE_OF_ISSUE, FIXString::from(v));
520    }
521
522    /// Gets `LocaleOfIssue`, Tag 472.
523    pub fn get_locale_of_issue(&self) -> Result<String, MessageRejectErrorEnum> {
524        let mut fld = field::LocaleOfIssueField::new(String::new());
525        self.message.body.get_field(tag::LOCALE_OF_ISSUE, &mut fld.0)?;
526        Ok(fld.value().to_string())
527    }
528
529
530    /// Returns true if `LocaleOfIssue` is present, Tag 472.
531    pub fn has_locale_of_issue(&self) -> bool {
532        self.message.body.has(tag::LOCALE_OF_ISSUE)
533    }
534
535
536
537
538    /// Sets `MaturityDate`, Tag 541.
539    pub fn set_maturity_date(&mut self, v: String) {
540        self.message.body.set_field(tag::MATURITY_DATE, FIXString::from(v));
541    }
542
543    /// Gets `MaturityDate`, Tag 541.
544    pub fn get_maturity_date(&self) -> Result<String, MessageRejectErrorEnum> {
545        let mut fld = field::MaturityDateField::new(String::new());
546        self.message.body.get_field(tag::MATURITY_DATE, &mut fld.0)?;
547        Ok(fld.value().to_string())
548    }
549
550
551    /// Returns true if `MaturityDate` is present, Tag 541.
552    pub fn has_maturity_date(&self) -> bool {
553        self.message.body.has(tag::MATURITY_DATE)
554    }
555
556
557
558
559    /// Sets `MaturityMonthYear`, Tag 200.
560    pub fn set_maturity_month_year(&mut self, v: String) {
561        self.message.body.set_field(tag::MATURITY_MONTH_YEAR, FIXString::from(v));
562    }
563
564    /// Gets `MaturityMonthYear`, Tag 200.
565    pub fn get_maturity_month_year(&self) -> Result<String, MessageRejectErrorEnum> {
566        let mut fld = field::MaturityMonthYearField::new(String::new());
567        self.message.body.get_field(tag::MATURITY_MONTH_YEAR, &mut fld.0)?;
568        Ok(fld.value().to_string())
569    }
570
571
572    /// Returns true if `MaturityMonthYear` is present, Tag 200.
573    pub fn has_maturity_month_year(&self) -> bool {
574        self.message.body.has(tag::MATURITY_MONTH_YEAR)
575    }
576
577
578
579
580    /// Sets `NoSecurityAltID`, Tag 454.
581    pub fn set_no_security_alt_id(&mut self, v: isize) {
582        self.message.body.set_field(tag::NO_SECURITY_ALT_ID, fixer::fix_int::FIXInt::from(v));
583    }
584
585    /// Gets `NoSecurityAltID`, Tag 454.
586    pub fn get_no_security_alt_id(&self) -> Result<isize, MessageRejectErrorEnum> {
587        let mut fld = field::NoSecurityAltIDField::new(0);
588        self.message.body.get_field(tag::NO_SECURITY_ALT_ID, &mut fld.0)?;
589        Ok(fld.value())
590    }
591
592
593    /// Returns true if `NoSecurityAltID` is present, Tag 454.
594    pub fn has_no_security_alt_id(&self) -> bool {
595        self.message.body.has(tag::NO_SECURITY_ALT_ID)
596    }
597
598
599
600
601    /// Sets `OptAttribute`, Tag 206.
602    pub fn set_opt_attribute(&mut self, v: String) {
603        self.message.body.set_field(tag::OPT_ATTRIBUTE, FIXString::from(v));
604    }
605
606    /// Gets `OptAttribute`, Tag 206.
607    pub fn get_opt_attribute(&self) -> Result<String, MessageRejectErrorEnum> {
608        let mut fld = field::OptAttributeField::new(String::new());
609        self.message.body.get_field(tag::OPT_ATTRIBUTE, &mut fld.0)?;
610        Ok(fld.value().to_string())
611    }
612
613
614    /// Returns true if `OptAttribute` is present, Tag 206.
615    pub fn has_opt_attribute(&self) -> bool {
616        self.message.body.has(tag::OPT_ATTRIBUTE)
617    }
618
619
620
621
622    /// Sets `Price`, Tag 44.
623    pub fn set_price(&mut self, val: Decimal, scale: i32) {
624        self.message.body.set_field(tag::PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
625    }
626
627    /// Gets `Price`, Tag 44.
628    pub fn get_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
629        let mut fld = field::PriceField::new(Decimal::ZERO, 0);
630        self.message.body.get_field(tag::PRICE, &mut fld.0)?;
631        Ok(fld.value())
632    }
633
634
635    /// Returns true if `Price` is present, Tag 44.
636    pub fn has_price(&self) -> bool {
637        self.message.body.has(tag::PRICE)
638    }
639
640
641
642
643    /// Sets `Product`, Tag 460.
644    pub fn set_product(&mut self, v: isize) {
645        self.message.body.set_field(tag::PRODUCT, fixer::fix_int::FIXInt::from(v));
646    }
647
648    /// Gets `Product`, Tag 460.
649    pub fn get_product(&self) -> Result<isize, MessageRejectErrorEnum> {
650        let mut fld = field::ProductField::new(0);
651        self.message.body.get_field(tag::PRODUCT, &mut fld.0)?;
652        Ok(fld.value())
653    }
654
655
656    /// Returns true if `Product` is present, Tag 460.
657    pub fn has_product(&self) -> bool {
658        self.message.body.has(tag::PRODUCT)
659    }
660
661
662
663
664    /// Sets `Quantity`, Tag 53.
665    pub fn set_quantity(&mut self, val: Decimal, scale: i32) {
666        self.message.body.set_field(tag::QUANTITY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
667    }
668
669    /// Gets `Quantity`, Tag 53.
670    pub fn get_quantity(&self) -> Result<Decimal, MessageRejectErrorEnum> {
671        let mut fld = field::QuantityField::new(Decimal::ZERO, 0);
672        self.message.body.get_field(tag::QUANTITY, &mut fld.0)?;
673        Ok(fld.value())
674    }
675
676
677    /// Returns true if `Quantity` is present, Tag 53.
678    pub fn has_quantity(&self) -> bool {
679        self.message.body.has(tag::QUANTITY)
680    }
681
682
683
684
685    /// Sets `RedemptionDate`, Tag 240.
686    pub fn set_redemption_date(&mut self, v: String) {
687        self.message.body.set_field(tag::REDEMPTION_DATE, FIXString::from(v));
688    }
689
690    /// Gets `RedemptionDate`, Tag 240.
691    pub fn get_redemption_date(&self) -> Result<String, MessageRejectErrorEnum> {
692        let mut fld = field::RedemptionDateField::new(String::new());
693        self.message.body.get_field(tag::REDEMPTION_DATE, &mut fld.0)?;
694        Ok(fld.value().to_string())
695    }
696
697
698    /// Returns true if `RedemptionDate` is present, Tag 240.
699    pub fn has_redemption_date(&self) -> bool {
700        self.message.body.has(tag::REDEMPTION_DATE)
701    }
702
703
704
705
706    /// Sets `RepoCollateralSecurityType`, Tag 239.
707    pub fn set_repo_collateral_security_type(&mut self, v: isize) {
708        self.message.body.set_field(tag::REPO_COLLATERAL_SECURITY_TYPE, fixer::fix_int::FIXInt::from(v));
709    }
710
711    /// Gets `RepoCollateralSecurityType`, Tag 239.
712    pub fn get_repo_collateral_security_type(&self) -> Result<isize, MessageRejectErrorEnum> {
713        let mut fld = field::RepoCollateralSecurityTypeField::new(0);
714        self.message.body.get_field(tag::REPO_COLLATERAL_SECURITY_TYPE, &mut fld.0)?;
715        Ok(fld.value())
716    }
717
718
719    /// Returns true if `RepoCollateralSecurityType` is present, Tag 239.
720    pub fn has_repo_collateral_security_type(&self) -> bool {
721        self.message.body.has(tag::REPO_COLLATERAL_SECURITY_TYPE)
722    }
723
724
725
726
727    /// Sets `RepurchaseRate`, Tag 227.
728    pub fn set_repurchase_rate(&mut self, val: Decimal, scale: i32) {
729        self.message.body.set_field(tag::REPURCHASE_RATE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
730    }
731
732    /// Gets `RepurchaseRate`, Tag 227.
733    pub fn get_repurchase_rate(&self) -> Result<Decimal, MessageRejectErrorEnum> {
734        let mut fld = field::RepurchaseRateField::new(Decimal::ZERO, 0);
735        self.message.body.get_field(tag::REPURCHASE_RATE, &mut fld.0)?;
736        Ok(fld.value())
737    }
738
739
740    /// Returns true if `RepurchaseRate` is present, Tag 227.
741    pub fn has_repurchase_rate(&self) -> bool {
742        self.message.body.has(tag::REPURCHASE_RATE)
743    }
744
745
746
747
748    /// Sets `RepurchaseTerm`, Tag 226.
749    pub fn set_repurchase_term(&mut self, v: isize) {
750        self.message.body.set_field(tag::REPURCHASE_TERM, fixer::fix_int::FIXInt::from(v));
751    }
752
753    /// Gets `RepurchaseTerm`, Tag 226.
754    pub fn get_repurchase_term(&self) -> Result<isize, MessageRejectErrorEnum> {
755        let mut fld = field::RepurchaseTermField::new(0);
756        self.message.body.get_field(tag::REPURCHASE_TERM, &mut fld.0)?;
757        Ok(fld.value())
758    }
759
760
761    /// Returns true if `RepurchaseTerm` is present, Tag 226.
762    pub fn has_repurchase_term(&self) -> bool {
763        self.message.body.has(tag::REPURCHASE_TERM)
764    }
765
766
767
768
769    /// Sets `SecurityDesc`, Tag 107.
770    pub fn set_security_desc(&mut self, v: String) {
771        self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
772    }
773
774    /// Gets `SecurityDesc`, Tag 107.
775    pub fn get_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
776        let mut fld = field::SecurityDescField::new(String::new());
777        self.message.body.get_field(tag::SECURITY_DESC, &mut fld.0)?;
778        Ok(fld.value().to_string())
779    }
780
781
782    /// Returns true if `SecurityDesc` is present, Tag 107.
783    pub fn has_security_desc(&self) -> bool {
784        self.message.body.has(tag::SECURITY_DESC)
785    }
786
787
788
789
790    /// Sets `SecurityExchange`, Tag 207.
791    pub fn set_security_exchange(&mut self, v: String) {
792        self.message.body.set_field(tag::SECURITY_EXCHANGE, FIXString::from(v));
793    }
794
795    /// Gets `SecurityExchange`, Tag 207.
796    pub fn get_security_exchange(&self) -> Result<String, MessageRejectErrorEnum> {
797        let mut fld = field::SecurityExchangeField::new(String::new());
798        self.message.body.get_field(tag::SECURITY_EXCHANGE, &mut fld.0)?;
799        Ok(fld.value().to_string())
800    }
801
802
803    /// Returns true if `SecurityExchange` is present, Tag 207.
804    pub fn has_security_exchange(&self) -> bool {
805        self.message.body.has(tag::SECURITY_EXCHANGE)
806    }
807
808
809
810
811    /// Sets `SecurityID`, Tag 48.
812    pub fn set_security_id(&mut self, v: String) {
813        self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
814    }
815
816    /// Gets `SecurityID`, Tag 48.
817    pub fn get_security_id(&self) -> Result<String, MessageRejectErrorEnum> {
818        let mut fld = field::SecurityIDField::new(String::new());
819        self.message.body.get_field(tag::SECURITY_ID, &mut fld.0)?;
820        Ok(fld.value().to_string())
821    }
822
823
824    /// Returns true if `SecurityID` is present, Tag 48.
825    pub fn has_security_id(&self) -> bool {
826        self.message.body.has(tag::SECURITY_ID)
827    }
828
829
830
831
832    /// Sets `SecurityIDSource`, Tag 22.
833    pub fn set_security_id_source(&mut self, v: String) {
834        self.message.body.set_field(tag::SECURITY_ID_SOURCE, FIXString::from(v));
835    }
836
837    /// Gets `SecurityIDSource`, Tag 22.
838    pub fn get_security_id_source(&self) -> Result<String, MessageRejectErrorEnum> {
839        let mut fld = field::SecurityIDSourceField::new(String::new());
840        self.message.body.get_field(tag::SECURITY_ID_SOURCE, &mut fld.0)?;
841        Ok(fld.value().to_string())
842    }
843
844
845    /// Returns true if `SecurityIDSource` is present, Tag 22.
846    pub fn has_security_id_source(&self) -> bool {
847        self.message.body.has(tag::SECURITY_ID_SOURCE)
848    }
849
850
851
852
853    /// Sets `SecurityType`, Tag 167.
854    pub fn set_security_type(&mut self, v: String) {
855        self.message.body.set_field(tag::SECURITY_TYPE, FIXString::from(v));
856    }
857
858    /// Gets `SecurityType`, Tag 167.
859    pub fn get_security_type(&self) -> Result<String, MessageRejectErrorEnum> {
860        let mut fld = field::SecurityTypeField::new(String::new());
861        self.message.body.get_field(tag::SECURITY_TYPE, &mut fld.0)?;
862        Ok(fld.value().to_string())
863    }
864
865
866    /// Returns true if `SecurityType` is present, Tag 167.
867    pub fn has_security_type(&self) -> bool {
868        self.message.body.has(tag::SECURITY_TYPE)
869    }
870
871
872
873
874    /// Sets `StateOrProvinceOfIssue`, Tag 471.
875    pub fn set_state_or_province_of_issue(&mut self, v: String) {
876        self.message.body.set_field(tag::STATE_OR_PROVINCE_OF_ISSUE, FIXString::from(v));
877    }
878
879    /// Gets `StateOrProvinceOfIssue`, Tag 471.
880    pub fn get_state_or_province_of_issue(&self) -> Result<String, MessageRejectErrorEnum> {
881        let mut fld = field::StateOrProvinceOfIssueField::new(String::new());
882        self.message.body.get_field(tag::STATE_OR_PROVINCE_OF_ISSUE, &mut fld.0)?;
883        Ok(fld.value().to_string())
884    }
885
886
887    /// Returns true if `StateOrProvinceOfIssue` is present, Tag 471.
888    pub fn has_state_or_province_of_issue(&self) -> bool {
889        self.message.body.has(tag::STATE_OR_PROVINCE_OF_ISSUE)
890    }
891
892
893
894
895    /// Sets `StrikePrice`, Tag 202.
896    pub fn set_strike_price(&mut self, val: Decimal, scale: i32) {
897        self.message.body.set_field(tag::STRIKE_PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
898    }
899
900    /// Gets `StrikePrice`, Tag 202.
901    pub fn get_strike_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
902        let mut fld = field::StrikePriceField::new(Decimal::ZERO, 0);
903        self.message.body.get_field(tag::STRIKE_PRICE, &mut fld.0)?;
904        Ok(fld.value())
905    }
906
907
908    /// Returns true if `StrikePrice` is present, Tag 202.
909    pub fn has_strike_price(&self) -> bool {
910        self.message.body.has(tag::STRIKE_PRICE)
911    }
912
913
914
915
916    /// Sets `Symbol`, Tag 55.
917    pub fn set_symbol(&mut self, v: String) {
918        self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
919    }
920
921    /// Gets `Symbol`, Tag 55.
922    pub fn get_symbol(&self) -> Result<String, MessageRejectErrorEnum> {
923        let mut fld = field::SymbolField::new(String::new());
924        self.message.body.get_field(tag::SYMBOL, &mut fld.0)?;
925        Ok(fld.value().to_string())
926    }
927
928
929    /// Returns true if `Symbol` is present, Tag 55.
930    pub fn has_symbol(&self) -> bool {
931        self.message.body.has(tag::SYMBOL)
932    }
933
934
935
936
937    /// Sets `SymbolSfx`, Tag 65.
938    pub fn set_symbol_sfx(&mut self, v: String) {
939        self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
940    }
941
942    /// Gets `SymbolSfx`, Tag 65.
943    pub fn get_symbol_sfx(&self) -> Result<String, MessageRejectErrorEnum> {
944        let mut fld = field::SymbolSfxField::new(String::new());
945        self.message.body.get_field(tag::SYMBOL_SFX, &mut fld.0)?;
946        Ok(fld.value().to_string())
947    }
948
949
950    /// Returns true if `SymbolSfx` is present, Tag 65.
951    pub fn has_symbol_sfx(&self) -> bool {
952        self.message.body.has(tag::SYMBOL_SFX)
953    }
954
955
956
957
958    /// Sets `Text`, Tag 58.
959    pub fn set_text(&mut self, v: String) {
960        self.message.body.set_field(tag::TEXT, FIXString::from(v));
961    }
962
963    /// Gets `Text`, Tag 58.
964    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
965        let mut fld = field::TextField::new(String::new());
966        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
967        Ok(fld.value().to_string())
968    }
969
970
971    /// Returns true if `Text` is present, Tag 58.
972    pub fn has_text(&self) -> bool {
973        self.message.body.has(tag::TEXT)
974    }
975
976
977
978
979    /// Sets `TradeDate`, Tag 75.
980    pub fn set_trade_date(&mut self, v: String) {
981        self.message.body.set_field(tag::TRADE_DATE, FIXString::from(v));
982    }
983
984    /// Gets `TradeDate`, Tag 75.
985    pub fn get_trade_date(&self) -> Result<String, MessageRejectErrorEnum> {
986        let mut fld = field::TradeDateField::new(String::new());
987        self.message.body.get_field(tag::TRADE_DATE, &mut fld.0)?;
988        Ok(fld.value().to_string())
989    }
990
991
992    /// Returns true if `TradeDate` is present, Tag 75.
993    pub fn has_trade_date(&self) -> bool {
994        self.message.body.has(tag::TRADE_DATE)
995    }
996
997
998
999
1000    /// Sets `TradingSessionID`, Tag 336.
1001    pub fn set_trading_session_id(&mut self, v: String) {
1002        self.message.body.set_field(tag::TRADING_SESSION_ID, FIXString::from(v));
1003    }
1004
1005    /// Gets `TradingSessionID`, Tag 336.
1006    pub fn get_trading_session_id(&self) -> Result<String, MessageRejectErrorEnum> {
1007        let mut fld = field::TradingSessionIDField::new(String::new());
1008        self.message.body.get_field(tag::TRADING_SESSION_ID, &mut fld.0)?;
1009        Ok(fld.value().to_string())
1010    }
1011
1012
1013    /// Returns true if `TradingSessionID` is present, Tag 336.
1014    pub fn has_trading_session_id(&self) -> bool {
1015        self.message.body.has(tag::TRADING_SESSION_ID)
1016    }
1017
1018
1019
1020
1021    /// Sets `TradingSessionSubID`, Tag 625.
1022    pub fn set_trading_session_sub_id(&mut self, v: String) {
1023        self.message.body.set_field(tag::TRADING_SESSION_SUB_ID, FIXString::from(v));
1024    }
1025
1026    /// Gets `TradingSessionSubID`, Tag 625.
1027    pub fn get_trading_session_sub_id(&self) -> Result<String, MessageRejectErrorEnum> {
1028        let mut fld = field::TradingSessionSubIDField::new(String::new());
1029        self.message.body.get_field(tag::TRADING_SESSION_SUB_ID, &mut fld.0)?;
1030        Ok(fld.value().to_string())
1031    }
1032
1033
1034    /// Returns true if `TradingSessionSubID` is present, Tag 625.
1035    pub fn has_trading_session_sub_id(&self) -> bool {
1036        self.message.body.has(tag::TRADING_SESSION_SUB_ID)
1037    }
1038
1039
1040
1041
1042    /// Sets `TransactTime`, Tag 60.
1043    pub fn set_transact_time(&mut self, v: Timestamp) {
1044        self.message.body.set_field(tag::TRANSACT_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
1045            time: v,
1046            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
1047        });
1048    }
1049
1050    /// Gets `TransactTime`, Tag 60.
1051    pub fn get_transact_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
1052        let mut fld = field::TransactTimeField::new(Timestamp::UNIX_EPOCH);
1053        self.message.body.get_field(tag::TRANSACT_TIME, &mut fld.0)?;
1054        Ok(fld.value())
1055    }
1056
1057
1058    /// Returns true if `TransactTime` is present, Tag 60.
1059    pub fn has_transact_time(&self) -> bool {
1060        self.message.body.has(tag::TRANSACT_TIME)
1061    }
1062
1063
1064
1065
1066    /// Sets `URLLink`, Tag 149.
1067    pub fn set_url_link(&mut self, v: String) {
1068        self.message.body.set_field(tag::URL_LINK, FIXString::from(v));
1069    }
1070
1071    /// Gets `URLLink`, Tag 149.
1072    pub fn get_url_link(&self) -> Result<String, MessageRejectErrorEnum> {
1073        let mut fld = field::URLLinkField::new(String::new());
1074        self.message.body.get_field(tag::URL_LINK, &mut fld.0)?;
1075        Ok(fld.value().to_string())
1076    }
1077
1078
1079    /// Returns true if `URLLink` is present, Tag 149.
1080    pub fn has_url_link(&self) -> bool {
1081        self.message.body.has(tag::URL_LINK)
1082    }
1083
1084
1085}
1086
1087/// `RouteOut` is the callback type for routing `Advertisement` messages.
1088pub type RouteOut = fn(msg: Advertisement, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
1089
1090/// Route type returned by the `route` function.
1091pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
1092
1093/// Returns the begin string, message type, and route function for `Advertisement`.
1094pub fn route(router: RouteOut) -> Route {
1095    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
1096        router(Advertisement::from_message(msg.clone()), session_id)
1097    };
1098    ("FIX.4.3", "7", Box::new(r))
1099}