Skip to main content

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