refix_fix44/generated/messages/
collateral_request.rs1#![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
15pub 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 #[doc(alias = "CollReqID")]
60 pub fn coll_req_id(&self) -> Result<Option<&str>, InvalidValue> {
61 self.0.get_str(Tag(894))
62 }
63
64 #[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 #[doc(alias = "TransactTime")]
72 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
73 self.0.get_utc_timestamp(Tag(60))
74 }
75
76 #[doc(alias = "ExpireTime")]
78 pub fn expire_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
79 self.0.get_utc_timestamp(Tag(126))
80 }
81
82 #[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 #[doc(alias = "Account")]
90 pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
91 self.0.get_str(Tag(1))
92 }
93
94 #[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 #[doc(alias = "ClOrdID")]
102 pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
103 self.0.get_str(Tag(11))
104 }
105
106 #[doc(alias = "OrderID")]
108 pub fn order_id(&self) -> Result<Option<&str>, InvalidValue> {
109 self.0.get_str(Tag(37))
110 }
111
112 #[doc(alias = "SecondaryOrderID")]
114 pub fn secondary_order_id(&self) -> Result<Option<&str>, InvalidValue> {
115 self.0.get_str(Tag(198))
116 }
117
118 #[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 #[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 #[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 pub fn instrument(&self) -> Instrument<'_> {
138 Instrument(self.0.scope(), Self::known_tags().get())
139 }
140
141 pub fn financing_details(&self) -> FinancingDetails<'_> {
143 FinancingDetails(self.0.scope())
144 }
145
146 #[doc(alias = "SettlDate")]
148 pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
149 self.0.get_date(Tag(64))
150 }
151
152 #[doc(alias = "Quantity")]
154 pub fn quantity(&self) -> Result<Option<Decimal>, InvalidValue> {
155 self.0.get_decimal(Tag(53))
156 }
157
158 #[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 #[doc(alias = "Currency")]
166 pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
167 self.0.get_str(Tag(15))
168 }
169
170 #[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 #[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 #[doc(alias = "MarginExcess")]
184 pub fn margin_excess(&self) -> Result<Option<Decimal>, InvalidValue> {
185 self.0.get_decimal(Tag(899))
186 }
187
188 #[doc(alias = "TotalNetValue")]
190 pub fn total_net_value(&self) -> Result<Option<Decimal>, InvalidValue> {
191 self.0.get_decimal(Tag(900))
192 }
193
194 #[doc(alias = "CashOutstanding")]
196 pub fn cash_outstanding(&self) -> Result<Option<Decimal>, InvalidValue> {
197 self.0.get_decimal(Tag(901))
198 }
199
200 #[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 #[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 #[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 #[doc(alias = "Price")]
220 pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
221 self.0.get_decimal(Tag(44))
222 }
223
224 #[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 #[doc(alias = "AccruedInterestAmt")]
232 pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
233 self.0.get_decimal(Tag(159))
234 }
235
236 #[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 #[doc(alias = "StartCash")]
244 pub fn start_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
245 self.0.get_decimal(Tag(921))
246 }
247
248 #[doc(alias = "EndCash")]
250 pub fn end_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
251 self.0.get_decimal(Tag(922))
252 }
253
254 pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
256 SpreadOrBenchmarkCurveData(self.0.scope())
257 }
258
259 #[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 #[doc(alias = "TradingSessionID")]
267 pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
268 self.0.get_str(Tag(336))
269 }
270
271 #[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 #[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 #[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 #[doc(alias = "ClearingBusinessDate")]
291 pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
292 self.0.get_date(Tag(715))
293 }
294
295 #[doc(alias = "Text")]
297 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
298 self.0.get_str(Tag(58))
299 }
300
301 #[doc(alias = "EncodedTextLen")]
303 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
304 self.0.get_int(Tag(354))
305 }
306
307 #[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}