#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, Tag};
use super::super::enums::ExpirationCycle;
use super::{
AttrbGrp, EvntGrp, FinancingDetails, InstrmtLegSecListGrp, Instrument, InstrumentExtension,
SecAltIDGrp, SpreadOrBenchmarkCurveData, Stipulations, UndInstrmtGrp, YieldData,
};
#[derive(Clone, Copy)]
pub struct SecListGrp<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for SecListGrp<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> SecListGrp<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(146),
Tag(55),
&[
Tag(15), Tag(22), Tag(48), Tag(55), Tag(58), Tag(65), Tag(106), Tag(107), Tag(167),
Tag(200), Tag(201), Tag(202), Tag(206), Tag(207), Tag(218), Tag(220), Tag(221),
Tag(222), Tag(223), Tag(224), Tag(225), Tag(226), Tag(227), Tag(228), Tag(231),
Tag(232), Tag(235), Tag(236), Tag(239), Tag(240), Tag(255), Tag(336), Tag(348),
Tag(349), Tag(350), Tag(351), Tag(354), Tag(355), Tag(454), Tag(460), Tag(461),
Tag(470), Tag(471), Tag(472), Tag(541), Tag(543), Tag(555), Tag(561), Tag(562),
Tag(625), Tag(662), Tag(663), Tag(667), Tag(668), Tag(691), Tag(696), Tag(697),
Tag(698), Tag(699), Tag(701), Tag(711), Tag(761), Tag(762), Tag(788), Tag(827),
Tag(864), Tag(869), Tag(870), Tag(873), Tag(874), Tag(875), Tag(876), Tag(898),
Tag(913), Tag(914), Tag(915), Tag(916), Tag(917), Tag(918), Tag(919), Tag(947),
],
&[
SecAltIDGrp::TABLE, EvntGrp::TABLE, AttrbGrp::TABLE, UndInstrmtGrp::TABLE,
Stipulations::TABLE, InstrmtLegSecListGrp::TABLE,
],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(711), Tag(15), Tag(232), Tag(555), Tag(561), Tag(562), Tag(336), Tag(625),
Tag(827), Tag(58), Tag(354), Tag(355),
],
&[
Instrument::known_tags(), InstrumentExtension::known_tags(),
FinancingDetails::known_tags(), UndInstrmtGrp::known_tags(),
Stipulations::known_tags(), InstrmtLegSecListGrp::known_tags(),
SpreadOrBenchmarkCurveData::known_tags(), YieldData::known_tags(),
],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
pub fn instrument(&self) -> Instrument<'a> {
Instrument(self.0, Self::known_tags().get())
}
pub fn instrument_extension(&self) -> InstrumentExtension<'a> {
InstrumentExtension(self.0, Self::known_tags().get())
}
pub fn financing_details(&self) -> FinancingDetails<'a> {
FinancingDetails(self.0)
}
#[doc(alias = "NoUnderlyings")]
pub fn underlyings(&self) -> Result<Instances<'a, UndInstrmtGrp<'a>>, InvalidValue> {
self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[doc(alias = "NoStipulations")]
pub fn stipulations(&self) -> Result<Instances<'a, Stipulations<'a>>, InvalidValue> {
self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoLegs")]
pub fn legs(&self) -> Result<Instances<'a, InstrmtLegSecListGrp<'a>>, InvalidValue> {
self.0.get_group(&InstrmtLegSecListGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'a> {
SpreadOrBenchmarkCurveData(self.0)
}
pub fn yield_data(&self) -> YieldData<'a> {
YieldData(self.0)
}
#[doc(alias = "RoundLot")]
pub fn round_lot(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(561))
}
#[doc(alias = "MinTradeVol")]
pub fn min_trade_vol(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(562))
}
#[doc(alias = "TradingSessionID")]
pub fn trading_session_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(336))
}
#[doc(alias = "TradingSessionSubID")]
pub fn trading_session_sub_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(625))
}
#[doc(alias = "ExpirationCycle")]
pub fn expiration_cycle(&self) -> Result<Option<ExpirationCycle>, InvalidValue> {
Ok(self.0.get_int(Tag(827))?.map(ExpirationCycle::from_value))
}
#[doc(alias = "Text")]
pub fn text(&self) -> Result<Option<&'a 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<&'a [u8]> {
self.0.get(Tag(355))
}
}
impl std::fmt::Debug for SecListGrp<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "SecListGrp({})", self.0)
}
}