Skip to main content

refix_fix44/generated/messages/
collateral_request.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, LazyKnownTags, RawMessage, Tag, UtcTimestamp,
6};
7
8use super::super::components::{
9    ExecCollGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument, MiscFeesGrp, Parties,
10    SpreadOrBenchmarkCurveData, Stipulations, Trailer, TrdCollGrp, TrdRegTimestamps,
11    UndInstrmtCollGrp,
12};
13use super::super::enums::{AccountType, CollAsgnReason, PriceType, QtyType, SettlSessID, Side};
14
15/// The `CollateralRequest` (35=AX) message.
16pub struct CollateralRequest(RawMessage);
17
18impl CollateralRequest {
19    pub const MSG_TYPE: &[u8] = b"AX";
20
21    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
22        static TAGS: LazyKnownTags = LazyKnownTags::new(
23            &[
24                Tag(894), Tag(895), Tag(60), Tag(126), Tag(453), Tag(1), Tag(581), Tag(11), Tag(37),
25                Tag(198), Tag(526), Tag(124), Tag(897), Tag(64), Tag(53), Tag(854), Tag(15),
26                Tag(555), Tag(711), Tag(899), Tag(900), Tag(901), Tag(768), Tag(54), Tag(136),
27                Tag(44), Tag(423), Tag(159), Tag(920), Tag(921), Tag(922), Tag(232), Tag(336),
28                Tag(625), Tag(716), Tag(717), Tag(715), Tag(58), Tag(354), Tag(355),
29            ],
30            &[
31                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
32                ExecCollGrp::known_tags(), TrdCollGrp::known_tags(), Instrument::known_tags(),
33                FinancingDetails::known_tags(), InstrmtLegGrp::known_tags(),
34                UndInstrmtCollGrp::known_tags(), TrdRegTimestamps::known_tags(),
35                MiscFeesGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
36                Stipulations::known_tags(),
37            ],
38        );
39        &TAGS
40    }
41
42    pub fn from_raw(raw: RawMessage) -> Self {
43        Self(raw)
44    }
45
46    pub fn raw(&self) -> &RawMessage {
47        &self.0
48    }
49
50    pub fn header(&self) -> Header<'_> {
51        Header(self.0.scope(), Self::known_tags().get())
52    }
53
54    pub fn trailer(&self) -> Trailer<'_> {
55        Trailer(self.0.scope())
56    }
57
58    /// The `CollReqID` (894) field.
59    #[doc(alias = "CollReqID")]
60    pub fn coll_req_id(&self) -> Result<Option<&str>, InvalidValue> {
61        self.0.get_str(Tag(894))
62    }
63
64    /// The `CollAsgnReason` (895) field.
65    #[doc(alias = "CollAsgnReason")]
66    pub fn coll_asgn_reason(&self) -> Result<Option<CollAsgnReason>, InvalidValue> {
67        Ok(self.0.get_int(Tag(895))?.map(CollAsgnReason::from_value))
68    }
69
70    /// The `TransactTime` (60) field.
71    #[doc(alias = "TransactTime")]
72    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
73        self.0.get_utc_timestamp(Tag(60))
74    }
75
76    /// The `ExpireTime` (126) field.
77    #[doc(alias = "ExpireTime")]
78    pub fn expire_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
79        self.0.get_utc_timestamp(Tag(126))
80    }
81
82    /// The instances of the `NoPartyIDs` (453) group.
83    #[doc(alias = "NoPartyIDs")]
84    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
85        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
86    }
87
88    /// The `Account` (1) field.
89    #[doc(alias = "Account")]
90    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
91        self.0.get_str(Tag(1))
92    }
93
94    /// The `AccountType` (581) field.
95    #[doc(alias = "AccountType")]
96    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
97        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
98    }
99
100    /// The `ClOrdID` (11) field.
101    #[doc(alias = "ClOrdID")]
102    pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
103        self.0.get_str(Tag(11))
104    }
105
106    /// The `OrderID` (37) field.
107    #[doc(alias = "OrderID")]
108    pub fn order_id(&self) -> Result<Option<&str>, InvalidValue> {
109        self.0.get_str(Tag(37))
110    }
111
112    /// The `SecondaryOrderID` (198) field.
113    #[doc(alias = "SecondaryOrderID")]
114    pub fn secondary_order_id(&self) -> Result<Option<&str>, InvalidValue> {
115        self.0.get_str(Tag(198))
116    }
117
118    /// The `SecondaryClOrdID` (526) field.
119    #[doc(alias = "SecondaryClOrdID")]
120    pub fn secondary_cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
121        self.0.get_str(Tag(526))
122    }
123
124    /// The instances of the `NoExecs` (124) group.
125    #[doc(alias = "NoExecs")]
126    pub fn execs(&self) -> Result<Instances<'_, ExecCollGrp<'_>>, InvalidValue> {
127        self.0.get_group(&ExecCollGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
128    }
129
130    /// The instances of the `NoTrades` (897) group.
131    #[doc(alias = "NoTrades")]
132    pub fn trades(&self) -> Result<Instances<'_, TrdCollGrp<'_>>, InvalidValue> {
133        self.0.get_group(&TrdCollGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
134    }
135
136    /// The `Instrument` component.
137    pub fn instrument(&self) -> Instrument<'_> {
138        Instrument(self.0.scope(), Self::known_tags().get())
139    }
140
141    /// The `FinancingDetails` component.
142    pub fn financing_details(&self) -> FinancingDetails<'_> {
143        FinancingDetails(self.0.scope())
144    }
145
146    /// The `SettlDate` (64) field.
147    #[doc(alias = "SettlDate")]
148    pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
149        self.0.get_date(Tag(64))
150    }
151
152    /// The `Quantity` (53) field.
153    #[doc(alias = "Quantity")]
154    pub fn quantity(&self) -> Result<Option<Decimal>, InvalidValue> {
155        self.0.get_decimal(Tag(53))
156    }
157
158    /// The `QtyType` (854) field.
159    #[doc(alias = "QtyType")]
160    pub fn qty_type(&self) -> Result<Option<QtyType>, InvalidValue> {
161        Ok(self.0.get_int(Tag(854))?.map(QtyType::from_value))
162    }
163
164    /// The `Currency` (15) field.
165    #[doc(alias = "Currency")]
166    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
167        self.0.get_str(Tag(15))
168    }
169
170    /// The instances of the `NoLegs` (555) group.
171    #[doc(alias = "NoLegs")]
172    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
173        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
174    }
175
176    /// The instances of the `NoUnderlyings` (711) group.
177    #[doc(alias = "NoUnderlyings")]
178    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtCollGrp<'_>>, InvalidValue> {
179        self.0.get_group(&UndInstrmtCollGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
180    }
181
182    /// The `MarginExcess` (899) field.
183    #[doc(alias = "MarginExcess")]
184    pub fn margin_excess(&self) -> Result<Option<Decimal>, InvalidValue> {
185        self.0.get_decimal(Tag(899))
186    }
187
188    /// The `TotalNetValue` (900) field.
189    #[doc(alias = "TotalNetValue")]
190    pub fn total_net_value(&self) -> Result<Option<Decimal>, InvalidValue> {
191        self.0.get_decimal(Tag(900))
192    }
193
194    /// The `CashOutstanding` (901) field.
195    #[doc(alias = "CashOutstanding")]
196    pub fn cash_outstanding(&self) -> Result<Option<Decimal>, InvalidValue> {
197        self.0.get_decimal(Tag(901))
198    }
199
200    /// The instances of the `NoTrdRegTimestamps` (768) group.
201    #[doc(alias = "NoTrdRegTimestamps")]
202    pub fn trd_reg_timestamps(&self) -> Result<Instances<'_, TrdRegTimestamps<'_>>, InvalidValue> {
203        self.0.get_group(&TrdRegTimestamps::TABLE, &Self::known_tags().get()).map(Instances::from)
204    }
205
206    /// The `Side` (54) field.
207    #[doc(alias = "Side")]
208    pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
209        Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
210    }
211
212    /// The instances of the `NoMiscFees` (136) group.
213    #[doc(alias = "NoMiscFees")]
214    pub fn misc_fees(&self) -> Result<Instances<'_, MiscFeesGrp<'_>>, InvalidValue> {
215        self.0.get_group(&MiscFeesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
216    }
217
218    /// The `Price` (44) field.
219    #[doc(alias = "Price")]
220    pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
221        self.0.get_decimal(Tag(44))
222    }
223
224    /// The `PriceType` (423) field.
225    #[doc(alias = "PriceType")]
226    pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
227        Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
228    }
229
230    /// The `AccruedInterestAmt` (159) field.
231    #[doc(alias = "AccruedInterestAmt")]
232    pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
233        self.0.get_decimal(Tag(159))
234    }
235
236    /// The `EndAccruedInterestAmt` (920) field.
237    #[doc(alias = "EndAccruedInterestAmt")]
238    pub fn end_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
239        self.0.get_decimal(Tag(920))
240    }
241
242    /// The `StartCash` (921) field.
243    #[doc(alias = "StartCash")]
244    pub fn start_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
245        self.0.get_decimal(Tag(921))
246    }
247
248    /// The `EndCash` (922) field.
249    #[doc(alias = "EndCash")]
250    pub fn end_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
251        self.0.get_decimal(Tag(922))
252    }
253
254    /// The `SpreadOrBenchmarkCurveData` component.
255    pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
256        SpreadOrBenchmarkCurveData(self.0.scope())
257    }
258
259    /// The instances of the `NoStipulations` (232) group.
260    #[doc(alias = "NoStipulations")]
261    pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
262        self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
263    }
264
265    /// The `TradingSessionID` (336) field.
266    #[doc(alias = "TradingSessionID")]
267    pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
268        self.0.get_str(Tag(336))
269    }
270
271    /// The `TradingSessionSubID` (625) field.
272    #[doc(alias = "TradingSessionSubID")]
273    pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
274        self.0.get_str(Tag(625))
275    }
276
277    /// The `SettlSessID` (716) field.
278    #[doc(alias = "SettlSessID")]
279    pub fn settl_sess_id(&self) -> Result<Option<SettlSessID<'_>>, InvalidValue> {
280        Ok(self.0.get_str(Tag(716))?.map(SettlSessID::from_value))
281    }
282
283    /// The `SettlSessSubID` (717) field.
284    #[doc(alias = "SettlSessSubID")]
285    pub fn settl_sess_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
286        self.0.get_str(Tag(717))
287    }
288
289    /// The `ClearingBusinessDate` (715) field.
290    #[doc(alias = "ClearingBusinessDate")]
291    pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
292        self.0.get_date(Tag(715))
293    }
294
295    /// The `Text` (58) field.
296    #[doc(alias = "Text")]
297    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
298        self.0.get_str(Tag(58))
299    }
300
301    /// The `EncodedTextLen` (354) field.
302    #[doc(alias = "EncodedTextLen")]
303    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
304        self.0.get_int(Tag(354))
305    }
306
307    /// The `EncodedText` (355) field.
308    #[doc(alias = "EncodedText")]
309    pub fn encoded_text(&self) -> Option<&[u8]> {
310        self.0.get(Tag(355))
311    }
312}
313
314impl std::fmt::Debug for CollateralRequest {
315    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
316        write!(f, "CollateralRequest({})", self.0)
317    }
318}
319
320impl std::fmt::Display for CollateralRequest {
321    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
322        std::fmt::Display::fmt(&self.0, f)
323    }
324}