Skip to main content

refix_fix44/generated/messages/
market_data_request.rs

1// @generated by refix codegen from FIX44.xml. Do not edit.
2#![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
11/// The `MarketDataRequest` (35=V) message.
12pub 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    /// The `MDReqID` (262) field.
48    #[doc(alias = "MDReqID")]
49    pub fn md_req_id(&self) -> Result<Option<&str>, InvalidValue> {
50        self.0.get_str(Tag(262))
51    }
52
53    /// The `SubscriptionRequestType` (263) field.
54    #[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    /// The `MarketDepth` (264) field.
60    #[doc(alias = "MarketDepth")]
61    pub fn market_depth(&self) -> Result<Option<i64>, InvalidValue> {
62        self.0.get_int(Tag(264))
63    }
64
65    /// The `MDUpdateType` (265) field.
66    #[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    /// The `AggregatedBook` (266) field.
72    #[doc(alias = "AggregatedBook")]
73    pub fn aggregated_book(&self) -> Result<Option<bool>, InvalidValue> {
74        self.0.get_bool(Tag(266))
75    }
76
77    /// The `OpenCloseSettlFlag` (286) field.
78    #[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    /// The `Scope` (546) field.
84    #[doc(alias = "Scope")]
85    pub fn scope(&self) -> Result<Option<MultipleValues<'_, Scope<'_>>>, InvalidValue> {
86        self.0.get_multiple_values(Tag(546))
87    }
88
89    /// The `MDImplicitDelete` (547) field.
90    #[doc(alias = "MDImplicitDelete")]
91    pub fn md_implicit_delete(&self) -> Result<Option<bool>, InvalidValue> {
92        self.0.get_bool(Tag(547))
93    }
94
95    /// The instances of the `NoMDEntryTypes` (267) group.
96    #[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    /// The instances of the `NoRelatedSym` (146) group.
102    #[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    /// The instances of the `NoTradingSessions` (386) group.
108    #[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    /// The `ApplQueueAction` (815) field.
114    #[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    /// The `ApplQueueMax` (812) field.
120    #[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}