Skip to main content

fixer_fix/fix41/
quote_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/// `QuoteRequest` is the `fix41` `QuoteRequest` type, `MsgType` = R.
19pub struct QuoteRequest {
20    pub message: Message,
21}
22
23impl QuoteRequest {
24    /// Creates a new `QuoteRequest` with required fields.
25    pub fn new(quote_req_id: field::QuoteReqIDField, symbol: field::SymbolField) -> Self {
26        let mut msg = Message::new();
27        msg.header.set_field(tag::MSG_TYPE, FIXString::from("R".to_string()));
28
29        msg.body.set_field(tag::QUOTE_REQ_ID, quote_req_id.0);
30
31        msg.body.set_field(tag::SYMBOL, symbol.0);
32
33        Self { message: msg }
34    }
35
36    /// Creates a `QuoteRequest` 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 `FutSettDate`, Tag 64.
50    pub fn set_fut_sett_date(&mut self, v: String) {
51        self.message.body.set_field(tag::FUT_SETT_DATE, FIXString::from(v));
52    }
53
54    /// Gets `FutSettDate`, Tag 64.
55    pub fn get_fut_sett_date(&self) -> Result<String, MessageRejectErrorEnum> {
56        let mut fld = field::FutSettDateField::new(String::new());
57        self.message.body.get_field(tag::FUT_SETT_DATE, &mut fld.0)?;
58        Ok(fld.value().to_string())
59    }
60
61
62    /// Returns true if `FutSettDate` is present, Tag 64.
63    pub fn has_fut_sett_date(&self) -> bool {
64        self.message.body.has(tag::FUT_SETT_DATE)
65    }
66
67
68
69
70    /// Sets `FutSettDate2`, Tag 193.
71    pub fn set_fut_sett_date2(&mut self, v: String) {
72        self.message.body.set_field(tag::FUT_SETT_DATE2, FIXString::from(v));
73    }
74
75    /// Gets `FutSettDate2`, Tag 193.
76    pub fn get_fut_sett_date2(&self) -> Result<String, MessageRejectErrorEnum> {
77        let mut fld = field::FutSettDate2Field::new(String::new());
78        self.message.body.get_field(tag::FUT_SETT_DATE2, &mut fld.0)?;
79        Ok(fld.value().to_string())
80    }
81
82
83    /// Returns true if `FutSettDate2` is present, Tag 193.
84    pub fn has_fut_sett_date2(&self) -> bool {
85        self.message.body.has(tag::FUT_SETT_DATE2)
86    }
87
88
89
90
91    /// Sets `IDSource`, Tag 22.
92    pub fn set_id_source(&mut self, v: String) {
93        self.message.body.set_field(tag::ID_SOURCE, FIXString::from(v));
94    }
95
96    /// Gets `IDSource`, Tag 22.
97    pub fn get_id_source(&self) -> Result<String, MessageRejectErrorEnum> {
98        let mut fld = field::IDSourceField::new(String::new());
99        self.message.body.get_field(tag::ID_SOURCE, &mut fld.0)?;
100        Ok(fld.value().to_string())
101    }
102
103
104    /// Returns true if `IDSource` is present, Tag 22.
105    pub fn has_id_source(&self) -> bool {
106        self.message.body.has(tag::ID_SOURCE)
107    }
108
109
110
111
112    /// Sets `Issuer`, Tag 106.
113    pub fn set_issuer(&mut self, v: String) {
114        self.message.body.set_field(tag::ISSUER, FIXString::from(v));
115    }
116
117    /// Gets `Issuer`, Tag 106.
118    pub fn get_issuer(&self) -> Result<String, MessageRejectErrorEnum> {
119        let mut fld = field::IssuerField::new(String::new());
120        self.message.body.get_field(tag::ISSUER, &mut fld.0)?;
121        Ok(fld.value().to_string())
122    }
123
124
125    /// Returns true if `Issuer` is present, Tag 106.
126    pub fn has_issuer(&self) -> bool {
127        self.message.body.has(tag::ISSUER)
128    }
129
130
131
132
133    /// Sets `MaturityDay`, Tag 205.
134    pub fn set_maturity_day(&mut self, v: isize) {
135        self.message.body.set_field(tag::MATURITY_DAY, fixer::fix_int::FIXInt::from(v));
136    }
137
138    /// Gets `MaturityDay`, Tag 205.
139    pub fn get_maturity_day(&self) -> Result<isize, MessageRejectErrorEnum> {
140        let mut fld = field::MaturityDayField::new(0);
141        self.message.body.get_field(tag::MATURITY_DAY, &mut fld.0)?;
142        Ok(fld.value())
143    }
144
145
146    /// Returns true if `MaturityDay` is present, Tag 205.
147    pub fn has_maturity_day(&self) -> bool {
148        self.message.body.has(tag::MATURITY_DAY)
149    }
150
151
152
153
154    /// Sets `MaturityMonthYear`, Tag 200.
155    pub fn set_maturity_month_year(&mut self, v: String) {
156        self.message.body.set_field(tag::MATURITY_MONTH_YEAR, FIXString::from(v));
157    }
158
159    /// Gets `MaturityMonthYear`, Tag 200.
160    pub fn get_maturity_month_year(&self) -> Result<String, MessageRejectErrorEnum> {
161        let mut fld = field::MaturityMonthYearField::new(String::new());
162        self.message.body.get_field(tag::MATURITY_MONTH_YEAR, &mut fld.0)?;
163        Ok(fld.value().to_string())
164    }
165
166
167    /// Returns true if `MaturityMonthYear` is present, Tag 200.
168    pub fn has_maturity_month_year(&self) -> bool {
169        self.message.body.has(tag::MATURITY_MONTH_YEAR)
170    }
171
172
173
174
175    /// Sets `OptAttribute`, Tag 206.
176    pub fn set_opt_attribute(&mut self, v: String) {
177        self.message.body.set_field(tag::OPT_ATTRIBUTE, FIXString::from(v));
178    }
179
180    /// Gets `OptAttribute`, Tag 206.
181    pub fn get_opt_attribute(&self) -> Result<String, MessageRejectErrorEnum> {
182        let mut fld = field::OptAttributeField::new(String::new());
183        self.message.body.get_field(tag::OPT_ATTRIBUTE, &mut fld.0)?;
184        Ok(fld.value().to_string())
185    }
186
187
188    /// Returns true if `OptAttribute` is present, Tag 206.
189    pub fn has_opt_attribute(&self) -> bool {
190        self.message.body.has(tag::OPT_ATTRIBUTE)
191    }
192
193
194
195
196    /// Sets `OrdType`, Tag 40.
197    pub fn set_ord_type(&mut self, v: String) {
198        self.message.body.set_field(tag::ORD_TYPE, FIXString::from(v));
199    }
200
201    /// Gets `OrdType`, Tag 40.
202    pub fn get_ord_type(&self) -> Result<String, MessageRejectErrorEnum> {
203        let mut fld = field::OrdTypeField::new(String::new());
204        self.message.body.get_field(tag::ORD_TYPE, &mut fld.0)?;
205        Ok(fld.value().to_string())
206    }
207
208
209    /// Returns true if `OrdType` is present, Tag 40.
210    pub fn has_ord_type(&self) -> bool {
211        self.message.body.has(tag::ORD_TYPE)
212    }
213
214
215
216
217    /// Sets `OrderQty`, Tag 38.
218    pub fn set_order_qty(&mut self, val: Decimal, scale: i32) {
219        self.message.body.set_field(tag::ORDER_QTY, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
220    }
221
222    /// Gets `OrderQty`, Tag 38.
223    pub fn get_order_qty(&self) -> Result<Decimal, MessageRejectErrorEnum> {
224        let mut fld = field::OrderQtyField::new(Decimal::ZERO, 0);
225        self.message.body.get_field(tag::ORDER_QTY, &mut fld.0)?;
226        Ok(fld.value())
227    }
228
229
230    /// Returns true if `OrderQty` is present, Tag 38.
231    pub fn has_order_qty(&self) -> bool {
232        self.message.body.has(tag::ORDER_QTY)
233    }
234
235
236
237
238    /// Sets `OrderQty2`, Tag 192.
239    pub fn set_order_qty2(&mut self, val: Decimal, scale: i32) {
240        self.message.body.set_field(tag::ORDER_QTY2, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
241    }
242
243    /// Gets `OrderQty2`, Tag 192.
244    pub fn get_order_qty2(&self) -> Result<Decimal, MessageRejectErrorEnum> {
245        let mut fld = field::OrderQty2Field::new(Decimal::ZERO, 0);
246        self.message.body.get_field(tag::ORDER_QTY2, &mut fld.0)?;
247        Ok(fld.value())
248    }
249
250
251    /// Returns true if `OrderQty2` is present, Tag 192.
252    pub fn has_order_qty2(&self) -> bool {
253        self.message.body.has(tag::ORDER_QTY2)
254    }
255
256
257
258
259    /// Sets `PrevClosePx`, Tag 140.
260    pub fn set_prev_close_px(&mut self, val: Decimal, scale: i32) {
261        self.message.body.set_field(tag::PREV_CLOSE_PX, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
262    }
263
264    /// Gets `PrevClosePx`, Tag 140.
265    pub fn get_prev_close_px(&self) -> Result<Decimal, MessageRejectErrorEnum> {
266        let mut fld = field::PrevClosePxField::new(Decimal::ZERO, 0);
267        self.message.body.get_field(tag::PREV_CLOSE_PX, &mut fld.0)?;
268        Ok(fld.value())
269    }
270
271
272    /// Returns true if `PrevClosePx` is present, Tag 140.
273    pub fn has_prev_close_px(&self) -> bool {
274        self.message.body.has(tag::PREV_CLOSE_PX)
275    }
276
277
278
279
280    /// Sets `PutOrCall`, Tag 201.
281    pub fn set_put_or_call(&mut self, v: isize) {
282        self.message.body.set_field(tag::PUT_OR_CALL, fixer::fix_int::FIXInt::from(v));
283    }
284
285    /// Gets `PutOrCall`, Tag 201.
286    pub fn get_put_or_call(&self) -> Result<isize, MessageRejectErrorEnum> {
287        let mut fld = field::PutOrCallField::new(0);
288        self.message.body.get_field(tag::PUT_OR_CALL, &mut fld.0)?;
289        Ok(fld.value())
290    }
291
292
293    /// Returns true if `PutOrCall` is present, Tag 201.
294    pub fn has_put_or_call(&self) -> bool {
295        self.message.body.has(tag::PUT_OR_CALL)
296    }
297
298
299
300
301    /// Sets `QuoteReqID`, Tag 131.
302    pub fn set_quote_req_id(&mut self, v: String) {
303        self.message.body.set_field(tag::QUOTE_REQ_ID, FIXString::from(v));
304    }
305
306    /// Gets `QuoteReqID`, Tag 131.
307    pub fn get_quote_req_id(&self) -> Result<String, MessageRejectErrorEnum> {
308        let mut fld = field::QuoteReqIDField::new(String::new());
309        self.message.body.get_field(tag::QUOTE_REQ_ID, &mut fld.0)?;
310        Ok(fld.value().to_string())
311    }
312
313
314    /// Returns true if `QuoteReqID` is present, Tag 131.
315    pub fn has_quote_req_id(&self) -> bool {
316        self.message.body.has(tag::QUOTE_REQ_ID)
317    }
318
319
320
321
322    /// Sets `SecurityDesc`, Tag 107.
323    pub fn set_security_desc(&mut self, v: String) {
324        self.message.body.set_field(tag::SECURITY_DESC, FIXString::from(v));
325    }
326
327    /// Gets `SecurityDesc`, Tag 107.
328    pub fn get_security_desc(&self) -> Result<String, MessageRejectErrorEnum> {
329        let mut fld = field::SecurityDescField::new(String::new());
330        self.message.body.get_field(tag::SECURITY_DESC, &mut fld.0)?;
331        Ok(fld.value().to_string())
332    }
333
334
335    /// Returns true if `SecurityDesc` is present, Tag 107.
336    pub fn has_security_desc(&self) -> bool {
337        self.message.body.has(tag::SECURITY_DESC)
338    }
339
340
341
342
343    /// Sets `SecurityExchange`, Tag 207.
344    pub fn set_security_exchange(&mut self, v: String) {
345        self.message.body.set_field(tag::SECURITY_EXCHANGE, FIXString::from(v));
346    }
347
348    /// Gets `SecurityExchange`, Tag 207.
349    pub fn get_security_exchange(&self) -> Result<String, MessageRejectErrorEnum> {
350        let mut fld = field::SecurityExchangeField::new(String::new());
351        self.message.body.get_field(tag::SECURITY_EXCHANGE, &mut fld.0)?;
352        Ok(fld.value().to_string())
353    }
354
355
356    /// Returns true if `SecurityExchange` is present, Tag 207.
357    pub fn has_security_exchange(&self) -> bool {
358        self.message.body.has(tag::SECURITY_EXCHANGE)
359    }
360
361
362
363
364    /// Sets `SecurityID`, Tag 48.
365    pub fn set_security_id(&mut self, v: String) {
366        self.message.body.set_field(tag::SECURITY_ID, FIXString::from(v));
367    }
368
369    /// Gets `SecurityID`, Tag 48.
370    pub fn get_security_id(&self) -> Result<String, MessageRejectErrorEnum> {
371        let mut fld = field::SecurityIDField::new(String::new());
372        self.message.body.get_field(tag::SECURITY_ID, &mut fld.0)?;
373        Ok(fld.value().to_string())
374    }
375
376
377    /// Returns true if `SecurityID` is present, Tag 48.
378    pub fn has_security_id(&self) -> bool {
379        self.message.body.has(tag::SECURITY_ID)
380    }
381
382
383
384
385    /// Sets `SecurityType`, Tag 167.
386    pub fn set_security_type(&mut self, v: String) {
387        self.message.body.set_field(tag::SECURITY_TYPE, FIXString::from(v));
388    }
389
390    /// Gets `SecurityType`, Tag 167.
391    pub fn get_security_type(&self) -> Result<String, MessageRejectErrorEnum> {
392        let mut fld = field::SecurityTypeField::new(String::new());
393        self.message.body.get_field(tag::SECURITY_TYPE, &mut fld.0)?;
394        Ok(fld.value().to_string())
395    }
396
397
398    /// Returns true if `SecurityType` is present, Tag 167.
399    pub fn has_security_type(&self) -> bool {
400        self.message.body.has(tag::SECURITY_TYPE)
401    }
402
403
404
405
406    /// Sets `Side`, Tag 54.
407    pub fn set_side(&mut self, v: String) {
408        self.message.body.set_field(tag::SIDE, FIXString::from(v));
409    }
410
411    /// Gets `Side`, Tag 54.
412    pub fn get_side(&self) -> Result<String, MessageRejectErrorEnum> {
413        let mut fld = field::SideField::new(String::new());
414        self.message.body.get_field(tag::SIDE, &mut fld.0)?;
415        Ok(fld.value().to_string())
416    }
417
418
419    /// Returns true if `Side` is present, Tag 54.
420    pub fn has_side(&self) -> bool {
421        self.message.body.has(tag::SIDE)
422    }
423
424
425
426
427    /// Sets `StrikePrice`, Tag 202.
428    pub fn set_strike_price(&mut self, val: Decimal, scale: i32) {
429        self.message.body.set_field(tag::STRIKE_PRICE, fixer::fix_decimal::FIXDecimal { decimal: val, scale });
430    }
431
432    /// Gets `StrikePrice`, Tag 202.
433    pub fn get_strike_price(&self) -> Result<Decimal, MessageRejectErrorEnum> {
434        let mut fld = field::StrikePriceField::new(Decimal::ZERO, 0);
435        self.message.body.get_field(tag::STRIKE_PRICE, &mut fld.0)?;
436        Ok(fld.value())
437    }
438
439
440    /// Returns true if `StrikePrice` is present, Tag 202.
441    pub fn has_strike_price(&self) -> bool {
442        self.message.body.has(tag::STRIKE_PRICE)
443    }
444
445
446
447
448    /// Sets `Symbol`, Tag 55.
449    pub fn set_symbol(&mut self, v: String) {
450        self.message.body.set_field(tag::SYMBOL, FIXString::from(v));
451    }
452
453    /// Gets `Symbol`, Tag 55.
454    pub fn get_symbol(&self) -> Result<String, MessageRejectErrorEnum> {
455        let mut fld = field::SymbolField::new(String::new());
456        self.message.body.get_field(tag::SYMBOL, &mut fld.0)?;
457        Ok(fld.value().to_string())
458    }
459
460
461    /// Returns true if `Symbol` is present, Tag 55.
462    pub fn has_symbol(&self) -> bool {
463        self.message.body.has(tag::SYMBOL)
464    }
465
466
467
468
469    /// Sets `SymbolSfx`, Tag 65.
470    pub fn set_symbol_sfx(&mut self, v: String) {
471        self.message.body.set_field(tag::SYMBOL_SFX, FIXString::from(v));
472    }
473
474    /// Gets `SymbolSfx`, Tag 65.
475    pub fn get_symbol_sfx(&self) -> Result<String, MessageRejectErrorEnum> {
476        let mut fld = field::SymbolSfxField::new(String::new());
477        self.message.body.get_field(tag::SYMBOL_SFX, &mut fld.0)?;
478        Ok(fld.value().to_string())
479    }
480
481
482    /// Returns true if `SymbolSfx` is present, Tag 65.
483    pub fn has_symbol_sfx(&self) -> bool {
484        self.message.body.has(tag::SYMBOL_SFX)
485    }
486
487
488}
489
490/// `RouteOut` is the callback type for routing `QuoteRequest` messages.
491pub type RouteOut = fn(msg: QuoteRequest, session_id: SessionID) -> Result<(), MessageRejectErrorEnum>;
492
493/// Route type returned by the `route` function.
494pub type Route = (&'static str, &'static str, Box<dyn Fn(&Message, SessionID) -> Result<(), MessageRejectErrorEnum> + Send>);
495
496/// Returns the begin string, message type, and route function for `QuoteRequest`.
497pub fn route(router: RouteOut) -> Route {
498    let r = move |msg: &Message, session_id: SessionID| -> Result<(), MessageRejectErrorEnum> {
499        router(QuoteRequest::from_message(msg.clone()), session_id)
500    };
501    ("FIX.4.1", "R", Box::new(r))
502}