refix_fix42/generated/messages/
security_definition.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{
5 Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, MonthYear, RawMessage, Tag,
6};
7
8use super::super::components::{Header, Trailer};
9use super::super::enums::{IDSource, PutOrCall, SecurityResponseType, SecurityType, Side};
10
11pub struct SecurityDefinition(RawMessage);
13
14impl SecurityDefinition {
15 pub const MSG_TYPE: &[u8] = b"d";
16
17 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18 static TAGS: LazyKnownTags = LazyKnownTags::new(
19 &[
20 Tag(320), Tag(322), Tag(323), Tag(393), Tag(55), Tag(65), Tag(48), Tag(22),
21 Tag(167), Tag(200), Tag(205), Tag(201), Tag(202), Tag(206), Tag(231), Tag(223),
22 Tag(207), Tag(106), Tag(348), Tag(349), Tag(107), Tag(350), Tag(351), Tag(15),
23 Tag(336), Tag(58), Tag(354), Tag(355), Tag(146),
24 ],
25 &[
26 Header::known_tags(), Trailer::known_tags(),
27 SecurityDefinitionRelatedSym::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())
43 }
44
45 pub fn trailer(&self) -> Trailer<'_> {
46 Trailer(self.0.scope())
47 }
48
49 #[doc(alias = "SecurityReqID")]
51 pub fn security_req_id(&self) -> Result<Option<&str>, InvalidValue> {
52 self.0.get_str(Tag(320))
53 }
54
55 #[doc(alias = "SecurityResponseID")]
57 pub fn security_response_id(&self) -> Result<Option<&str>, InvalidValue> {
58 self.0.get_str(Tag(322))
59 }
60
61 #[doc(alias = "SecurityResponseType")]
63 pub fn security_response_type(&self) -> Result<Option<SecurityResponseType>, InvalidValue> {
64 Ok(self.0.get_int(Tag(323))?.map(SecurityResponseType::from_value))
65 }
66
67 #[doc(alias = "TotalNumSecurities")]
69 pub fn total_num_securities(&self) -> Result<Option<i64>, InvalidValue> {
70 self.0.get_int(Tag(393))
71 }
72
73 #[doc(alias = "Symbol")]
75 pub fn symbol(&self) -> Result<Option<&str>, InvalidValue> {
76 self.0.get_str(Tag(55))
77 }
78
79 #[doc(alias = "SymbolSfx")]
81 pub fn symbol_sfx(&self) -> Result<Option<&str>, InvalidValue> {
82 self.0.get_str(Tag(65))
83 }
84
85 #[doc(alias = "SecurityID")]
87 pub fn security_id(&self) -> Result<Option<&str>, InvalidValue> {
88 self.0.get_str(Tag(48))
89 }
90
91 #[doc(alias = "IDSource")]
93 pub fn id_source(&self) -> Result<Option<IDSource<'_>>, InvalidValue> {
94 Ok(self.0.get_str(Tag(22))?.map(IDSource::from_value))
95 }
96
97 #[doc(alias = "SecurityType")]
99 pub fn security_type(&self) -> Result<Option<SecurityType<'_>>, InvalidValue> {
100 Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
101 }
102
103 #[doc(alias = "MaturityMonthYear")]
105 pub fn maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
106 self.0.get_month_year(Tag(200))
107 }
108
109 #[doc(alias = "MaturityDay")]
111 pub fn maturity_day(&self) -> Result<Option<i64>, InvalidValue> {
112 self.0.get_int(Tag(205))
113 }
114
115 #[doc(alias = "PutOrCall")]
117 pub fn put_or_call(&self) -> Result<Option<PutOrCall>, InvalidValue> {
118 Ok(self.0.get_int(Tag(201))?.map(PutOrCall::from_value))
119 }
120
121 #[doc(alias = "StrikePrice")]
123 pub fn strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
124 self.0.get_decimal(Tag(202))
125 }
126
127 #[doc(alias = "OptAttribute")]
129 pub fn opt_attribute(&self) -> Result<Option<&str>, InvalidValue> {
130 self.0.get_str(Tag(206))
131 }
132
133 #[doc(alias = "ContractMultiplier")]
135 pub fn contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
136 self.0.get_decimal(Tag(231))
137 }
138
139 #[doc(alias = "CouponRate")]
141 pub fn coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
142 self.0.get_decimal(Tag(223))
143 }
144
145 #[doc(alias = "SecurityExchange")]
147 pub fn security_exchange(&self) -> Result<Option<&str>, InvalidValue> {
148 self.0.get_str(Tag(207))
149 }
150
151 #[doc(alias = "Issuer")]
153 pub fn issuer(&self) -> Result<Option<&str>, InvalidValue> {
154 self.0.get_str(Tag(106))
155 }
156
157 #[doc(alias = "EncodedIssuerLen")]
159 pub fn encoded_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
160 self.0.get_int(Tag(348))
161 }
162
163 #[doc(alias = "EncodedIssuer")]
165 pub fn encoded_issuer(&self) -> Option<&[u8]> {
166 self.0.get(Tag(349))
167 }
168
169 #[doc(alias = "SecurityDesc")]
171 pub fn security_desc(&self) -> Result<Option<&str>, InvalidValue> {
172 self.0.get_str(Tag(107))
173 }
174
175 #[doc(alias = "EncodedSecurityDescLen")]
177 pub fn encoded_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
178 self.0.get_int(Tag(350))
179 }
180
181 #[doc(alias = "EncodedSecurityDesc")]
183 pub fn encoded_security_desc(&self) -> Option<&[u8]> {
184 self.0.get(Tag(351))
185 }
186
187 #[doc(alias = "Currency")]
189 pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
190 self.0.get_str(Tag(15))
191 }
192
193 #[doc(alias = "TradingSessionID")]
195 pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
196 self.0.get_str(Tag(336))
197 }
198
199 #[doc(alias = "Text")]
201 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
202 self.0.get_str(Tag(58))
203 }
204
205 #[doc(alias = "EncodedTextLen")]
207 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
208 self.0.get_int(Tag(354))
209 }
210
211 #[doc(alias = "EncodedText")]
213 pub fn encoded_text(&self) -> Option<&[u8]> {
214 self.0.get(Tag(355))
215 }
216
217 #[doc(alias = "NoRelatedSym")]
219 pub fn related_sym(&self) -> Result<Instances<'_, SecurityDefinitionRelatedSym<'_>>, InvalidValue> {
220 self.0.get_group(&SecurityDefinitionRelatedSym::TABLE, &Self::known_tags().get()).map(Instances::from)
221 }
222}
223
224impl std::fmt::Debug for SecurityDefinition {
225 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
226 write!(f, "SecurityDefinition({})", self.0)
227 }
228}
229
230impl std::fmt::Display for SecurityDefinition {
231 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
232 std::fmt::Display::fmt(&self.0, f)
233 }
234}
235
236#[derive(Clone, Copy)]
238pub struct SecurityDefinitionRelatedSym<'a>(refix_message::Scope<'a>);
239
240impl<'a> From<refix_message::Scope<'a>> for SecurityDefinitionRelatedSym<'a> {
241 fn from(scope: refix_message::Scope<'a>) -> Self {
242 Self(scope)
243 }
244}
245
246impl<'a> SecurityDefinitionRelatedSym<'a> {
247 pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
248 Tag(146),
249 Tag(311),
250 &[
251 Tag(54), Tag(305), Tag(306), Tag(307), Tag(308), Tag(309), Tag(310), Tag(311), Tag(312),
252 Tag(313), Tag(314), Tag(315), Tag(316), Tag(317), Tag(318), Tag(319), Tag(362),
253 Tag(363), Tag(364), Tag(365), Tag(435), Tag(436),
254 ],
255 &[],
256 );
257
258 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
259 static TAGS: LazyKnownTags = LazyKnownTags::new(
260 &[
261 Tag(311), Tag(312), Tag(309), Tag(305), Tag(310), Tag(313), Tag(314), Tag(315),
262 Tag(316), Tag(317), Tag(436), Tag(435), Tag(308), Tag(306), Tag(362), Tag(363),
263 Tag(307), Tag(364), Tag(365), Tag(319), Tag(54), Tag(318),
264 ],
265 &[],
266 );
267 &TAGS
268 }
269
270 pub fn raw(&self) -> refix_message::Scope<'a> {
271 self.0
272 }
273
274 #[doc(alias = "UnderlyingSymbol")]
276 pub fn underlying_symbol(&self) -> Result<Option<&'a str>, InvalidValue> {
277 self.0.get_str(Tag(311))
278 }
279
280 #[doc(alias = "UnderlyingSymbolSfx")]
282 pub fn underlying_symbol_sfx(&self) -> Result<Option<&'a str>, InvalidValue> {
283 self.0.get_str(Tag(312))
284 }
285
286 #[doc(alias = "UnderlyingSecurityID")]
288 pub fn underlying_security_id(&self) -> Result<Option<&'a str>, InvalidValue> {
289 self.0.get_str(Tag(309))
290 }
291
292 #[doc(alias = "UnderlyingIDSource")]
294 pub fn underlying_id_source(&self) -> Result<Option<&'a str>, InvalidValue> {
295 self.0.get_str(Tag(305))
296 }
297
298 #[doc(alias = "UnderlyingSecurityType")]
300 pub fn underlying_security_type(&self) -> Result<Option<&'a str>, InvalidValue> {
301 self.0.get_str(Tag(310))
302 }
303
304 #[doc(alias = "UnderlyingMaturityMonthYear")]
306 pub fn underlying_maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
307 self.0.get_month_year(Tag(313))
308 }
309
310 #[doc(alias = "UnderlyingMaturityDay")]
312 pub fn underlying_maturity_day(&self) -> Result<Option<i64>, InvalidValue> {
313 self.0.get_int(Tag(314))
314 }
315
316 #[doc(alias = "UnderlyingPutOrCall")]
318 pub fn underlying_put_or_call(&self) -> Result<Option<i64>, InvalidValue> {
319 self.0.get_int(Tag(315))
320 }
321
322 #[doc(alias = "UnderlyingStrikePrice")]
324 pub fn underlying_strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
325 self.0.get_decimal(Tag(316))
326 }
327
328 #[doc(alias = "UnderlyingOptAttribute")]
330 pub fn underlying_opt_attribute(&self) -> Result<Option<&'a str>, InvalidValue> {
331 self.0.get_str(Tag(317))
332 }
333
334 #[doc(alias = "UnderlyingContractMultiplier")]
336 pub fn underlying_contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
337 self.0.get_decimal(Tag(436))
338 }
339
340 #[doc(alias = "UnderlyingCouponRate")]
342 pub fn underlying_coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
343 self.0.get_decimal(Tag(435))
344 }
345
346 #[doc(alias = "UnderlyingSecurityExchange")]
348 pub fn underlying_security_exchange(&self) -> Result<Option<&'a str>, InvalidValue> {
349 self.0.get_str(Tag(308))
350 }
351
352 #[doc(alias = "UnderlyingIssuer")]
354 pub fn underlying_issuer(&self) -> Result<Option<&'a str>, InvalidValue> {
355 self.0.get_str(Tag(306))
356 }
357
358 #[doc(alias = "EncodedUnderlyingIssuerLen")]
360 pub fn encoded_underlying_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
361 self.0.get_int(Tag(362))
362 }
363
364 #[doc(alias = "EncodedUnderlyingIssuer")]
366 pub fn encoded_underlying_issuer(&self) -> Option<&'a [u8]> {
367 self.0.get(Tag(363))
368 }
369
370 #[doc(alias = "UnderlyingSecurityDesc")]
372 pub fn underlying_security_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
373 self.0.get_str(Tag(307))
374 }
375
376 #[doc(alias = "EncodedUnderlyingSecurityDescLen")]
378 pub fn encoded_underlying_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
379 self.0.get_int(Tag(364))
380 }
381
382 #[doc(alias = "EncodedUnderlyingSecurityDesc")]
384 pub fn encoded_underlying_security_desc(&self) -> Option<&'a [u8]> {
385 self.0.get(Tag(365))
386 }
387
388 #[doc(alias = "RatioQty")]
390 pub fn ratio_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
391 self.0.get_decimal(Tag(319))
392 }
393
394 #[doc(alias = "Side")]
396 pub fn side(&self) -> Result<Option<Side<'a>>, InvalidValue> {
397 Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
398 }
399
400 #[doc(alias = "UnderlyingCurrency")]
402 pub fn underlying_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
403 self.0.get_str(Tag(318))
404 }
405}
406
407impl std::fmt::Debug for SecurityDefinitionRelatedSym<'_> {
408 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
409 write!(f, "SecurityDefinitionRelatedSym({})", self.0)
410 }
411}