Skip to main content

fixer_fix/fix40/
indicationof_interest.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/// `IndicationofInterest` is the `fix40` `IndicationofInterest` type, `MsgType` = 6.
21pub struct IndicationofInterest {
22    pub message: Message,
23}
24
25impl IndicationofInterest {
26    /// Creates a new `IndicationofInterest` with required fields.
27    pub fn new(io_iid: field::IOIidField, ioi_trans_type: field::IOITransTypeField, symbol: field::SymbolField, side: field::SideField, ioi_shares: field::IOISharesField) -> Self {
28        let mut msg = Message::new();
29        msg.header.set_field(tag::MSG_TYPE, FIXString::from("6".to_string()));
30
31        msg.body.set_field(tag::IO_IID, io_iid.0);
32
33        msg.body.set_field(tag::IOI_TRANS_TYPE, ioi_trans_type.0);
34
35        msg.body.set_field(tag::SYMBOL, symbol.0);
36
37        msg.body.set_field(tag::SIDE, side.0);
38
39        msg.body.set_field(tag::IOI_SHARES, ioi_shares.0);
40
41        Self { message: msg }
42    }
43
44    /// Creates a `IndicationofInterest` from an existing `Message`.
45    pub fn from_message(msg: Message) -> Self {
46        Self { message: msg }
47    }
48
49    /// Returns the underlying `Message`.
50    pub fn to_message(self) -> Message {
51        self.message
52    }
53
54
55
56
57    /// Sets `Currency`, Tag 15.
58    pub fn set_currency(&mut self, v: String) {
59        self.message.body.set_field(tag::CURRENCY, FIXString::from(v));
60    }
61
62    /// Gets `Currency`, Tag 15.
63    pub fn get_currency(&self) -> Result<String, MessageRejectErrorEnum> {
64        let mut fld = field::CurrencyField::new(String::new());
65        self.message.body.get_field(tag::CURRENCY, &mut fld.0)?;
66        Ok(fld.value().to_string())
67    }
68
69
70    /// Returns true if `Currency` is present, Tag 15.
71    pub fn has_currency(&self) -> bool {
72        self.message.body.has(tag::CURRENCY)
73    }
74
75
76
77
78    /// Sets `IDSource`, Tag 22.
79    pub fn set_id_source(&mut self, v: String) {
80        self.message.body.set_field(tag::ID_SOURCE, FIXString::from(v));
81    }
82
83    /// Gets `IDSource`, Tag 22.
84    pub fn get_id_source(&self) -> Result<String, MessageRejectErrorEnum> {
85        let mut fld = field::IDSourceField::new(String::new());
86        self.message.body.get_field(tag::ID_SOURCE, &mut fld.0)?;
87        Ok(fld.value().to_string())
88    }
89
90
91    /// Returns true if `IDSource` is present, Tag 22.
92    pub fn has_id_source(&self) -> bool {
93        self.message.body.has(tag::ID_SOURCE)
94    }
95
96
97
98
99    /// Sets `IOINaturalFlag`, Tag 130.
100    pub fn set_ioi_natural_flag(&mut self, v: bool) {
101        self.message.body.set_field(tag::IOI_NATURAL_FLAG, fixer::fix_boolean::FIXBoolean::from(v));
102    }
103
104    /// Gets `IOINaturalFlag`, Tag 130.
105    pub fn get_ioi_natural_flag(&self) -> Result<bool, MessageRejectErrorEnum> {
106        let mut fld = field::IOINaturalFlagField::new(false);
107        self.message.body.get_field(tag::IOI_NATURAL_FLAG, &mut fld.0)?;
108        Ok(fld.value())
109    }
110
111
112    /// Returns true if `IOINaturalFlag` is present, Tag 130.
113    pub fn has_ioi_natural_flag(&self) -> bool {
114        self.message.body.has(tag::IOI_NATURAL_FLAG)
115    }
116
117
118
119
120    /// Sets `IOIOthSvc`, Tag 24.
121    pub fn set_ioi_oth_svc(&mut self, v: String) {
122        self.message.body.set_field(tag::IOI_OTH_SVC, FIXString::from(v));
123    }
124
125    /// Gets `IOIOthSvc`, Tag 24.
126    pub fn get_ioi_oth_svc(&self) -> Result<String, MessageRejectErrorEnum> {
127        let mut fld = field::IOIOthSvcField::new(String::new());
128        self.message.body.get_field(tag::IOI_OTH_SVC, &mut fld.0)?;
129        Ok(fld.value().to_string())
130    }
131
132
133    /// Returns true if `IOIOthSvc` is present, Tag 24.
134    pub fn has_ioi_oth_svc(&self) -> bool {
135        self.message.body.has(tag::IOI_OTH_SVC)
136    }
137
138
139
140
141    /// Sets `IOIQltyInd`, Tag 25.
142    pub fn set_ioi_qlty_ind(&mut self, v: String) {
143        self.message.body.set_field(tag::IOI_QLTY_IND, FIXString::from(v));
144    }
145
146    /// Gets `IOIQltyInd`, Tag 25.
147    pub fn get_ioi_qlty_ind(&self) -> Result<String, MessageRejectErrorEnum> {
148        let mut fld = field::IOIQltyIndField::new(String::new());
149        self.message.body.get_field(tag::IOI_QLTY_IND, &mut fld.0)?;
150        Ok(fld.value().to_string())
151    }
152
153
154    /// Returns true if `IOIQltyInd` is present, Tag 25.
155    pub fn has_ioi_qlty_ind(&self) -> bool {
156        self.message.body.has(tag::IOI_QLTY_IND)
157    }
158
159
160
161
162    /// Sets `IOIQualifier`, Tag 104.
163    pub fn set_ioi_qualifier(&mut self, v: String) {
164        self.message.body.set_field(tag::IOI_QUALIFIER, FIXString::from(v));
165    }
166
167    /// Gets `IOIQualifier`, Tag 104.
168    pub fn get_ioi_qualifier(&self) -> Result<String, MessageRejectErrorEnum> {
169        let mut fld = field::IOIQualifierField::new(String::new());
170        self.message.body.get_field(tag::IOI_QUALIFIER, &mut fld.0)?;
171        Ok(fld.value().to_string())
172    }
173
174
175    /// Returns true if `IOIQualifier` is present, Tag 104.
176    pub fn has_ioi_qualifier(&self) -> bool {
177        self.message.body.has(tag::IOI_QUALIFIER)
178    }
179
180
181
182
183    /// Sets `IOIRefID`, Tag 26.
184    pub fn set_ioi_ref_id(&mut self, v: String) {
185        self.message.body.set_field(tag::IOI_REF_ID, FIXString::from(v));
186    }
187
188    /// Gets `IOIRefID`, Tag 26.
189    pub fn get_ioi_ref_id(&self) -> Result<String, MessageRejectErrorEnum> {
190        let mut fld = field::IOIRefIDField::new(String::new());
191        self.message.body.get_field(tag::IOI_REF_ID, &mut fld.0)?;
192        Ok(fld.value().to_string())
193    }
194
195
196    /// Returns true if `IOIRefID` is present, Tag 26.
197    pub fn has_ioi_ref_id(&self) -> bool {
198        self.message.body.has(tag::IOI_REF_ID)
199    }
200
201
202
203
204    /// Sets `IOIShares`, Tag 27.
205    pub fn set_ioi_shares(&mut self, v: String) {
206        self.message.body.set_field(tag::IOI_SHARES, FIXString::from(v));
207    }
208
209    /// Gets `IOIShares`, Tag 27.
210    pub fn get_ioi_shares(&self) -> Result<String, MessageRejectErrorEnum> {
211        let mut fld = field::IOISharesField::new(String::new());
212        self.message.body.get_field(tag::IOI_SHARES, &mut fld.0)?;
213        Ok(fld.value().to_string())
214    }
215
216
217    /// Returns true if `IOIShares` is present, Tag 27.
218    pub fn has_ioi_shares(&self) -> bool {
219        self.message.body.has(tag::IOI_SHARES)
220    }
221
222
223
224
225    /// Sets `IOITransType`, Tag 28.
226    pub fn set_ioi_trans_type(&mut self, v: String) {
227        self.message.body.set_field(tag::IOI_TRANS_TYPE, FIXString::from(v));
228    }
229
230    /// Gets `IOITransType`, Tag 28.
231    pub fn get_ioi_trans_type(&self) -> Result<String, MessageRejectErrorEnum> {
232        let mut fld = field::IOITransTypeField::new(String::new());
233        self.message.body.get_field(tag::IOI_TRANS_TYPE, &mut fld.0)?;
234        Ok(fld.value().to_string())
235    }
236
237
238    /// Returns true if `IOITransType` is present, Tag 28.
239    pub fn has_ioi_trans_type(&self) -> bool {
240        self.message.body.has(tag::IOI_TRANS_TYPE)
241    }
242
243
244
245
246    /// Sets `IOIid`, Tag 23.
247    pub fn set_io_iid(&mut self, v: String) {
248        self.message.body.set_field(tag::IO_IID, FIXString::from(v));
249    }
250
251    /// Gets `IOIid`, Tag 23.
252    pub fn get_io_iid(&self) -> Result<String, MessageRejectErrorEnum> {
253        let mut fld = field::IOIidField::new(String::new());
254        self.message.body.get_field(tag::IO_IID, &mut fld.0)?;
255        Ok(fld.value().to_string())
256    }
257
258
259    /// Returns true if `IOIid` is present, Tag 23.
260    pub fn has_io_iid(&self) -> bool {
261        self.message.body.has(tag::IO_IID)
262    }
263
264
265
266
267    /// Sets `Issuer`, Tag 106.
268    pub fn set_issuer(&mut self, v: String) {
269        self.message.body.set_field(tag::ISSUER, FIXString::from(v));
270    }
271
272    /// Gets `Issuer`, Tag 106.
273    pub fn get_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
274        let mut fld = field::IssuerField::new(String::new());
275        self.message.body.get_field(tag::ISSUER, &mut fld.0)?;
276        Ok(fld.value().to_string())
277    }
278
279
280    /// Returns true if `Issuer` is present, Tag 106.
281    pub fn has_issuer(&self) -> bool {
282        self.message.body.has(tag::ISSUER)
283    }
284
285
286
287
288    /// Sets `Price`, Tag 44.
289    pub fn set_price(&mut self, val: Decimal, scale: i32) {
290        self.message.body.set_field(tag::PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
291    }
292
293    /// Gets `Price`, Tag 44.
294    pub fn get_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
295        let mut fld = field::PriceField::new(Decimal::ZERO, 0);
296        self.message.body.get_field(tag::PRICE, &mut fld.0)?;
297        Ok(fld.value())
298    }
299
300
301    /// Returns true if `Price` is present, Tag 44.
302    pub fn has_price(&self) -> bool {
303        self.message.body.has(tag::PRICE)
304    }
305
306
307
308
309    /// Sets `SecurityDesc`, Tag 107.
310    pub fn set_security_desc(&mut self, v: String) {
311        self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
312    }
313
314    /// Gets `SecurityDesc`, Tag 107.
315    pub fn get_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
316        let mut fld = field::SecurityDescField::new(String::new());
317        self.message.body.get_field(tag::SECURITY_DESC, &mut fld.0)?;
318        Ok(fld.value().to_string())
319    }
320
321
322    /// Returns true if `SecurityDesc` is present, Tag 107.
323    pub fn has_security_desc(&self) -> bool {
324        self.message.body.has(tag::SECURITY_DESC)
325    }
326
327
328
329
330    /// Sets `SecurityID`, Tag 48.
331    pub fn set_security_id(&mut self, v: String) {
332        self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
333    }
334
335    /// Gets `SecurityID`, Tag 48.
336    pub fn get_security_id(&self) -> Result<String, MessageRejectErrorEnum> {
337        let mut fld = field::SecurityIDField::new(String::new());
338        self.message.body.get_field(tag::SECURITY_ID, &mut fld.0)?;
339        Ok(fld.value().to_string())
340    }
341
342
343    /// Returns true if `SecurityID` is present, Tag 48.
344    pub fn has_security_id(&self) -> bool {
345        self.message.body.has(tag::SECURITY_ID)
346    }
347
348
349
350
351    /// Sets `Side`, Tag 54.
352    pub fn set_side(&mut self, v: String) {
353        self.message.body.set_field(tag::SIDE, FIXString::from(v));
354    }
355
356    /// Gets `Side`, Tag 54.
357    pub fn get_side(&self) -> Result<String, MessageRejectErrorEnum> {
358        let mut fld = field::SideField::new(String::new());
359        self.message.body.get_field(tag::SIDE, &mut fld.0)?;
360        Ok(fld.value().to_string())
361    }
362
363
364    /// Returns true if `Side` is present, Tag 54.
365    pub fn has_side(&self) -> bool {
366        self.message.body.has(tag::SIDE)
367    }
368
369
370
371
372    /// Sets `Symbol`, Tag 55.
373    pub fn set_symbol(&mut self, v: String) {
374        self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
375    }
376
377    /// Gets `Symbol`, Tag 55.
378    pub fn get_symbol(&self) -> Result<String, MessageRejectErrorEnum> {
379        let mut fld = field::SymbolField::new(String::new());
380        self.message.body.get_field(tag::SYMBOL, &mut fld.0)?;
381        Ok(fld.value().to_string())
382    }
383
384
385    /// Returns true if `Symbol` is present, Tag 55.
386    pub fn has_symbol(&self) -> bool {
387        self.message.body.has(tag::SYMBOL)
388    }
389
390
391
392
393    /// Sets `SymbolSfx`, Tag 65.
394    pub fn set_symbol_sfx(&mut self, v: String) {
395        self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
396    }
397
398    /// Gets `SymbolSfx`, Tag 65.
399    pub fn get_symbol_sfx(&self) -> Result<String, MessageRejectErrorEnum> {
400        let mut fld = field::SymbolSfxField::new(String::new());
401        self.message.body.get_field(tag::SYMBOL_SFX, &mut fld.0)?;
402        Ok(fld.value().to_string())
403    }
404
405
406    /// Returns true if `SymbolSfx` is present, Tag 65.
407    pub fn has_symbol_sfx(&self) -> bool {
408        self.message.body.has(tag::SYMBOL_SFX)
409    }
410
411
412
413
414    /// Sets `Text`, Tag 58.
415    pub fn set_text(&mut self, v: String) {
416        self.message.body.set_field(tag::TEXT, FIXString::from(v));
417    }
418
419    /// Gets `Text`, Tag 58.
420    pub fn get_text(&self) -> Result<String, MessageRejectErrorEnum> {
421        let mut fld = field::TextField::new(String::new());
422        self.message.body.get_field(tag::TEXT, &mut fld.0)?;
423        Ok(fld.value().to_string())
424    }
425
426
427    /// Returns true if `Text` is present, Tag 58.
428    pub fn has_text(&self) -> bool {
429        self.message.body.has(tag::TEXT)
430    }
431
432
433
434
435    /// Sets `ValidUntilTime`, Tag 62.
436    pub fn set_valid_until_time(&mut self, v: Timestamp) {
437        self.message.body.set_field(tag::VALID_UNTIL_TIME, fixer::fix_utc_timestamp::FIXUTCTimestamp {
438            time: v,
439            precision: fixer::fix_utc_timestamp::TimestampPrecision::Millis,
440        });
441    }
442
443    /// Gets `ValidUntilTime`, Tag 62.
444    pub fn get_valid_until_time(&self) -> Result<Timestamp, MessageRejectErrorEnum> {
445        let mut fld = field::ValidUntilTimeField::new(Timestamp::UNIX_EPOCH);
446        self.message.body.get_field(tag::VALID_UNTIL_TIME, &mut fld.0)?;
447        Ok(fld.value())
448    }
449
450
451    /// Returns true if `ValidUntilTime` is present, Tag 62.
452    pub fn has_valid_until_time(&self) -> bool {
453        self.message.body.has(tag::VALID_UNTIL_TIME)
454    }
455
456
457}
458
459/// `RouteOut` is the callback type for routing `IndicationofInterest` messages.
460pub type RouteOut = fn(msg: IndicationofInterest, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
461
462/// Route type returned by the `route` function.
463pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
464
465/// Returns the begin string, message type, and route function for `IndicationofInterest`.
466pub fn route(router: RouteOut) -> Route {
467    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
468        router(IndicationofInterest::from_message(msg.clone()), session_id)
469    };
470    ("FIX.4.0", "6", Box::new(r))
471}