#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, MonthYear, RawMessage, Tag,
UtcTimestamp,
};
use super::super::components::{Header, Trailer};
use super::super::enums::{
Benchmark, IDSource, IOIQltyInd, IOIQualifier, IOIShares, IOITransType, PutOrCall, RoutingType,
SecurityType, Side,
};
pub struct IOI(RawMessage);
impl IOI {
pub const MSG_TYPE: &[u8] = b"6";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(23), Tag(28), Tag(26), 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(54), Tag(27), Tag(44),
Tag(15), Tag(62), Tag(25), Tag(130), Tag(199), Tag(58), Tag(354), Tag(355), Tag(60),
Tag(149), Tag(215), Tag(218), Tag(219),
],
&[
Header::known_tags(), Trailer::known_tags(), IOIIOIQualifiers::known_tags(),
IOIRoutingIDs::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 = "IOIid")]
pub fn io_iid(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(23))
}
#[doc(alias = "IOITransType")]
pub fn ioi_trans_type(&self) -> Result<Option<IOITransType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(28))?.map(IOITransType::from_value))
}
#[doc(alias = "IOIRefID")]
pub fn ioi_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(26))
}
#[doc(alias = "Symbol")]
pub fn symbol(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(55))
}
#[doc(alias = "SymbolSfx")]
pub fn symbol_sfx(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(65))
}
#[doc(alias = "SecurityID")]
pub fn security_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(48))
}
#[doc(alias = "IDSource")]
pub fn id_source(&self) -> Result<Option<IDSource<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(22))?.map(IDSource::from_value))
}
#[doc(alias = "SecurityType")]
pub fn security_type(&self) -> Result<Option<SecurityType<'_>>, 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<&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<&str>, InvalidValue> {
self.0.get_str(Tag(207))
}
#[doc(alias = "Issuer")]
pub fn issuer(&self) -> Result<Option<&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<&[u8]> {
self.0.get(Tag(349))
}
#[doc(alias = "SecurityDesc")]
pub fn security_desc(&self) -> Result<Option<&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<&[u8]> {
self.0.get(Tag(351))
}
#[doc(alias = "Side")]
pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
}
#[doc(alias = "IOIShares")]
pub fn ioi_shares(&self) -> Result<Option<IOIShares<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(27))?.map(IOIShares::from_value))
}
#[doc(alias = "Price")]
pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(44))
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[doc(alias = "ValidUntilTime")]
pub fn valid_until_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(62))
}
#[doc(alias = "IOIQltyInd")]
pub fn ioi_qlty_ind(&self) -> Result<Option<IOIQltyInd<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(25))?.map(IOIQltyInd::from_value))
}
#[doc(alias = "IOINaturalFlag")]
pub fn ioi_natural_flag(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(130))
}
#[doc(alias = "NoIOIQualifiers")]
pub fn ioi_qualifiers(&self) -> Result<Instances<'_, IOIIOIQualifiers<'_>>, InvalidValue> {
self.0.get_group(&IOIIOIQualifiers::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "Text")]
pub fn text(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(58))
}
#[doc(alias = "EncodedTextLen")]
pub fn encoded_text_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(354))
}
#[doc(alias = "EncodedText")]
pub fn encoded_text(&self) -> Option<&[u8]> {
self.0.get(Tag(355))
}
#[doc(alias = "TransactTime")]
pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(60))
}
#[doc(alias = "URLLink")]
pub fn url_link(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(149))
}
#[doc(alias = "NoRoutingIDs")]
pub fn routing_ids(&self) -> Result<Instances<'_, IOIRoutingIDs<'_>>, InvalidValue> {
self.0.get_group(&IOIRoutingIDs::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "SpreadToBenchmark")]
pub fn spread_to_benchmark(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(218))
}
#[doc(alias = "Benchmark")]
pub fn benchmark(&self) -> Result<Option<Benchmark<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(219))?.map(Benchmark::from_value))
}
}
impl std::fmt::Debug for IOI {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "IOI({})", self.0)
}
}
impl std::fmt::Display for IOI {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}
#[derive(Clone, Copy)]
pub struct IOIIOIQualifiers<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for IOIIOIQualifiers<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> IOIIOIQualifiers<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(199),
Tag(104),
&[Tag(104)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(104)], &[]);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "IOIQualifier")]
pub fn ioi_qualifier(&self) -> Result<Option<IOIQualifier<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(104))?.map(IOIQualifier::from_value))
}
}
impl std::fmt::Debug for IOIIOIQualifiers<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "IOIIOIQualifiers({})", self.0)
}
}
#[derive(Clone, Copy)]
pub struct IOIRoutingIDs<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for IOIRoutingIDs<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> IOIRoutingIDs<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(215),
Tag(216),
&[Tag(216), Tag(217)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(216), Tag(217)], &[]);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "RoutingType")]
pub fn routing_type(&self) -> Result<Option<RoutingType>, InvalidValue> {
Ok(self.0.get_int(Tag(216))?.map(RoutingType::from_value))
}
#[doc(alias = "RoutingID")]
pub fn routing_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(217))
}
}
impl std::fmt::Debug for IOIRoutingIDs<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "IOIRoutingIDs({})", self.0)
}
}