Skip to main content

refix_fix44/generated/messages/
security_status.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{
5    Decimal, Instances, InvalidValue, LazyKnownTags, MultipleValues, RawMessage, Tag, UtcTimestamp,
6};
7
8use super::super::components::{
9    Header, InstrmtLegGrp, Instrument, InstrumentExtension, Trailer, UndInstrmtGrp,
10};
11use super::super::enums::{
12    Adjustment, CorporateAction, FinancialStatus, HaltReasonChar, SecurityTradingStatus,
13};
14
15/// The `SecurityStatus` (35=f) message.
16pub struct SecurityStatus(RawMessage);
17
18impl SecurityStatus {
19    pub const MSG_TYPE: &[u8] = b"f";
20
21    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
22        static TAGS: LazyKnownTags = LazyKnownTags::new(
23            &[
24                Tag(324), Tag(711), Tag(555), Tag(15), Tag(336), Tag(625), Tag(325), Tag(326),
25                Tag(291), Tag(292), Tag(327), Tag(328), Tag(329), Tag(330), Tag(331), Tag(332),
26                Tag(333), Tag(31), Tag(60), Tag(334), Tag(58), Tag(354), Tag(355),
27            ],
28            &[
29                Header::known_tags(), Trailer::known_tags(), Instrument::known_tags(),
30                InstrumentExtension::known_tags(), UndInstrmtGrp::known_tags(),
31                InstrmtLegGrp::known_tags(),
32            ],
33        );
34        &TAGS
35    }
36
37    pub fn from_raw(raw: RawMessage) -> Self {
38        Self(raw)
39    }
40
41    pub fn raw(&self) -> &RawMessage {
42        &self.0
43    }
44
45    pub fn header(&self) -> Header<'_> {
46        Header(self.0.scope(), Self::known_tags().get())
47    }
48
49    pub fn trailer(&self) -> Trailer<'_> {
50        Trailer(self.0.scope())
51    }
52
53    /// The `SecurityStatusReqID` (324) field.
54    #[doc(alias = "SecurityStatusReqID")]
55    pub fn security_status_req_id(&self) -> Result<Option<&str>, InvalidValue> {
56        self.0.get_str(Tag(324))
57    }
58
59    /// The `Instrument` component.
60    pub fn instrument(&self) -> Instrument<'_> {
61        Instrument(self.0.scope(), Self::known_tags().get())
62    }
63
64    /// The `InstrumentExtension` component.
65    pub fn instrument_extension(&self) -> InstrumentExtension<'_> {
66        InstrumentExtension(self.0.scope(), Self::known_tags().get())
67    }
68
69    /// The instances of the `NoUnderlyings` (711) group.
70    #[doc(alias = "NoUnderlyings")]
71    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
72        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
73    }
74
75    /// The instances of the `NoLegs` (555) group.
76    #[doc(alias = "NoLegs")]
77    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
78        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
79    }
80
81    /// The `Currency` (15) field.
82    #[doc(alias = "Currency")]
83    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
84        self.0.get_str(Tag(15))
85    }
86
87    /// The `TradingSessionID` (336) field.
88    #[doc(alias = "TradingSessionID")]
89    pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
90        self.0.get_str(Tag(336))
91    }
92
93    /// The `TradingSessionSubID` (625) field.
94    #[doc(alias = "TradingSessionSubID")]
95    pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
96        self.0.get_str(Tag(625))
97    }
98
99    /// The `UnsolicitedIndicator` (325) field.
100    #[doc(alias = "UnsolicitedIndicator")]
101    pub fn unsolicited_indicator(&self) -> Result<Option<bool>, InvalidValue> {
102        self.0.get_bool(Tag(325))
103    }
104
105    /// The `SecurityTradingStatus` (326) field.
106    #[doc(alias = "SecurityTradingStatus")]
107    pub fn security_trading_status(&self) -> Result<Option<SecurityTradingStatus>, InvalidValue> {
108        Ok(self.0.get_int(Tag(326))?.map(SecurityTradingStatus::from_value))
109    }
110
111    /// The `FinancialStatus` (291) field.
112    #[doc(alias = "FinancialStatus")]
113    pub fn financial_status(&self) -> Result<Option<MultipleValues<'_, FinancialStatus<'_>>>, InvalidValue> {
114        self.0.get_multiple_values(Tag(291))
115    }
116
117    /// The `CorporateAction` (292) field.
118    #[doc(alias = "CorporateAction")]
119    pub fn corporate_action(&self) -> Result<Option<MultipleValues<'_, CorporateAction<'_>>>, InvalidValue> {
120        self.0.get_multiple_values(Tag(292))
121    }
122
123    /// The `HaltReasonChar` (327) field.
124    #[doc(alias = "HaltReasonChar")]
125    pub fn halt_reason_char(&self) -> Result<Option<HaltReasonChar<'_>>, InvalidValue> {
126        Ok(self.0.get_str(Tag(327))?.map(HaltReasonChar::from_value))
127    }
128
129    /// The `InViewOfCommon` (328) field.
130    #[doc(alias = "InViewOfCommon")]
131    pub fn in_view_of_common(&self) -> Result<Option<bool>, InvalidValue> {
132        self.0.get_bool(Tag(328))
133    }
134
135    /// The `DueToRelated` (329) field.
136    #[doc(alias = "DueToRelated")]
137    pub fn due_to_related(&self) -> Result<Option<bool>, InvalidValue> {
138        self.0.get_bool(Tag(329))
139    }
140
141    /// The `BuyVolume` (330) field.
142    #[doc(alias = "BuyVolume")]
143    pub fn buy_volume(&self) -> Result<Option<Decimal>, InvalidValue> {
144        self.0.get_decimal(Tag(330))
145    }
146
147    /// The `SellVolume` (331) field.
148    #[doc(alias = "SellVolume")]
149    pub fn sell_volume(&self) -> Result<Option<Decimal>, InvalidValue> {
150        self.0.get_decimal(Tag(331))
151    }
152
153    /// The `HighPx` (332) field.
154    #[doc(alias = "HighPx")]
155    pub fn high_px(&self) -> Result<Option<Decimal>, InvalidValue> {
156        self.0.get_decimal(Tag(332))
157    }
158
159    /// The `LowPx` (333) field.
160    #[doc(alias = "LowPx")]
161    pub fn low_px(&self) -> Result<Option<Decimal>, InvalidValue> {
162        self.0.get_decimal(Tag(333))
163    }
164
165    /// The `LastPx` (31) field.
166    #[doc(alias = "LastPx")]
167    pub fn last_px(&self) -> Result<Option<Decimal>, InvalidValue> {
168        self.0.get_decimal(Tag(31))
169    }
170
171    /// The `TransactTime` (60) field.
172    #[doc(alias = "TransactTime")]
173    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
174        self.0.get_utc_timestamp(Tag(60))
175    }
176
177    /// The `Adjustment` (334) field.
178    #[doc(alias = "Adjustment")]
179    pub fn adjustment(&self) -> Result<Option<Adjustment>, InvalidValue> {
180        Ok(self.0.get_int(Tag(334))?.map(Adjustment::from_value))
181    }
182
183    /// The `Text` (58) field.
184    #[doc(alias = "Text")]
185    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
186        self.0.get_str(Tag(58))
187    }
188
189    /// The `EncodedTextLen` (354) field.
190    #[doc(alias = "EncodedTextLen")]
191    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
192        self.0.get_int(Tag(354))
193    }
194
195    /// The `EncodedText` (355) field.
196    #[doc(alias = "EncodedText")]
197    pub fn encoded_text(&self) -> Option<&[u8]> {
198        self.0.get(Tag(355))
199    }
200}
201
202impl std::fmt::Debug for SecurityStatus {
203    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
204        write!(f, "SecurityStatus({})", self.0)
205    }
206}
207
208impl std::fmt::Display for SecurityStatus {
209    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
210        std::fmt::Display::fmt(&self.0, f)
211    }
212}