Skip to main content

refix_fix44/generated/messages/
order_cancel_request.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};
5
6use super::super::components::{
7    FinancingDetails, Header, Instrument, OrderQtyData, Parties, Trailer, UndInstrmtGrp,
8};
9use super::super::enums::{AccountType, AcctIDSource, Side};
10
11/// The `OrderCancelRequest` (35=F) message.
12pub struct OrderCancelRequest(RawMessage);
13
14impl OrderCancelRequest {
15    pub const MSG_TYPE: &[u8] = b"F";
16
17    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18        static TAGS: LazyKnownTags = LazyKnownTags::new(
19            &[
20                Tag(41), Tag(37), Tag(11), Tag(526), Tag(583), Tag(66), Tag(586), Tag(1), Tag(660),
21                Tag(581), Tag(453), Tag(711), Tag(54), Tag(60), Tag(376), Tag(58), Tag(354),
22                Tag(355),
23            ],
24            &[
25                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
26                Instrument::known_tags(), FinancingDetails::known_tags(),
27                UndInstrmtGrp::known_tags(), OrderQtyData::known_tags(),
28            ],
29        );
30        &TAGS
31    }
32
33    pub fn from_raw(raw: RawMessage) -> Self {
34        Self(raw)
35    }
36
37    pub fn raw(&self) -> &RawMessage {
38        &self.0
39    }
40
41    pub fn header(&self) -> Header<'_> {
42        Header(self.0.scope(), Self::known_tags().get())
43    }
44
45    pub fn trailer(&self) -> Trailer<'_> {
46        Trailer(self.0.scope())
47    }
48
49    /// The `OrigClOrdID` (41) field.
50    #[doc(alias = "OrigClOrdID")]
51    pub fn orig_cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
52        self.0.get_str(Tag(41))
53    }
54
55    /// The `OrderID` (37) field.
56    #[doc(alias = "OrderID")]
57    pub fn order_id(&self) -> Result<Option<&str>, InvalidValue> {
58        self.0.get_str(Tag(37))
59    }
60
61    /// The `ClOrdID` (11) field.
62    #[doc(alias = "ClOrdID")]
63    pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
64        self.0.get_str(Tag(11))
65    }
66
67    /// The `SecondaryClOrdID` (526) field.
68    #[doc(alias = "SecondaryClOrdID")]
69    pub fn secondary_cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
70        self.0.get_str(Tag(526))
71    }
72
73    /// The `ClOrdLinkID` (583) field.
74    #[doc(alias = "ClOrdLinkID")]
75    pub fn cl_ord_link_id(&self) -> Result<Option<&str>, InvalidValue> {
76        self.0.get_str(Tag(583))
77    }
78
79    /// The `ListID` (66) field.
80    #[doc(alias = "ListID")]
81    pub fn list_id(&self) -> Result<Option<&str>, InvalidValue> {
82        self.0.get_str(Tag(66))
83    }
84
85    /// The `OrigOrdModTime` (586) field.
86    #[doc(alias = "OrigOrdModTime")]
87    pub fn orig_ord_mod_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
88        self.0.get_utc_timestamp(Tag(586))
89    }
90
91    /// The `Account` (1) field.
92    #[doc(alias = "Account")]
93    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
94        self.0.get_str(Tag(1))
95    }
96
97    /// The `AcctIDSource` (660) field.
98    #[doc(alias = "AcctIDSource")]
99    pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
100        Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
101    }
102
103    /// The `AccountType` (581) field.
104    #[doc(alias = "AccountType")]
105    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
106        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
107    }
108
109    /// The instances of the `NoPartyIDs` (453) group.
110    #[doc(alias = "NoPartyIDs")]
111    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
112        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
113    }
114
115    /// The `Instrument` component.
116    pub fn instrument(&self) -> Instrument<'_> {
117        Instrument(self.0.scope(), Self::known_tags().get())
118    }
119
120    /// The `FinancingDetails` component.
121    pub fn financing_details(&self) -> FinancingDetails<'_> {
122        FinancingDetails(self.0.scope())
123    }
124
125    /// The instances of the `NoUnderlyings` (711) group.
126    #[doc(alias = "NoUnderlyings")]
127    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
128        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
129    }
130
131    /// The `Side` (54) field.
132    #[doc(alias = "Side")]
133    pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
134        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
135    }
136
137    /// The `TransactTime` (60) field.
138    #[doc(alias = "TransactTime")]
139    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
140        self.0.get_utc_timestamp(Tag(60))
141    }
142
143    /// The `OrderQtyData` component.
144    pub fn order_qty_data(&self) -> OrderQtyData<'_> {
145        OrderQtyData(self.0.scope())
146    }
147
148    /// The `ComplianceID` (376) field.
149    #[doc(alias = "ComplianceID")]
150    pub fn compliance_id(&self) -> Result<Option<&str>, InvalidValue> {
151        self.0.get_str(Tag(376))
152    }
153
154    /// The `Text` (58) field.
155    #[doc(alias = "Text")]
156    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
157        self.0.get_str(Tag(58))
158    }
159
160    /// The `EncodedTextLen` (354) field.
161    #[doc(alias = "EncodedTextLen")]
162    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
163        self.0.get_int(Tag(354))
164    }
165
166    /// The `EncodedText` (355) field.
167    #[doc(alias = "EncodedText")]
168    pub fn encoded_text(&self) -> Option<&[u8]> {
169        self.0.get(Tag(355))
170    }
171}
172
173impl std::fmt::Debug for OrderCancelRequest {
174    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
175        write!(f, "OrderCancelRequest({})", self.0)
176    }
177}
178
179impl std::fmt::Display for OrderCancelRequest {
180    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
181        std::fmt::Display::fmt(&self.0, f)
182    }
183}