refix_fix44/generated/messages/
market_data_request.rs1#![cfg_attr(rustfmt, rustfmt::skip)]
3
4use refix_message::{Instances, InvalidValue, LazyKnownTags, MultipleValues, RawMessage, Tag};
5
6use super::super::components::{Header, InstrmtMDReqGrp, MDReqGrp, Trailer, TrdgSesGrp};
7use super::super::enums::{
8 ApplQueueAction, MDUpdateType, OpenCloseSettlFlag, Scope, SubscriptionRequestType,
9};
10
11pub struct MarketDataRequest(RawMessage);
13
14impl MarketDataRequest {
15 pub const MSG_TYPE: &[u8] = b"V";
16
17 pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
18 static TAGS: LazyKnownTags = LazyKnownTags::new(
19 &[
20 Tag(262), Tag(263), Tag(264), Tag(265), Tag(266), Tag(286), Tag(546), Tag(547),
21 Tag(267), Tag(146), Tag(386), Tag(815), Tag(812),
22 ],
23 &[
24 Header::known_tags(), Trailer::known_tags(), MDReqGrp::known_tags(),
25 InstrmtMDReqGrp::known_tags(), TrdgSesGrp::known_tags(),
26 ],
27 );
28 &TAGS
29 }
30
31 pub fn from_raw(raw: RawMessage) -> Self {
32 Self(raw)
33 }
34
35 pub fn raw(&self) -> &RawMessage {
36 &self.0
37 }
38
39 pub fn header(&self) -> Header<'_> {
40 Header(self.0.scope(), Self::known_tags().get())
41 }
42
43 pub fn trailer(&self) -> Trailer<'_> {
44 Trailer(self.0.scope())
45 }
46
47 #[doc(alias = "MDReqID")]
49 pub fn md_req_id(&self) -> Result<Option<&str>, InvalidValue> {
50 self.0.get_str(Tag(262))
51 }
52
53 #[doc(alias = "SubscriptionRequestType")]
55 pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
56 Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
57 }
58
59 #[doc(alias = "MarketDepth")]
61 pub fn market_depth(&self) -> Result<Option<i64>, InvalidValue> {
62 self.0.get_int(Tag(264))
63 }
64
65 #[doc(alias = "MDUpdateType")]
67 pub fn md_update_type(&self) -> Result<Option<MDUpdateType>, InvalidValue> {
68 Ok(self.0.get_int(Tag(265))?.map(MDUpdateType::from_value))
69 }
70
71 #[doc(alias = "AggregatedBook")]
73 pub fn aggregated_book(&self) -> Result<Option<bool>, InvalidValue> {
74 self.0.get_bool(Tag(266))
75 }
76
77 #[doc(alias = "OpenCloseSettlFlag")]
79 pub fn open_close_settl_flag(&self) -> Result<Option<MultipleValues<'_, OpenCloseSettlFlag<'_>>>, InvalidValue> {
80 self.0.get_multiple_values(Tag(286))
81 }
82
83 #[doc(alias = "Scope")]
85 pub fn scope(&self) -> Result<Option<MultipleValues<'_, Scope<'_>>>, InvalidValue> {
86 self.0.get_multiple_values(Tag(546))
87 }
88
89 #[doc(alias = "MDImplicitDelete")]
91 pub fn md_implicit_delete(&self) -> Result<Option<bool>, InvalidValue> {
92 self.0.get_bool(Tag(547))
93 }
94
95 #[doc(alias = "NoMDEntryTypes")]
97 pub fn md_entry_types(&self) -> Result<Instances<'_, MDReqGrp<'_>>, InvalidValue> {
98 self.0.get_group(&MDReqGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
99 }
100
101 #[doc(alias = "NoRelatedSym")]
103 pub fn related_sym(&self) -> Result<Instances<'_, InstrmtMDReqGrp<'_>>, InvalidValue> {
104 self.0.get_group(&InstrmtMDReqGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
105 }
106
107 #[doc(alias = "NoTradingSessions")]
109 pub fn trading_sessions(&self) -> Result<Instances<'_, TrdgSesGrp<'_>>, InvalidValue> {
110 self.0.get_group(&TrdgSesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
111 }
112
113 #[doc(alias = "ApplQueueAction")]
115 pub fn appl_queue_action(&self) -> Result<Option<ApplQueueAction>, InvalidValue> {
116 Ok(self.0.get_int(Tag(815))?.map(ApplQueueAction::from_value))
117 }
118
119 #[doc(alias = "ApplQueueMax")]
121 pub fn appl_queue_max(&self) -> Result<Option<i64>, InvalidValue> {
122 self.0.get_int(Tag(812))
123 }
124}
125
126impl std::fmt::Debug for MarketDataRequest {
127 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
128 write!(f, "MarketDataRequest({})", self.0)
129 }
130}
131
132impl std::fmt::Display for MarketDataRequest {
133 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
134 std::fmt::Display::fmt(&self.0, f)
135 }
136}