Skip to main content

refix_fix44/generated/messages/
position_report.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Date, Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
5
6use super::super::components::{
7    Header, InstrmtLegGrp, Instrument, Parties, PosUndInstrmtGrp, PositionAmountData, PositionQty,
8    Trailer,
9};
10use super::super::enums::{
11    AccountType, AcctIDSource, PosReqResult, PosReqType, RegistStatus, SettlPriceType, SettlSessID,
12    SubscriptionRequestType,
13};
14
15/// The `PositionReport` (35=AP) message.
16pub struct PositionReport(RawMessage);
17
18impl PositionReport {
19    pub const MSG_TYPE: &[u8] = b"AP";
20
21    pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
22        static TAGS: LazyKnownTags = LazyKnownTags::new(
23            &[
24                Tag(721), Tag(710), Tag(724), Tag(263), Tag(727), Tag(325), Tag(728), Tag(715),
25                Tag(716), Tag(717), Tag(453), Tag(1), Tag(660), Tag(581), Tag(15), Tag(730),
26                Tag(731), Tag(734), Tag(555), Tag(711), Tag(702), Tag(753), Tag(506), Tag(743),
27                Tag(58), Tag(354), Tag(355),
28            ],
29            &[
30                Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
31                Instrument::known_tags(), InstrmtLegGrp::known_tags(),
32                PosUndInstrmtGrp::known_tags(), PositionQty::known_tags(),
33                PositionAmountData::known_tags(),
34            ],
35        );
36        &TAGS
37    }
38
39    pub fn from_raw(raw: RawMessage) -> Self {
40        Self(raw)
41    }
42
43    pub fn raw(&self) -> &RawMessage {
44        &self.0
45    }
46
47    pub fn header(&self) -> Header<'_> {
48        Header(self.0.scope(), Self::known_tags().get())
49    }
50
51    pub fn trailer(&self) -> Trailer<'_> {
52        Trailer(self.0.scope())
53    }
54
55    /// The `PosMaintRptID` (721) field.
56    #[doc(alias = "PosMaintRptID")]
57    pub fn pos_maint_rpt_id(&self) -> Result<Option<&str>, InvalidValue> {
58        self.0.get_str(Tag(721))
59    }
60
61    /// The `PosReqID` (710) field.
62    #[doc(alias = "PosReqID")]
63    pub fn pos_req_id(&self) -> Result<Option<&str>, InvalidValue> {
64        self.0.get_str(Tag(710))
65    }
66
67    /// The `PosReqType` (724) field.
68    #[doc(alias = "PosReqType")]
69    pub fn pos_req_type(&self) -> Result<Option<PosReqType>, InvalidValue> {
70        Ok(self.0.get_int(Tag(724))?.map(PosReqType::from_value))
71    }
72
73    /// The `SubscriptionRequestType` (263) field.
74    #[doc(alias = "SubscriptionRequestType")]
75    pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
76        Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
77    }
78
79    /// The `TotalNumPosReports` (727) field.
80    #[doc(alias = "TotalNumPosReports")]
81    pub fn total_num_pos_reports(&self) -> Result<Option<i64>, InvalidValue> {
82        self.0.get_int(Tag(727))
83    }
84
85    /// The `UnsolicitedIndicator` (325) field.
86    #[doc(alias = "UnsolicitedIndicator")]
87    pub fn unsolicited_indicator(&self) -> Result<Option<bool>, InvalidValue> {
88        self.0.get_bool(Tag(325))
89    }
90
91    /// The `PosReqResult` (728) field.
92    #[doc(alias = "PosReqResult")]
93    pub fn pos_req_result(&self) -> Result<Option<PosReqResult>, InvalidValue> {
94        Ok(self.0.get_int(Tag(728))?.map(PosReqResult::from_value))
95    }
96
97    /// The `ClearingBusinessDate` (715) field.
98    #[doc(alias = "ClearingBusinessDate")]
99    pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
100        self.0.get_date(Tag(715))
101    }
102
103    /// The `SettlSessID` (716) field.
104    #[doc(alias = "SettlSessID")]
105    pub fn settl_sess_id(&self) -> Result<Option<SettlSessID<'_>>, InvalidValue> {
106        Ok(self.0.get_str(Tag(716))?.map(SettlSessID::from_value))
107    }
108
109    /// The `SettlSessSubID` (717) field.
110    #[doc(alias = "SettlSessSubID")]
111    pub fn settl_sess_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
112        self.0.get_str(Tag(717))
113    }
114
115    /// The instances of the `NoPartyIDs` (453) group.
116    #[doc(alias = "NoPartyIDs")]
117    pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
118        self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
119    }
120
121    /// The `Account` (1) field.
122    #[doc(alias = "Account")]
123    pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
124        self.0.get_str(Tag(1))
125    }
126
127    /// The `AcctIDSource` (660) field.
128    #[doc(alias = "AcctIDSource")]
129    pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
130        Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
131    }
132
133    /// The `AccountType` (581) field.
134    #[doc(alias = "AccountType")]
135    pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
136        Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
137    }
138
139    /// The `Instrument` component.
140    pub fn instrument(&self) -> Instrument<'_> {
141        Instrument(self.0.scope(), Self::known_tags().get())
142    }
143
144    /// The `Currency` (15) field.
145    #[doc(alias = "Currency")]
146    pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
147        self.0.get_str(Tag(15))
148    }
149
150    /// The `SettlPrice` (730) field.
151    #[doc(alias = "SettlPrice")]
152    pub fn settl_price(&self) -> Result<Option<Decimal>, InvalidValue> {
153        self.0.get_decimal(Tag(730))
154    }
155
156    /// The `SettlPriceType` (731) field.
157    #[doc(alias = "SettlPriceType")]
158    pub fn settl_price_type(&self) -> Result<Option<SettlPriceType>, InvalidValue> {
159        Ok(self.0.get_int(Tag(731))?.map(SettlPriceType::from_value))
160    }
161
162    /// The `PriorSettlPrice` (734) field.
163    #[doc(alias = "PriorSettlPrice")]
164    pub fn prior_settl_price(&self) -> Result<Option<Decimal>, InvalidValue> {
165        self.0.get_decimal(Tag(734))
166    }
167
168    /// The instances of the `NoLegs` (555) group.
169    #[doc(alias = "NoLegs")]
170    pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
171        self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
172    }
173
174    /// The instances of the `NoUnderlyings` (711) group.
175    #[doc(alias = "NoUnderlyings")]
176    pub fn underlyings(&self) -> Result<Instances<'_, PosUndInstrmtGrp<'_>>, InvalidValue> {
177        self.0.get_group(&PosUndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
178    }
179
180    /// The instances of the `NoPositions` (702) group.
181    #[doc(alias = "NoPositions")]
182    pub fn positions(&self) -> Result<Instances<'_, PositionQty<'_>>, InvalidValue> {
183        self.0.get_group(&PositionQty::TABLE, &Self::known_tags().get()).map(Instances::from)
184    }
185
186    /// The instances of the `NoPosAmt` (753) group.
187    #[doc(alias = "NoPosAmt")]
188    pub fn pos_amt(&self) -> Result<Instances<'_, PositionAmountData<'_>>, InvalidValue> {
189        self.0.get_group(&PositionAmountData::TABLE, &Self::known_tags().get()).map(Instances::from)
190    }
191
192    /// The `RegistStatus` (506) field.
193    #[doc(alias = "RegistStatus")]
194    pub fn regist_status(&self) -> Result<Option<RegistStatus<'_>>, InvalidValue> {
195        Ok(self.0.get_str(Tag(506))?.map(RegistStatus::from_value))
196    }
197
198    /// The `DeliveryDate` (743) field.
199    #[doc(alias = "DeliveryDate")]
200    pub fn delivery_date(&self) -> Result<Option<Date>, InvalidValue> {
201        self.0.get_date(Tag(743))
202    }
203
204    /// The `Text` (58) field.
205    #[doc(alias = "Text")]
206    pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
207        self.0.get_str(Tag(58))
208    }
209
210    /// The `EncodedTextLen` (354) field.
211    #[doc(alias = "EncodedTextLen")]
212    pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
213        self.0.get_int(Tag(354))
214    }
215
216    /// The `EncodedText` (355) field.
217    #[doc(alias = "EncodedText")]
218    pub fn encoded_text(&self) -> Option<&[u8]> {
219        self.0.get(Tag(355))
220    }
221}
222
223impl std::fmt::Debug for PositionReport {
224    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
225        write!(f, "PositionReport({})", self.0)
226    }
227}
228
229impl std::fmt::Display for PositionReport {
230    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
231        std::fmt::Display::fmt(&self.0, f)
232    }
233}