Skip to main content

fixer_fix/fix42/
security_definition_request.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 crate::field;
16use crate::tag;
17
18/// `SecurityDefinitionRequest` is the `fix42` `SecurityDefinitionRequest` type, `MsgType` = c.
19pub struct SecurityDefinitionRequest {
20    pub message: Message,
21}
22
23impl SecurityDefinitionRequest {
24    /// Creates a new `SecurityDefinitionRequest` with required fields.
25    pub fn new(security_req_id: field::SecurityReqIDField, security_request_type: field::SecurityRequestTypeField) -> Self {
26        let mut msg = Message::new();
27        msg.header.set_field(tag::MSG_TYPE, FIXString::from("c".to_string()));
28
29        msg.body.set_field(tag::SECURITY_REQ_ID, security_req_id.0);
30
31        msg.body.set_field(tag::SECURITY_REQUEST_TYPE, security_request_type.0);
32
33        Self { message: msg }
34    }
35
36    /// Creates a `SecurityDefinitionRequest` from an existing `Message`.
37    pub fn from_message(msg: Message) -> Self {
38        Self { message: msg }
39    }
40
41    /// Returns the underlying `Message`.
42    pub fn to_message(self) -> Message {
43        self.message
44    }
45
46
47
48
49    /// Sets `ContractMultiplier`, Tag 231.
50    pub fn set_contract_multiplier(&mut self, val: Decimal, scale: i32) {
51        self.message.body.set_field(tag::CONTRACT_MULTIPLIER, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
52    }
53
54    /// Gets `ContractMultiplier`, Tag 231.
55    pub fn get_contract_multiplier(&self) -> Result<Decimal, MessageRejectErrorEnum> {
56        let mut fld = field::ContractMultiplierField::new(Decimal::ZERO, 0);
57        self.message.body.get_field(tag::CONTRACT_MULTIPLIER, &mut fld.0)?;
58        Ok(fld.value())
59    }
60
61
62    /// Returns true if `ContractMultiplier` is present, Tag 231.
63    pub fn has_contract_multiplier(&self) -> bool {
64        self.message.body.has(tag::CONTRACT_MULTIPLIER)
65    }
66
67
68
69
70    /// Sets `CouponRate`, Tag 223.
71    pub fn set_coupon_rate(&mut self, val: Decimal, scale: i32) {
72        self.message.body.set_field(tag::COUPON_RATE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
73    }
74
75    /// Gets `CouponRate`, Tag 223.
76    pub fn get_coupon_rate(&self) -> Result<Decimal, MessageRejectErrorEnum> {
77        let mut fld = field::CouponRateField::new(Decimal::ZERO, 0);
78        self.message.body.get_field(tag::COUPON_RATE, &mut fld.0)?;
79        Ok(fld.value())
80    }
81
82
83    /// Returns true if `CouponRate` is present, Tag 223.
84    pub fn has_coupon_rate(&self) -> bool {
85        self.message.body.has(tag::COUPON_RATE)
86    }
87
88
89
90
91    /// Sets `Currency`, Tag 15.
92    pub fn set_currency(&mut self, v: String) {
93        self.message.body.set_field(tag::CURRENCY, FIXString::from(v));
94    }
95
96    /// Gets `Currency`, Tag 15.
97    pub fn get_currency(&self) -> Result<String, MessageRejectErrorEnum> {
98        let mut fld = field::CurrencyField::new(String::new());
99        self.message.body.get_field(tag::CURRENCY, &mut fld.0)?;
100        Ok(fld.value().to_string())
101    }
102
103
104    /// Returns true if `Currency` is present, Tag 15.
105    pub fn has_currency(&self) -> bool {
106        self.message.body.has(tag::CURRENCY)
107    }
108
109
110
111
112    /// Sets `EncodedIssuer`, Tag 349.
113    pub fn set_encoded_issuer(&mut self, v: String) {
114        self.message.body.set_field(tag::ENCODED_ISSUER, FIXString::from(v));
115    }
116
117    /// Gets `EncodedIssuer`, Tag 349.
118    pub fn get_encoded_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
119        let mut fld = field::EncodedIssuerField::new(String::new());
120        self.message.body.get_field(tag::ENCODED_ISSUER, &mut fld.0)?;
121        Ok(fld.value().to_string())
122    }
123
124
125    /// Returns true if `EncodedIssuer` is present, Tag 349.
126    pub fn has_encoded_issuer(&self) -> bool {
127        self.message.body.has(tag::ENCODED_ISSUER)
128    }
129
130
131
132
133    /// Sets `EncodedIssuerLen`, Tag 348.
134    pub fn set_encoded_issuer_len(&mut self, v: isize) {
135        self.message.body.set_field(tag::ENCODED_ISSUER_LEN, fixer::fix_int::FIXInt::from(v));
136    }
137
138    /// Gets `EncodedIssuerLen`, Tag 348.
139    pub fn get_encoded_issuer_len(&self) -> Result<isize, MessageRejectErrorEnum> {
140        let mut fld = field::EncodedIssuerLenField::new(0);
141        self.message.body.get_field(tag::ENCODED_ISSUER_LEN, &mut fld.0)?;
142        Ok(fld.value())
143    }
144
145
146    /// Returns true if `EncodedIssuerLen` is present, Tag 348.
147    pub fn has_encoded_issuer_len(&self) -> bool {
148        self.message.body.has(tag::ENCODED_ISSUER_LEN)
149    }
150
151
152
153
154    /// Sets `EncodedSecurityDesc`, Tag 351.
155    pub fn set_encoded_security_desc(&mut self, v: String) {
156        self.message.body.set_field(tag::ENCODED_SECURITY_DESC, FIXString::from(v));
157    }
158
159    /// Gets `EncodedSecurityDesc`, Tag 351.
160    pub fn get_encoded_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
161        let mut fld = field::EncodedSecurityDescField::new(String::new());
162        self.message.body.get_field(tag::ENCODED_SECURITY_DESC, &mut fld.0)?;
163        Ok(fld.value().to_string())
164    }
165
166
167    /// Returns true if `EncodedSecurityDesc` is present, Tag 351.
168    pub fn has_encoded_security_desc(&self) -> bool {
169        self.message.body.has(tag::ENCODED_SECURITY_DESC)
170    }
171
172
173
174
175    /// Sets `EncodedSecurityDescLen`, Tag 350.
176    pub fn set_encoded_security_desc_len(&mut self, v: isize) {
177        self.message.body.set_field(tag::ENCODED_SECURITY_DESC_LEN, fixer::fix_int::FIXInt::from(v));
178    }
179
180    /// Gets `EncodedSecurityDescLen`, Tag 350.
181    pub fn get_encoded_security_desc_len(&self) -> Result<isize, MessageRejectErrorEnum> {
182        let mut fld = field::EncodedSecurityDescLenField::new(0);
183        self.message.body.get_field(tag::ENCODED_SECURITY_DESC_LEN, &mut fld.0)?;
184        Ok(fld.value())
185    }
186
187
188    /// Returns true if `EncodedSecurityDescLen` is present, Tag 350.
189    pub fn has_encoded_security_desc_len(&self) -> bool {
190        self.message.body.has(tag::ENCODED_SECURITY_DESC_LEN)
191    }
192
193
194
195
196    /// Sets `EncodedText`, Tag 355.
197    pub fn set_encoded_text(&mut self, v: String) {
198        self.message.body.set_field(tag::ENCODED_TEXT, FIXString::from(v));
199    }
200
201    /// Gets `EncodedText`, Tag 355.
202    pub fn get_encoded_text(&self) -> Result<String, MessageRejectErrorEnum> {
203        let mut fld = field::EncodedTextField::new(String::new());
204        self.message.body.get_field(tag::ENCODED_TEXT, &mut fld.0)?;
205        Ok(fld.value().to_string())
206    }
207
208
209    /// Returns true if `EncodedText` is present, Tag 355.
210    pub fn has_encoded_text(&self) -> bool {
211        self.message.body.has(tag::ENCODED_TEXT)
212    }
213
214
215
216
217    /// Sets `EncodedTextLen`, Tag 354.
218    pub fn set_encoded_text_len(&mut self, v: isize) {
219        self.message.body.set_field(tag::ENCODED_TEXT_LEN, fixer::fix_int::FIXInt::from(v));
220    }
221
222    /// Gets `EncodedTextLen`, Tag 354.
223    pub fn get_encoded_text_len(&self) -> Result<isize, MessageRejectErrorEnum> {
224        let mut fld = field::EncodedTextLenField::new(0);
225        self.message.body.get_field(tag::ENCODED_TEXT_LEN, &mut fld.0)?;
226        Ok(fld.value())
227    }
228
229
230    /// Returns true if `EncodedTextLen` is present, Tag 354.
231    pub fn has_encoded_text_len(&self) -> bool {
232        self.message.body.has(tag::ENCODED_TEXT_LEN)
233    }
234
235
236
237
238    /// Sets `IDSource`, Tag 22.
239    pub fn set_id_source(&mut self, v: String) {
240        self.message.body.set_field(tag::ID_SOURCE, FIXString::from(v));
241    }
242
243    /// Gets `IDSource`, Tag 22.
244    pub fn get_id_source(&self) -> Result<String, MessageRejectErrorEnum> {
245        let mut fld = field::IDSourceField::new(String::new());
246        self.message.body.get_field(tag::ID_SOURCE, &mut fld.0)?;
247        Ok(fld.value().to_string())
248    }
249
250
251    /// Returns true if `IDSource` is present, Tag 22.
252    pub fn has_id_source(&self) -> bool {
253        self.message.body.has(tag::ID_SOURCE)
254    }
255
256
257
258
259    /// Sets `Issuer`, Tag 106.
260    pub fn set_issuer(&mut self, v: String) {
261        self.message.body.set_field(tag::ISSUER, FIXString::from(v));
262    }
263
264    /// Gets `Issuer`, Tag 106.
265    pub fn get_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
266        let mut fld = field::IssuerField::new(String::new());
267        self.message.body.get_field(tag::ISSUER, &mut fld.0)?;
268        Ok(fld.value().to_string())
269    }
270
271
272    /// Returns true if `Issuer` is present, Tag 106.
273    pub fn has_issuer(&self) -> bool {
274        self.message.body.has(tag::ISSUER)
275    }
276
277
278
279
280    /// Sets `MaturityDay`, Tag 205.
281    pub fn set_maturity_day(&mut self, v: isize) {
282        self.message.body.set_field(tag::MATURITY_DAY, fixer::fix_int::FIXInt::from(v));
283    }
284
285    /// Gets `MaturityDay`, Tag 205.
286    pub fn get_maturity_day(&self) -> Result<isize, MessageRejectErrorEnum> {
287        let mut fld = field::MaturityDayField::new(0);
288        self.message.body.get_field(tag::MATURITY_DAY, &mut fld.0)?;
289        Ok(fld.value())
290    }
291
292
293    /// Returns true if `MaturityDay` is present, Tag 205.
294    pub fn has_maturity_day(&self) -> bool {
295        self.message.body.has(tag::MATURITY_DAY)
296    }
297
298
299
300
301    /// Sets `MaturityMonthYear`, Tag 200.
302    pub fn set_maturity_month_year(&mut self, v: String) {
303        self.message.body.set_field(tag::MATURITY_MONTH_YEAR, FIXString::from(v));
304    }
305
306    /// Gets `MaturityMonthYear`, Tag 200.
307    pub fn get_maturity_month_year(&self) -> Result<String, MessageRejectErrorEnum> {
308        let mut fld = field::MaturityMonthYearField::new(String::new());
309        self.message.body.get_field(tag::MATURITY_MONTH_YEAR, &mut fld.0)?;
310        Ok(fld.value().to_string())
311    }
312
313
314    /// Returns true if `MaturityMonthYear` is present, Tag 200.
315    pub fn has_maturity_month_year(&self) -> bool {
316        self.message.body.has(tag::MATURITY_MONTH_YEAR)
317    }
318
319
320
321
322    /// Sets `NoRelatedSym`, Tag 146.
323    pub fn set_no_related_sym(&mut self, v: isize) {
324        self.message.body.set_field(tag::NO_RELATED_SYM, fixer::fix_int::FIXInt::from(v));
325    }
326
327    /// Gets `NoRelatedSym`, Tag 146.
328    pub fn get_no_related_sym(&self) -> Result<isize, MessageRejectErrorEnum> {
329        let mut fld = field::NoRelatedSymField::new(0);
330        self.message.body.get_field(tag::NO_RELATED_SYM, &mut fld.0)?;
331        Ok(fld.value())
332    }
333
334
335    /// Returns true if `NoRelatedSym` is present, Tag 146.
336    pub fn has_no_related_sym(&self) -> bool {
337        self.message.body.has(tag::NO_RELATED_SYM)
338    }
339
340
341
342
343    /// Sets `OptAttribute`, Tag 206.
344    pub fn set_opt_attribute(&mut self, v: String) {
345        self.message.body.set_field(tag::OPT_ATTRIBUTE, FIXString::from(v));
346    }
347
348    /// Gets `OptAttribute`, Tag 206.
349    pub fn get_opt_attribute(&self) -> Result<String, MessageRejectErrorEnum> {
350        let mut fld = field::OptAttributeField::new(String::new());
351        self.message.body.get_field(tag::OPT_ATTRIBUTE, &mut fld.0)?;
352        Ok(fld.value().to_string())
353    }
354
355
356    /// Returns true if `OptAttribute` is present, Tag 206.
357    pub fn has_opt_attribute(&self) -> bool {
358        self.message.body.has(tag::OPT_ATTRIBUTE)
359    }
360
361
362
363
364    /// Sets `PutOrCall`, Tag 201.
365    pub fn set_put_or_call(&mut self, v: isize) {
366        self.message.body.set_field(tag::PUT_OR_CALL, fixer::fix_int::FIXInt::from(v));
367    }
368
369    /// Gets `PutOrCall`, Tag 201.
370    pub fn get_put_or_call(&self) -> Result<isize, MessageRejectErrorEnum> {
371        let mut fld = field::PutOrCallField::new(0);
372        self.message.body.get_field(tag::PUT_OR_CALL, &mut fld.0)?;
373        Ok(fld.value())
374    }
375
376
377    /// Returns true if `PutOrCall` is present, Tag 201.
378    pub fn has_put_or_call(&self) -> bool {
379        self.message.body.has(tag::PUT_OR_CALL)
380    }
381
382
383
384
385    /// Sets `SecurityDesc`, Tag 107.
386    pub fn set_security_desc(&mut self, v: String) {
387        self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
388    }
389
390    /// Gets `SecurityDesc`, Tag 107.
391    pub fn get_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
392        let mut fld = field::SecurityDescField::new(String::new());
393        self.message.body.get_field(tag::SECURITY_DESC, &mut fld.0)?;
394        Ok(fld.value().to_string())
395    }
396
397
398    /// Returns true if `SecurityDesc` is present, Tag 107.
399    pub fn has_security_desc(&self) -> bool {
400        self.message.body.has(tag::SECURITY_DESC)
401    }
402
403
404
405
406    /// Sets `SecurityExchange`, Tag 207.
407    pub fn set_security_exchange(&mut self, v: String) {
408        self.message.body.set_field(tag::SECURITY_EXCHANGE, FIXString::from(v));
409    }
410
411    /// Gets `SecurityExchange`, Tag 207.
412    pub fn get_security_exchange(&self) -> Result<String, MessageRejectErrorEnum> {
413        let mut fld = field::SecurityExchangeField::new(String::new());
414        self.message.body.get_field(tag::SECURITY_EXCHANGE, &mut fld.0)?;
415        Ok(fld.value().to_string())
416    }
417
418
419    /// Returns true if `SecurityExchange` is present, Tag 207.
420    pub fn has_security_exchange(&self) -> bool {
421        self.message.body.has(tag::SECURITY_EXCHANGE)
422    }
423
424
425
426
427    /// Sets `SecurityID`, Tag 48.
428    pub fn set_security_id(&mut self, v: String) {
429        self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
430    }
431
432    /// Gets `SecurityID`, Tag 48.
433    pub fn get_security_id(&self) -> Result<String, MessageRejectErrorEnum> {
434        let mut fld = field::SecurityIDField::new(String::new());
435        self.message.body.get_field(tag::SECURITY_ID, &mut fld.0)?;
436        Ok(fld.value().to_string())
437    }
438
439
440    /// Returns true if `SecurityID` is present, Tag 48.
441    pub fn has_security_id(&self) -> bool {
442        self.message.body.has(tag::SECURITY_ID)
443    }
444
445
446
447
448    /// Sets `SecurityReqID`, Tag 320.
449    pub fn set_security_req_id(&mut self, v: String) {
450        self.message.body.set_field(tag::SECURITY_REQ_ID, FIXString::from(v));
451    }
452
453    /// Gets `SecurityReqID`, Tag 320.
454    pub fn get_security_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
455        let mut fld = field::SecurityReqIDField::new(String::new());
456        self.message.body.get_field(tag::SECURITY_REQ_ID, &mut fld.0)?;
457        Ok(fld.value().to_string())
458    }
459
460
461    /// Returns true if `SecurityReqID` is present, Tag 320.
462    pub fn has_security_req_id(&self) -> bool {
463        self.message.body.has(tag::SECURITY_REQ_ID)
464    }
465
466
467
468
469    /// Sets `SecurityRequestType`, Tag 321.
470    pub fn set_security_request_type(&mut self, v: isize) {
471        self.message.body.set_field(tag::SECURITY_REQUEST_TYPE, fixer::fix_int::FIXInt::from(v));
472    }
473
474    /// Gets `SecurityRequestType`, Tag 321.
475    pub fn get_security_request_type(&self) -> Result<isize, MessageRejectErrorEnum> {
476        let mut fld = field::SecurityRequestTypeField::new(0);
477        self.message.body.get_field(tag::SECURITY_REQUEST_TYPE, &mut fld.0)?;
478        Ok(fld.value())
479    }
480
481
482    /// Returns true if `SecurityRequestType` is present, Tag 321.
483    pub fn has_security_request_type(&self) -> bool {
484        self.message.body.has(tag::SECURITY_REQUEST_TYPE)
485    }
486
487
488
489
490    /// Sets `SecurityType`, Tag 167.
491    pub fn set_security_type(&mut self, v: String) {
492        self.message.body.set_field(tag::SECURITY_TYPE, FIXString::from(v));
493    }
494
495    /// Gets `SecurityType`, Tag 167.
496    pub fn get_security_type(&self) -> Result<String, MessageRejectErrorEnum> {
497        let mut fld = field::SecurityTypeField::new(String::new());
498        self.message.body.get_field(tag::SECURITY_TYPE, &mut fld.0)?;
499        Ok(fld.value().to_string())
500    }
501
502
503    /// Returns true if `SecurityType` is present, Tag 167.
504    pub fn has_security_type(&self) -> bool {
505        self.message.body.has(tag::SECURITY_TYPE)
506    }
507
508
509
510
511    /// Sets `StrikePrice`, Tag 202.
512    pub fn set_strike_price(&mut self, val: Decimal, scale: i32) {
513        self.message.body.set_field(tag::STRIKE_PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
514    }
515
516    /// Gets `StrikePrice`, Tag 202.
517    pub fn get_strike_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
518        let mut fld = field::StrikePriceField::new(Decimal::ZERO, 0);
519        self.message.body.get_field(tag::STRIKE_PRICE, &mut fld.0)?;
520        Ok(fld.value())
521    }
522
523
524    /// Returns true if `StrikePrice` is present, Tag 202.
525    pub fn has_strike_price(&self) -> bool {
526        self.message.body.has(tag::STRIKE_PRICE)
527    }
528
529
530
531
532    /// Sets `Symbol`, Tag 55.
533    pub fn set_symbol(&mut self, v: String) {
534        self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
535    }
536
537    /// Gets `Symbol`, Tag 55.
538    pub fn get_symbol(&self) -> Result<String, MessageRejectErrorEnum> {
539        let mut fld = field::SymbolField::new(String::new());
540        self.message.body.get_field(tag::SYMBOL, &mut fld.0)?;
541        Ok(fld.value().to_string())
542    }
543
544
545    /// Returns true if `Symbol` is present, Tag 55.
546    pub fn has_symbol(&self) -> bool {
547        self.message.body.has(tag::SYMBOL)
548    }
549
550
551
552
553    /// Sets `SymbolSfx`, Tag 65.
554    pub fn set_symbol_sfx(&mut self, v: String) {
555        self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
556    }
557
558    /// Gets `SymbolSfx`, Tag 65.
559    pub fn get_symbol_sfx(&self) -> Result<String, MessageRejectErrorEnum> {
560        let mut fld = field::SymbolSfxField::new(String::new());
561        self.message.body.get_field(tag::SYMBOL_SFX, &mut fld.0)?;
562        Ok(fld.value().to_string())
563    }
564
565
566    /// Returns true if `SymbolSfx` is present, Tag 65.
567    pub fn has_symbol_sfx(&self) -> bool {
568        self.message.body.has(tag::SYMBOL_SFX)
569    }
570
571
572
573
574    /// Sets `Text`, Tag 58.
575    pub fn set_text(&mut self, v: String) {
576        self.message.body.set_field(tag::TEXT, FIXString::from(v));
577    }
578
579    /// Gets `Text`, Tag 58.
580    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
581        let mut fld = field::TextField::new(String::new());
582        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
583        Ok(fld.value().to_string())
584    }
585
586
587    /// Returns true if `Text` is present, Tag 58.
588    pub fn has_text(&self) -> bool {
589        self.message.body.has(tag::TEXT)
590    }
591
592
593
594
595    /// Sets `TradingSessionID`, Tag 336.
596    pub fn set_trading_session_id(&mut self, v: String) {
597        self.message.body.set_field(tag::TRADING_SESSION_ID, FIXString::from(v));
598    }
599
600    /// Gets `TradingSessionID`, Tag 336.
601    pub fn get_trading_session_id(&self) -> Result<String, MessageRejectErrorEnum> {
602        let mut fld = field::TradingSessionIDField::new(String::new());
603        self.message.body.get_field(tag::TRADING_SESSION_ID, &mut fld.0)?;
604        Ok(fld.value().to_string())
605    }
606
607
608    /// Returns true if `TradingSessionID` is present, Tag 336.
609    pub fn has_trading_session_id(&self) -> bool {
610        self.message.body.has(tag::TRADING_SESSION_ID)
611    }
612
613
614}
615
616/// `RouteOut` is the callback type for routing `SecurityDefinitionRequest` messages.
617pub type RouteOut = fn(msg: SecurityDefinitionRequest, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
618
619/// Route type returned by the `route` function.
620pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
621
622/// Returns the begin string, message type, and route function for `SecurityDefinitionRequest`.
623pub fn route(router: RouteOut) -> Route {
624    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
625        router(SecurityDefinitionRequest::from_message(msg.clone()), session_id)
626    };
627    ("FIX.4.2", "c", Box::new(r))
628}