Skip to main content

refix_fix44/generated/components/
instrument.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{
5    Date, Decimal, Instances, InvalidValue, KnownTags, LazyKnownTags, MonthYear, Tag,
6};
7
8use super::super::enums::{CPProgram, Product, PutOrCall, SecurityIDSource, SecurityType};
9use super::{EvntGrp, SecAltIDGrp};
10
11/// The fields of the `Instrument` component.
12#[derive(Clone, Copy)]
13pub struct Instrument<'a>(
14    pub(in super::super) refix_message::Scope<'a>,
15    pub(in super::super) KnownTags<'static>,
16);
17
18impl<'a> Instrument<'a> {
19    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
20        static TAGS: LazyKnownTags = LazyKnownTags::new(
21            &[
22                Tag(55), Tag(65), Tag(48), Tag(22), Tag(454), Tag(460), Tag(461), Tag(167),
23                Tag(762), Tag(200), Tag(541), Tag(201), Tag(224), Tag(225), Tag(239), Tag(226),
24                Tag(227), Tag(228), Tag(255), Tag(543), Tag(470), Tag(471), Tag(472), Tag(240),
25                Tag(202), Tag(947), Tag(206), Tag(231), Tag(223), Tag(207), Tag(106), Tag(348),
26                Tag(349), Tag(107), Tag(350), Tag(351), Tag(691), Tag(667), Tag(875), Tag(876),
27                Tag(864), Tag(873), Tag(874),
28            ],
29            &[SecAltIDGrp::known_tags(), EvntGrp::known_tags()],
30        );
31        &TAGS
32    }
33
34    pub fn raw(&self) -> refix_message::Scope<'a> {
35        self.0
36    }
37
38    /// The `Symbol` (55) field.
39    #[doc(alias = "Symbol")]
40    pub fn symbol(&self) -> Result<Option<&'a str>, InvalidValue> {
41        self.0.get_str(Tag(55))
42    }
43
44    /// The `SymbolSfx` (65) field.
45    #[doc(alias = "SymbolSfx")]
46    pub fn symbol_sfx(&self) -> Result<Option<&'a str>, InvalidValue> {
47        self.0.get_str(Tag(65))
48    }
49
50    /// The `SecurityID` (48) field.
51    #[doc(alias = "SecurityID")]
52    pub fn security_id(&self) -> Result<Option<&'a str>, InvalidValue> {
53        self.0.get_str(Tag(48))
54    }
55
56    /// The `SecurityIDSource` (22) field.
57    #[doc(alias = "SecurityIDSource")]
58    pub fn security_id_source(&self) -> Result<Option<SecurityIDSource<'a>>, InvalidValue> {
59        Ok(self.0.get_str(Tag(22))?.map(SecurityIDSource::from_value))
60    }
61
62    /// The instances of the `NoSecurityAltID` (454) group.
63    #[doc(alias = "NoSecurityAltID")]
64    pub fn security_alt_id(&self) -> Result<Instances<'a, SecAltIDGrp<'a>>, InvalidValue> {
65        self.0.get_group(&SecAltIDGrp::TABLE, &self.1).map(Instances::from)
66    }
67
68    /// The `Product` (460) field.
69    #[doc(alias = "Product")]
70    pub fn product(&self) -> Result<Option<Product>, InvalidValue> {
71        Ok(self.0.get_int(Tag(460))?.map(Product::from_value))
72    }
73
74    /// The `CFICode` (461) field.
75    #[doc(alias = "CFICode")]
76    pub fn cfi_code(&self) -> Result<Option<&'a str>, InvalidValue> {
77        self.0.get_str(Tag(461))
78    }
79
80    /// The `SecurityType` (167) field.
81    #[doc(alias = "SecurityType")]
82    pub fn security_type(&self) -> Result<Option<SecurityType<'a>>, InvalidValue> {
83        Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
84    }
85
86    /// The `SecuritySubType` (762) field.
87    #[doc(alias = "SecuritySubType")]
88    pub fn security_sub_type(&self) -> Result<Option<&'a str>, InvalidValue> {
89        self.0.get_str(Tag(762))
90    }
91
92    /// The `MaturityMonthYear` (200) field.
93    #[doc(alias = "MaturityMonthYear")]
94    pub fn maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
95        self.0.get_month_year(Tag(200))
96    }
97
98    /// The `MaturityDate` (541) field.
99    #[doc(alias = "MaturityDate")]
100    pub fn maturity_date(&self) -> Result<Option<Date>, InvalidValue> {
101        self.0.get_date(Tag(541))
102    }
103
104    /// The `PutOrCall` (201) field.
105    #[doc(alias = "PutOrCall")]
106    pub fn put_or_call(&self) -> Result<Option<PutOrCall>, InvalidValue> {
107        Ok(self.0.get_int(Tag(201))?.map(PutOrCall::from_value))
108    }
109
110    /// The `CouponPaymentDate` (224) field.
111    #[doc(alias = "CouponPaymentDate")]
112    pub fn coupon_payment_date(&self) -> Result<Option<Date>, InvalidValue> {
113        self.0.get_date(Tag(224))
114    }
115
116    /// The `IssueDate` (225) field.
117    #[doc(alias = "IssueDate")]
118    pub fn issue_date(&self) -> Result<Option<Date>, InvalidValue> {
119        self.0.get_date(Tag(225))
120    }
121
122    /// The `RepoCollateralSecurityType` (239) field.
123    #[doc(alias = "RepoCollateralSecurityType")]
124    pub fn repo_collateral_security_type(&self) -> Result<Option<&'a str>, InvalidValue> {
125        self.0.get_str(Tag(239))
126    }
127
128    /// The `RepurchaseTerm` (226) field.
129    #[doc(alias = "RepurchaseTerm")]
130    pub fn repurchase_term(&self) -> Result<Option<i64>, InvalidValue> {
131        self.0.get_int(Tag(226))
132    }
133
134    /// The `RepurchaseRate` (227) field.
135    #[doc(alias = "RepurchaseRate")]
136    pub fn repurchase_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
137        self.0.get_decimal(Tag(227))
138    }
139
140    /// The `Factor` (228) field.
141    #[doc(alias = "Factor")]
142    pub fn factor(&self) -> Result<Option<Decimal>, InvalidValue> {
143        self.0.get_decimal(Tag(228))
144    }
145
146    /// The `CreditRating` (255) field.
147    #[doc(alias = "CreditRating")]
148    pub fn credit_rating(&self) -> Result<Option<&'a str>, InvalidValue> {
149        self.0.get_str(Tag(255))
150    }
151
152    /// The `InstrRegistry` (543) field.
153    #[doc(alias = "InstrRegistry")]
154    pub fn instr_registry(&self) -> Result<Option<&'a str>, InvalidValue> {
155        self.0.get_str(Tag(543))
156    }
157
158    /// The `CountryOfIssue` (470) field.
159    #[doc(alias = "CountryOfIssue")]
160    pub fn country_of_issue(&self) -> Result<Option<&'a str>, InvalidValue> {
161        self.0.get_str(Tag(470))
162    }
163
164    /// The `StateOrProvinceOfIssue` (471) field.
165    #[doc(alias = "StateOrProvinceOfIssue")]
166    pub fn state_or_province_of_issue(&self) -> Result<Option<&'a str>, InvalidValue> {
167        self.0.get_str(Tag(471))
168    }
169
170    /// The `LocaleOfIssue` (472) field.
171    #[doc(alias = "LocaleOfIssue")]
172    pub fn locale_of_issue(&self) -> Result<Option<&'a str>, InvalidValue> {
173        self.0.get_str(Tag(472))
174    }
175
176    /// The `RedemptionDate` (240) field.
177    #[doc(alias = "RedemptionDate")]
178    pub fn redemption_date(&self) -> Result<Option<Date>, InvalidValue> {
179        self.0.get_date(Tag(240))
180    }
181
182    /// The `StrikePrice` (202) field.
183    #[doc(alias = "StrikePrice")]
184    pub fn strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
185        self.0.get_decimal(Tag(202))
186    }
187
188    /// The `StrikeCurrency` (947) field.
189    #[doc(alias = "StrikeCurrency")]
190    pub fn strike_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
191        self.0.get_str(Tag(947))
192    }
193
194    /// The `OptAttribute` (206) field.
195    #[doc(alias = "OptAttribute")]
196    pub fn opt_attribute(&self) -> Result<Option<&'a str>, InvalidValue> {
197        self.0.get_str(Tag(206))
198    }
199
200    /// The `ContractMultiplier` (231) field.
201    #[doc(alias = "ContractMultiplier")]
202    pub fn contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
203        self.0.get_decimal(Tag(231))
204    }
205
206    /// The `CouponRate` (223) field.
207    #[doc(alias = "CouponRate")]
208    pub fn coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
209        self.0.get_decimal(Tag(223))
210    }
211
212    /// The `SecurityExchange` (207) field.
213    #[doc(alias = "SecurityExchange")]
214    pub fn security_exchange(&self) -> Result<Option<&'a str>, InvalidValue> {
215        self.0.get_str(Tag(207))
216    }
217
218    /// The `Issuer` (106) field.
219    #[doc(alias = "Issuer")]
220    pub fn issuer(&self) -> Result<Option<&'a str>, InvalidValue> {
221        self.0.get_str(Tag(106))
222    }
223
224    /// The `EncodedIssuerLen` (348) field.
225    #[doc(alias = "EncodedIssuerLen")]
226    pub fn encoded_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
227        self.0.get_int(Tag(348))
228    }
229
230    /// The `EncodedIssuer` (349) field.
231    #[doc(alias = "EncodedIssuer")]
232    pub fn encoded_issuer(&self) -> Option<&'a [u8]> {
233        self.0.get(Tag(349))
234    }
235
236    /// The `SecurityDesc` (107) field.
237    #[doc(alias = "SecurityDesc")]
238    pub fn security_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
239        self.0.get_str(Tag(107))
240    }
241
242    /// The `EncodedSecurityDescLen` (350) field.
243    #[doc(alias = "EncodedSecurityDescLen")]
244    pub fn encoded_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
245        self.0.get_int(Tag(350))
246    }
247
248    /// The `EncodedSecurityDesc` (351) field.
249    #[doc(alias = "EncodedSecurityDesc")]
250    pub fn encoded_security_desc(&self) -> Option<&'a [u8]> {
251        self.0.get(Tag(351))
252    }
253
254    /// The `Pool` (691) field.
255    #[doc(alias = "Pool")]
256    pub fn pool(&self) -> Result<Option<&'a str>, InvalidValue> {
257        self.0.get_str(Tag(691))
258    }
259
260    /// The `ContractSettlMonth` (667) field.
261    #[doc(alias = "ContractSettlMonth")]
262    pub fn contract_settl_month(&self) -> Result<Option<MonthYear>, InvalidValue> {
263        self.0.get_month_year(Tag(667))
264    }
265
266    /// The `CPProgram` (875) field.
267    #[doc(alias = "CPProgram")]
268    pub fn cp_program(&self) -> Result<Option<CPProgram>, InvalidValue> {
269        Ok(self.0.get_int(Tag(875))?.map(CPProgram::from_value))
270    }
271
272    /// The `CPRegType` (876) field.
273    #[doc(alias = "CPRegType")]
274    pub fn cp_reg_type(&self) -> Result<Option<&'a str>, InvalidValue> {
275        self.0.get_str(Tag(876))
276    }
277
278    /// The instances of the `NoEvents` (864) group.
279    #[doc(alias = "NoEvents")]
280    pub fn events(&self) -> Result<Instances<'a, EvntGrp<'a>>, InvalidValue> {
281        self.0.get_group(&EvntGrp::TABLE, &self.1).map(Instances::from)
282    }
283
284    /// The `DatedDate` (873) field.
285    #[doc(alias = "DatedDate")]
286    pub fn dated_date(&self) -> Result<Option<Date>, InvalidValue> {
287        self.0.get_date(Tag(873))
288    }
289
290    /// The `InterestAccrualDate` (874) field.
291    #[doc(alias = "InterestAccrualDate")]
292    pub fn interest_accrual_date(&self) -> Result<Option<Date>, InvalidValue> {
293        self.0.get_date(Tag(874))
294    }
295}
296
297impl std::fmt::Debug for Instrument<'_> {
298    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
299        write!(f, "Instrument({})", self.0.display_known(&Self::known_tags().get()))
300    }
301}