refix_fix44/generated/messages/
request_for_positions.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Date, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp};
5
6use super::super::components::{
7 Header, InstrmtLegGrp, Instrument, Parties, Trailer, TrdgSesGrp, UndInstrmtGrp,
8};
9use super::super::enums::{
10 AccountType, AcctIDSource, MatchStatus, PosReqType, ResponseTransportType, SettlSessID,
11 SubscriptionRequestType,
12};
13
14pub struct RequestForPositions(RawMessage);
16
17impl RequestForPositions {
18 pub const MSG_TYPE: &[u8] = b"AN";
19
20 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
21 static TAGS: LazyKnownTags = LazyKnownTags::new(
22 &[
23 Tag(710), Tag(724), Tag(573), Tag(263), Tag(453), Tag(1), Tag(660), Tag(581),
24 Tag(15), Tag(555), Tag(711), Tag(715), Tag(716), Tag(717), Tag(386), Tag(60),
25 Tag(725), Tag(726), Tag(58), Tag(354), Tag(355),
26 ],
27 &[
28 Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
29 Instrument::known_tags(), InstrmtLegGrp::known_tags(), UndInstrmtGrp::known_tags(),
30 TrdgSesGrp::known_tags(),
31 ],
32 );
33 &TAGS
34 }
35
36 pub fn from_raw(raw: RawMessage) -> Self {
37 Self(raw)
38 }
39
40 pub fn raw(&self) -> &RawMessage {
41 &self.0
42 }
43
44 pub fn header(&self) -> Header<'_> {
45 Header(self.0.scope(), Self::known_tags().get())
46 }
47
48 pub fn trailer(&self) -> Trailer<'_> {
49 Trailer(self.0.scope())
50 }
51
52 #[doc(alias = "PosReqID")]
54 pub fn pos_req_id(&self) -> Result<Option<&str>, InvalidValue> {
55 self.0.get_str(Tag(710))
56 }
57
58 #[doc(alias = "PosReqType")]
60 pub fn pos_req_type(&self) -> Result<Option<PosReqType>, InvalidValue> {
61 Ok(self.0.get_int(Tag(724))?.map(PosReqType::from_value))
62 }
63
64 #[doc(alias = "MatchStatus")]
66 pub fn match_status(&self) -> Result<Option<MatchStatus<'_>>, InvalidValue> {
67 Ok(self.0.get_str(Tag(573))?.map(MatchStatus::from_value))
68 }
69
70 #[doc(alias = "SubscriptionRequestType")]
72 pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
73 Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
74 }
75
76 #[doc(alias = "NoPartyIDs")]
78 pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
79 self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
80 }
81
82 #[doc(alias = "Account")]
84 pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
85 self.0.get_str(Tag(1))
86 }
87
88 #[doc(alias = "AcctIDSource")]
90 pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
91 Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
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 pub fn instrument(&self) -> Instrument<'_> {
102 Instrument(self.0.scope(), Self::known_tags().get())
103 }
104
105 #[doc(alias = "Currency")]
107 pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
108 self.0.get_str(Tag(15))
109 }
110
111 #[doc(alias = "NoLegs")]
113 pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
114 self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
115 }
116
117 #[doc(alias = "NoUnderlyings")]
119 pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
120 self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
121 }
122
123 #[doc(alias = "ClearingBusinessDate")]
125 pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
126 self.0.get_date(Tag(715))
127 }
128
129 #[doc(alias = "SettlSessID")]
131 pub fn settl_sess_id(&self) -> Result<Option<SettlSessID<'_>>, InvalidValue> {
132 Ok(self.0.get_str(Tag(716))?.map(SettlSessID::from_value))
133 }
134
135 #[doc(alias = "SettlSessSubID")]
137 pub fn settl_sess_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
138 self.0.get_str(Tag(717))
139 }
140
141 #[doc(alias = "NoTradingSessions")]
143 pub fn trading_sessions(&self) -> Result<Instances<'_, TrdgSesGrp<'_>>, InvalidValue> {
144 self.0.get_group(&TrdgSesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
145 }
146
147 #[doc(alias = "TransactTime")]
149 pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
150 self.0.get_utc_timestamp(Tag(60))
151 }
152
153 #[doc(alias = "ResponseTransportType")]
155 pub fn response_transport_type(&self) -> Result<Option<ResponseTransportType>, InvalidValue> {
156 Ok(self.0.get_int(Tag(725))?.map(ResponseTransportType::from_value))
157 }
158
159 #[doc(alias = "ResponseDestination")]
161 pub fn response_destination(&self) -> Result<Option<&str>, InvalidValue> {
162 self.0.get_str(Tag(726))
163 }
164
165 #[doc(alias = "Text")]
167 pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
168 self.0.get_str(Tag(58))
169 }
170
171 #[doc(alias = "EncodedTextLen")]
173 pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
174 self.0.get_int(Tag(354))
175 }
176
177 #[doc(alias = "EncodedText")]
179 pub fn encoded_text(&self) -> Option<&[u8]> {
180 self.0.get(Tag(355))
181 }
182}
183
184impl std::fmt::Debug for RequestForPositions {
185 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
186 write!(f, "RequestForPositions({})", self.0)
187 }
188}
189
190impl std::fmt::Display for RequestForPositions {
191 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
192 std::fmt::Display::fmt(&self.0, f)
193 }
194}