Skip to main content

refix_fix44/generated/messages/
position_maintenance_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    Header, InstrmtLegGrp, Instrument, Parties, PositionQty, Trailer, TrdgSesGrp, UndInstrmtGrp,
10};
11use super::super::enums::{
12    AccountType, AcctIDSource, AdjustmentType, PosMaintAction, PosTransType, SettlSessID,
13};
14
15/// The `PositionMaintenanceRequest` (35=AL) message.
16pub struct PositionMaintenanceRequest(RawMessage);
17
18impl PositionMaintenanceRequest {
19    pub const MSG_TYPE: &[u8] = b"AL";
20
21    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
22        static TAGS: LazyKnownTags = LazyKnownTags::new(
23            &[
24                Tag(710), Tag(709), Tag(712), Tag(713), Tag(714), Tag(715), Tag(716), Tag(717),
25                Tag(453), Tag(1), Tag(660), Tag(581), Tag(15), Tag(555), Tag(711), Tag(386),
26                Tag(60), Tag(702), Tag(718), Tag(719), Tag(720), Tag(834), Tag(58), Tag(354),
27                Tag(355),
28            ],
29            &[
30                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
31                Instrument::known_tags(), InstrmtLegGrp::known_tags(), UndInstrmtGrp::known_tags(),
32                TrdgSesGrp::known_tags(), PositionQty::known_tags(),
33            ],
34        );
35        &TAGS
36    }
37
38    pub fn from_raw(raw: RawMessage) -> Self {
39        Self(raw)
40    }
41
42    pub fn raw(&self) -> &RawMessage {
43        &self.0
44    }
45
46    pub fn header(&self) -> Header<'_> {
47        Header(self.0.scope(), Self::known_tags().get())
48    }
49
50    pub fn trailer(&self) -> Trailer<'_> {
51        Trailer(self.0.scope())
52    }
53
54    /// The `PosReqID` (710) field.
55    #[doc(alias = "PosReqID")]
56    pub fn pos_req_id(&self) -> Result<Option<&str>, InvalidValue> {
57        self.0.get_str(Tag(710))
58    }
59
60    /// The `PosTransType` (709) field.
61    #[doc(alias = "PosTransType")]
62    pub fn pos_trans_type(&self) -> Result<Option<PosTransType>, InvalidValue> {
63        Ok(self.0.get_int(Tag(709))?.map(PosTransType::from_value))
64    }
65
66    /// The `PosMaintAction` (712) field.
67    #[doc(alias = "PosMaintAction")]
68    pub fn pos_maint_action(&self) -> Result<Option<PosMaintAction>, InvalidValue> {
69        Ok(self.0.get_int(Tag(712))?.map(PosMaintAction::from_value))
70    }
71
72    /// The `OrigPosReqRefID` (713) field.
73    #[doc(alias = "OrigPosReqRefID")]
74    pub fn orig_pos_req_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
75        self.0.get_str(Tag(713))
76    }
77
78    /// The `PosMaintRptRefID` (714) field.
79    #[doc(alias = "PosMaintRptRefID")]
80    pub fn pos_maint_rpt_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
81        self.0.get_str(Tag(714))
82    }
83
84    /// The `ClearingBusinessDate` (715) field.
85    #[doc(alias = "ClearingBusinessDate")]
86    pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
87        self.0.get_date(Tag(715))
88    }
89
90    /// The `SettlSessID` (716) field.
91    #[doc(alias = "SettlSessID")]
92    pub fn settl_sess_id(&self) -> Result<Option<SettlSessID<'_>>, InvalidValue> {
93        Ok(self.0.get_str(Tag(716))?.map(SettlSessID::from_value))
94    }
95
96    /// The `SettlSessSubID` (717) field.
97    #[doc(alias = "SettlSessSubID")]
98    pub fn settl_sess_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
99        self.0.get_str(Tag(717))
100    }
101
102    /// The instances of the `NoPartyIDs` (453) group.
103    #[doc(alias = "NoPartyIDs")]
104    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
105        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
106    }
107
108    /// The `Account` (1) field.
109    #[doc(alias = "Account")]
110    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
111        self.0.get_str(Tag(1))
112    }
113
114    /// The `AcctIDSource` (660) field.
115    #[doc(alias = "AcctIDSource")]
116    pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
117        Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
118    }
119
120    /// The `AccountType` (581) field.
121    #[doc(alias = "AccountType")]
122    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
123        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
124    }
125
126    /// The `Instrument` component.
127    pub fn instrument(&self) -> Instrument<'_> {
128        Instrument(self.0.scope(), Self::known_tags().get())
129    }
130
131    /// The `Currency` (15) field.
132    #[doc(alias = "Currency")]
133    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
134        self.0.get_str(Tag(15))
135    }
136
137    /// The instances of the `NoLegs` (555) group.
138    #[doc(alias = "NoLegs")]
139    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
140        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
141    }
142
143    /// The instances of the `NoUnderlyings` (711) group.
144    #[doc(alias = "NoUnderlyings")]
145    pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
146        self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
147    }
148
149    /// The instances of the `NoTradingSessions` (386) group.
150    #[doc(alias = "NoTradingSessions")]
151    pub fn trading_sessions(&self) -> Result<Instances<'_, TrdgSesGrp<'_>>, InvalidValue> {
152        self.0.get_group(&TrdgSesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
153    }
154
155    /// The `TransactTime` (60) field.
156    #[doc(alias = "TransactTime")]
157    pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
158        self.0.get_utc_timestamp(Tag(60))
159    }
160
161    /// The instances of the `NoPositions` (702) group.
162    #[doc(alias = "NoPositions")]
163    pub fn positions(&self) -> Result<Instances<'_, PositionQty<'_>>, InvalidValue> {
164        self.0.get_group(&PositionQty::TABLE, &Self::known_tags().get()).map(Instances::from)
165    }
166
167    /// The `AdjustmentType` (718) field.
168    #[doc(alias = "AdjustmentType")]
169    pub fn adjustment_type(&self) -> Result<Option<AdjustmentType>, InvalidValue> {
170        Ok(self.0.get_int(Tag(718))?.map(AdjustmentType::from_value))
171    }
172
173    /// The `ContraryInstructionIndicator` (719) field.
174    #[doc(alias = "ContraryInstructionIndicator")]
175    pub fn contrary_instruction_indicator(&self) -> Result<Option<bool>, InvalidValue> {
176        self.0.get_bool(Tag(719))
177    }
178
179    /// The `PriorSpreadIndicator` (720) field.
180    #[doc(alias = "PriorSpreadIndicator")]
181    pub fn prior_spread_indicator(&self) -> Result<Option<bool>, InvalidValue> {
182        self.0.get_bool(Tag(720))
183    }
184
185    /// The `ThresholdAmount` (834) field.
186    #[doc(alias = "ThresholdAmount")]
187    pub fn threshold_amount(&self) -> Result<Option<Decimal>, InvalidValue> {
188        self.0.get_decimal(Tag(834))
189    }
190
191    /// The `Text` (58) field.
192    #[doc(alias = "Text")]
193    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
194        self.0.get_str(Tag(58))
195    }
196
197    /// The `EncodedTextLen` (354) field.
198    #[doc(alias = "EncodedTextLen")]
199    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
200        self.0.get_int(Tag(354))
201    }
202
203    /// The `EncodedText` (355) field.
204    #[doc(alias = "EncodedText")]
205    pub fn encoded_text(&self) -> Option<&[u8]> {
206        self.0.get(Tag(355))
207    }
208}
209
210impl std::fmt::Debug for PositionMaintenanceRequest {
211    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
212        write!(f, "PositionMaintenanceRequest({})", self.0)
213    }
214}
215
216impl std::fmt::Display for PositionMaintenanceRequest {
217    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
218        std::fmt::Display::fmt(&self.0, f)
219    }
220}