#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, MonthYear, RawMessage, Tag,
};
use super::super::components::{Header, Trailer};
use super::super::enums::{
IDSource, MDEntryType, MDUpdateType, PutOrCall, SecurityType, SubscriptionRequestType,
};
pub struct MarketDataRequest(RawMessage);
impl MarketDataRequest {
pub const MSG_TYPE: &[u8] = b"V";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(262), Tag(263), Tag(264), Tag(265), Tag(266), Tag(267), Tag(146)],
&[
Header::known_tags(), Trailer::known_tags(),
MarketDataRequestMDEntryTypes::known_tags(),
MarketDataRequestRelatedSym::known_tags(),
],
);
&TAGS
}
pub fn from_raw(raw: RawMessage) -> Self {
Self(raw)
}
pub fn raw(&self) -> &RawMessage {
&self.0
}
pub fn header(&self) -> Header<'_> {
Header(self.0.scope())
}
pub fn trailer(&self) -> Trailer<'_> {
Trailer(self.0.scope())
}
#[doc(alias = "MDReqID")]
pub fn md_req_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(262))
}
#[doc(alias = "SubscriptionRequestType")]
pub fn subscription_request_type(&self) -> Result<Option<SubscriptionRequestType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(263))?.map(SubscriptionRequestType::from_value))
}
#[doc(alias = "MarketDepth")]
pub fn market_depth(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(264))
}
#[doc(alias = "MDUpdateType")]
pub fn md_update_type(&self) -> Result<Option<MDUpdateType>, InvalidValue> {
Ok(self.0.get_int(Tag(265))?.map(MDUpdateType::from_value))
}
#[doc(alias = "AggregatedBook")]
pub fn aggregated_book(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(266))
}
#[doc(alias = "NoMDEntryTypes")]
pub fn md_entry_types(&self) -> Result<Instances<'_, MarketDataRequestMDEntryTypes<'_>>, InvalidValue> {
self.0.get_group(&MarketDataRequestMDEntryTypes::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoRelatedSym")]
pub fn related_sym(&self) -> Result<Instances<'_, MarketDataRequestRelatedSym<'_>>, InvalidValue> {
self.0.get_group(&MarketDataRequestRelatedSym::TABLE, &Self::known_tags().get()).map(Instances::from)
}
}
impl std::fmt::Debug for MarketDataRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "MarketDataRequest({})", self.0)
}
}
impl std::fmt::Display for MarketDataRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}
#[derive(Clone, Copy)]
pub struct MarketDataRequestMDEntryTypes<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for MarketDataRequestMDEntryTypes<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> MarketDataRequestMDEntryTypes<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(267),
Tag(269),
&[Tag(269)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(269)], &[]);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "MDEntryType")]
pub fn md_entry_type(&self) -> Result<Option<MDEntryType<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(269))?.map(MDEntryType::from_value))
}
}
impl std::fmt::Debug for MarketDataRequestMDEntryTypes<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "MarketDataRequestMDEntryTypes({})", self.0)
}
}
#[derive(Clone, Copy)]
pub struct MarketDataRequestRelatedSym<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for MarketDataRequestRelatedSym<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> MarketDataRequestRelatedSym<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(146),
Tag(55),
&[
Tag(22), Tag(48), Tag(55), Tag(65), Tag(106), Tag(107), Tag(167), Tag(200), Tag(201),
Tag(202), Tag(205), Tag(206), Tag(207), Tag(223), Tag(231), Tag(336), Tag(348),
Tag(349), Tag(350), Tag(351),
],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(55), Tag(65), Tag(48), Tag(22), Tag(167), Tag(200), Tag(205), Tag(201),
Tag(202), Tag(206), Tag(231), Tag(223), Tag(207), Tag(106), Tag(348), Tag(349),
Tag(107), Tag(350), Tag(351), Tag(336),
],
&[],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "Symbol")]
pub fn symbol(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(55))
}
#[doc(alias = "SymbolSfx")]
pub fn symbol_sfx(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(65))
}
#[doc(alias = "SecurityID")]
pub fn security_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(48))
}
#[doc(alias = "IDSource")]
pub fn id_source(&self) -> Result<Option<IDSource<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(22))?.map(IDSource::from_value))
}
#[doc(alias = "SecurityType")]
pub fn security_type(&self) -> Result<Option<SecurityType<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(167))?.map(SecurityType::from_value))
}
#[doc(alias = "MaturityMonthYear")]
pub fn maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
self.0.get_month_year(Tag(200))
}
#[doc(alias = "MaturityDay")]
pub fn maturity_day(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(205))
}
#[doc(alias = "PutOrCall")]
pub fn put_or_call(&self) -> Result<Option<PutOrCall>, InvalidValue> {
Ok(self.0.get_int(Tag(201))?.map(PutOrCall::from_value))
}
#[doc(alias = "StrikePrice")]
pub fn strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(202))
}
#[doc(alias = "OptAttribute")]
pub fn opt_attribute(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(206))
}
#[doc(alias = "ContractMultiplier")]
pub fn contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(231))
}
#[doc(alias = "CouponRate")]
pub fn coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(223))
}
#[doc(alias = "SecurityExchange")]
pub fn security_exchange(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(207))
}
#[doc(alias = "Issuer")]
pub fn issuer(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(106))
}
#[doc(alias = "EncodedIssuerLen")]
pub fn encoded_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(348))
}
#[doc(alias = "EncodedIssuer")]
pub fn encoded_issuer(&self) -> Option<&'a [u8]> {
self.0.get(Tag(349))
}
#[doc(alias = "SecurityDesc")]
pub fn security_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(107))
}
#[doc(alias = "EncodedSecurityDescLen")]
pub fn encoded_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(350))
}
#[doc(alias = "EncodedSecurityDesc")]
pub fn encoded_security_desc(&self) -> Option<&'a [u8]> {
self.0.get(Tag(351))
}
#[doc(alias = "TradingSessionID")]
pub fn trading_session_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(336))
}
}
impl std::fmt::Debug for MarketDataRequestRelatedSym<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "MarketDataRequestRelatedSym({})", self.0)
}
}