1#![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 CommissionData, CpctyConfGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument,
10 InstrumentExtension, MiscFeesGrp, OrdAllocGrp, Parties, SettlInstructionsData,
11 SpreadOrBenchmarkCurveData, Stipulations, Trailer, TrdRegTimestamps, UndInstrmtGrp, YieldData,
12};
13use super::super::enums::{
14 AllocAccountType, ConfirmStatus, ConfirmTransType, ConfirmType, PriceType, ProcessCode, QtyType,
15 SettlCurrFxRateCalc, SettlType, Side,
16};
17
18pub struct Confirmation(RawMessage);
20
21impl Confirmation {
22 pub const MSG_TYPE: &[u8] = b"AK";
23
24 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
25 static TAGS: LazyKnownTags = LazyKnownTags::new(
26 &[
27 Tag(664), Tag(772), Tag(859), Tag(666), Tag(773), Tag(797), Tag(650), Tag(665),
28 Tag(453), Tag(73), Tag(70), Tag(793), Tag(467), Tag(60), Tag(75), Tag(768),
29 Tag(711), Tag(555), Tag(80), Tag(854), Tag(54), Tag(15), Tag(30), Tag(862), Tag(79),
30 Tag(661), Tag(798), Tag(6), Tag(74), Tag(423), Tag(860), Tag(861), Tag(58),
31 Tag(354), Tag(355), Tag(81), Tag(381), Tag(157), Tag(230), Tag(158), Tag(159),
32 Tag(738), Tag(920), Tag(921), Tag(922), Tag(238), Tag(237), Tag(118), Tag(890),
33 Tag(119), Tag(120), Tag(155), Tag(156), Tag(63), Tag(64), Tag(858), Tag(232),
34 Tag(136),
35 ],
36 &[
37 Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
38 OrdAllocGrp::known_tags(), TrdRegTimestamps::known_tags(), Instrument::known_tags(),
39 InstrumentExtension::known_tags(), FinancingDetails::known_tags(),
40 UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(), YieldData::known_tags(),
41 CpctyConfGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
42 SettlInstructionsData::known_tags(), CommissionData::known_tags(),
43 Stipulations::known_tags(), MiscFeesGrp::known_tags(),
44 ],
45 );
46 &TAGS
47 }
48
49 pub fn from_raw(raw: RawMessage) -> Self {
50 Self(raw)
51 }
52
53 pub fn raw(&self) -> &RawMessage {
54 &self.0
55 }
56
57 pub fn header(&self) -> Header<'_> {
58 Header(self.0.scope(), Self::known_tags().get())
59 }
60
61 pub fn trailer(&self) -> Trailer<'_> {
62 Trailer(self.0.scope())
63 }
64
65 #[doc(alias = "ConfirmID")]
67 pub fn confirm_id(&self) -> Result<Option<&str>, InvalidValue> {
68 self.0.get_str(Tag(664))
69 }
70
71 #[doc(alias = "ConfirmRefID")]
73 pub fn confirm_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
74 self.0.get_str(Tag(772))
75 }
76
77 #[doc(alias = "ConfirmReqID")]
79 pub fn confirm_req_id(&self) -> Result<Option<&str>, InvalidValue> {
80 self.0.get_str(Tag(859))
81 }
82
83 #[doc(alias = "ConfirmTransType")]
85 pub fn confirm_trans_type(&self) -> Result<Option<ConfirmTransType>, InvalidValue> {
86 Ok(self.0.get_int(Tag(666))?.map(ConfirmTransType::from_value))
87 }
88
89 #[doc(alias = "ConfirmType")]
91 pub fn confirm_type(&self) -> Result<Option<ConfirmType>, InvalidValue> {
92 Ok(self.0.get_int(Tag(773))?.map(ConfirmType::from_value))
93 }
94
95 #[doc(alias = "CopyMsgIndicator")]
97 pub fn copy_msg_indicator(&self) -> Result<Option<bool>, InvalidValue> {
98 self.0.get_bool(Tag(797))
99 }
100
101 #[doc(alias = "LegalConfirm")]
103 pub fn legal_confirm(&self) -> Result<Option<bool>, InvalidValue> {
104 self.0.get_bool(Tag(650))
105 }
106
107 #[doc(alias = "ConfirmStatus")]
109 pub fn confirm_status(&self) -> Result<Option<ConfirmStatus>, InvalidValue> {
110 Ok(self.0.get_int(Tag(665))?.map(ConfirmStatus::from_value))
111 }
112
113 #[doc(alias = "NoPartyIDs")]
115 pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
116 self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
117 }
118
119 #[doc(alias = "NoOrders")]
121 pub fn orders(&self) -> Result<Instances<'_, OrdAllocGrp<'_>>, InvalidValue> {
122 self.0.get_group(&OrdAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
123 }
124
125 #[doc(alias = "AllocID")]
127 pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
128 self.0.get_str(Tag(70))
129 }
130
131 #[doc(alias = "SecondaryAllocID")]
133 pub fn secondary_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
134 self.0.get_str(Tag(793))
135 }
136
137 #[doc(alias = "IndividualAllocID")]
139 pub fn individual_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
140 self.0.get_str(Tag(467))
141 }
142
143 #[doc(alias = "TransactTime")]
145 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
146 self.0.get_utc_timestamp(Tag(60))
147 }
148
149 #[doc(alias = "TradeDate")]
151 pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
152 self.0.get_date(Tag(75))
153 }
154
155 #[doc(alias = "NoTrdRegTimestamps")]
157 pub fn trd_reg_timestamps(&self) -> Result<Instances<'_, TrdRegTimestamps<'_>>, InvalidValue> {
158 self.0.get_group(&TrdRegTimestamps::TABLE, &Self::known_tags().get()).map(Instances::from)
159 }
160
161 pub fn instrument(&self) -> Instrument<'_> {
163 Instrument(self.0.scope(), Self::known_tags().get())
164 }
165
166 pub fn instrument_extension(&self) -> InstrumentExtension<'_> {
168 InstrumentExtension(self.0.scope(), Self::known_tags().get())
169 }
170
171 pub fn financing_details(&self) -> FinancingDetails<'_> {
173 FinancingDetails(self.0.scope())
174 }
175
176 #[doc(alias = "NoUnderlyings")]
178 pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
179 self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
180 }
181
182 #[doc(alias = "NoLegs")]
184 pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
185 self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
186 }
187
188 pub fn yield_data(&self) -> YieldData<'_> {
190 YieldData(self.0.scope())
191 }
192
193 #[doc(alias = "AllocQty")]
195 pub fn alloc_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
196 self.0.get_decimal(Tag(80))
197 }
198
199 #[doc(alias = "QtyType")]
201 pub fn qty_type(&self) -> Result<Option<QtyType>, InvalidValue> {
202 Ok(self.0.get_int(Tag(854))?.map(QtyType::from_value))
203 }
204
205 #[doc(alias = "Side")]
207 pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
208 Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
209 }
210
211 #[doc(alias = "Currency")]
213 pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
214 self.0.get_str(Tag(15))
215 }
216
217 #[doc(alias = "LastMkt")]
219 pub fn last_mkt(&self) -> Result<Option<&str>, InvalidValue> {
220 self.0.get_str(Tag(30))
221 }
222
223 #[doc(alias = "NoCapacities")]
225 pub fn capacities(&self) -> Result<Instances<'_, CpctyConfGrp<'_>>, InvalidValue> {
226 self.0.get_group(&CpctyConfGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
227 }
228
229 #[doc(alias = "AllocAccount")]
231 pub fn alloc_account(&self) -> Result<Option<&str>, InvalidValue> {
232 self.0.get_str(Tag(79))
233 }
234
235 #[doc(alias = "AllocAcctIDSource")]
237 pub fn alloc_acct_id_source(&self) -> Result<Option<i64>, InvalidValue> {
238 self.0.get_int(Tag(661))
239 }
240
241 #[doc(alias = "AllocAccountType")]
243 pub fn alloc_account_type(&self) -> Result<Option<AllocAccountType>, InvalidValue> {
244 Ok(self.0.get_int(Tag(798))?.map(AllocAccountType::from_value))
245 }
246
247 #[doc(alias = "AvgPx")]
249 pub fn avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
250 self.0.get_decimal(Tag(6))
251 }
252
253 #[doc(alias = "AvgPxPrecision")]
255 pub fn avg_px_precision(&self) -> Result<Option<i64>, InvalidValue> {
256 self.0.get_int(Tag(74))
257 }
258
259 #[doc(alias = "PriceType")]
261 pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
262 Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
263 }
264
265 #[doc(alias = "AvgParPx")]
267 pub fn avg_par_px(&self) -> Result<Option<Decimal>, InvalidValue> {
268 self.0.get_decimal(Tag(860))
269 }
270
271 pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
273 SpreadOrBenchmarkCurveData(self.0.scope())
274 }
275
276 #[doc(alias = "ReportedPx")]
278 pub fn reported_px(&self) -> Result<Option<Decimal>, InvalidValue> {
279 self.0.get_decimal(Tag(861))
280 }
281
282 #[doc(alias = "Text")]
284 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
285 self.0.get_str(Tag(58))
286 }
287
288 #[doc(alias = "EncodedTextLen")]
290 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
291 self.0.get_int(Tag(354))
292 }
293
294 #[doc(alias = "EncodedText")]
296 pub fn encoded_text(&self) -> Option<&[u8]> {
297 self.0.get(Tag(355))
298 }
299
300 #[doc(alias = "ProcessCode")]
302 pub fn process_code(&self) -> Result<Option<ProcessCode<'_>>, InvalidValue> {
303 Ok(self.0.get_str(Tag(81))?.map(ProcessCode::from_value))
304 }
305
306 #[doc(alias = "GrossTradeAmt")]
308 pub fn gross_trade_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
309 self.0.get_decimal(Tag(381))
310 }
311
312 #[doc(alias = "NumDaysInterest")]
314 pub fn num_days_interest(&self) -> Result<Option<i64>, InvalidValue> {
315 self.0.get_int(Tag(157))
316 }
317
318 #[doc(alias = "ExDate")]
320 pub fn ex_date(&self) -> Result<Option<Date>, InvalidValue> {
321 self.0.get_date(Tag(230))
322 }
323
324 #[doc(alias = "AccruedInterestRate")]
326 pub fn accrued_interest_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
327 self.0.get_decimal(Tag(158))
328 }
329
330 #[doc(alias = "AccruedInterestAmt")]
332 pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
333 self.0.get_decimal(Tag(159))
334 }
335
336 #[doc(alias = "InterestAtMaturity")]
338 pub fn interest_at_maturity(&self) -> Result<Option<Decimal>, InvalidValue> {
339 self.0.get_decimal(Tag(738))
340 }
341
342 #[doc(alias = "EndAccruedInterestAmt")]
344 pub fn end_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
345 self.0.get_decimal(Tag(920))
346 }
347
348 #[doc(alias = "StartCash")]
350 pub fn start_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
351 self.0.get_decimal(Tag(921))
352 }
353
354 #[doc(alias = "EndCash")]
356 pub fn end_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
357 self.0.get_decimal(Tag(922))
358 }
359
360 #[doc(alias = "Concession")]
362 pub fn concession(&self) -> Result<Option<Decimal>, InvalidValue> {
363 self.0.get_decimal(Tag(238))
364 }
365
366 #[doc(alias = "TotalTakedown")]
368 pub fn total_takedown(&self) -> Result<Option<Decimal>, InvalidValue> {
369 self.0.get_decimal(Tag(237))
370 }
371
372 #[doc(alias = "NetMoney")]
374 pub fn net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
375 self.0.get_decimal(Tag(118))
376 }
377
378 #[doc(alias = "MaturityNetMoney")]
380 pub fn maturity_net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
381 self.0.get_decimal(Tag(890))
382 }
383
384 #[doc(alias = "SettlCurrAmt")]
386 pub fn settl_curr_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
387 self.0.get_decimal(Tag(119))
388 }
389
390 #[doc(alias = "SettlCurrency")]
392 pub fn settl_currency(&self) -> Result<Option<&str>, InvalidValue> {
393 self.0.get_str(Tag(120))
394 }
395
396 #[doc(alias = "SettlCurrFxRate")]
398 pub fn settl_curr_fx_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
399 self.0.get_decimal(Tag(155))
400 }
401
402 #[doc(alias = "SettlCurrFxRateCalc")]
404 pub fn settl_curr_fx_rate_calc(&self) -> Result<Option<SettlCurrFxRateCalc<'_>>, InvalidValue> {
405 Ok(self.0.get_str(Tag(156))?.map(SettlCurrFxRateCalc::from_value))
406 }
407
408 #[doc(alias = "SettlType")]
410 pub fn settl_type(&self) -> Result<Option<SettlType<'_>>, InvalidValue> {
411 Ok(self.0.get_str(Tag(63))?.map(SettlType::from_value))
412 }
413
414 #[doc(alias = "SettlDate")]
416 pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
417 self.0.get_date(Tag(64))
418 }
419
420 pub fn settl_instructions_data(&self) -> SettlInstructionsData<'_> {
422 SettlInstructionsData(self.0.scope(), Self::known_tags().get())
423 }
424
425 pub fn commission_data(&self) -> CommissionData<'_> {
427 CommissionData(self.0.scope())
428 }
429
430 #[doc(alias = "SharedCommission")]
432 pub fn shared_commission(&self) -> Result<Option<Decimal>, InvalidValue> {
433 self.0.get_decimal(Tag(858))
434 }
435
436 #[doc(alias = "NoStipulations")]
438 pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
439 self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
440 }
441
442 #[doc(alias = "NoMiscFees")]
444 pub fn misc_fees(&self) -> Result<Instances<'_, MiscFeesGrp<'_>>, InvalidValue> {
445 self.0.get_group(&MiscFeesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
446 }
447}
448
449impl std::fmt::Debug for Confirmation {
450 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
451 write!(f, "Confirmation({})", self.0)
452 }
453}
454
455impl std::fmt::Display for Confirmation {
456 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
457 std::fmt::Display::fmt(&self.0, f)
458 }
459}