#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Date, Decimal, Instances, InvalidValue, KnownTags, LazyKnownTags, MonthYear, Tag,
};
use super::LegSecAltIDGrp;
#[derive(Clone, Copy)]
pub struct InstrumentLeg<'a>(
pub(in super::super) refix_message::Scope<'a>,
pub(in super::super) KnownTags<'static>,
);
impl<'a> InstrumentLeg<'a> {
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(600), Tag(601), Tag(602), Tag(603), Tag(604), Tag(607), Tag(608), Tag(609),
Tag(764), Tag(610), Tag(611), Tag(248), Tag(249), Tag(250), Tag(251), Tag(252),
Tag(253), Tag(257), Tag(599), Tag(596), Tag(597), Tag(598), Tag(254), Tag(612),
Tag(942), Tag(613), Tag(614), Tag(615), Tag(616), Tag(617), Tag(618), Tag(619),
Tag(620), Tag(621), Tag(622), Tag(623), Tag(624), Tag(556), Tag(740), Tag(739),
Tag(955), Tag(956),
],
&[LegSecAltIDGrp::known_tags()],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "LegSymbol")]
pub fn leg_symbol(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(600))
}
#[doc(alias = "LegSymbolSfx")]
pub fn leg_symbol_sfx(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(601))
}
#[doc(alias = "LegSecurityID")]
pub fn leg_security_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(602))
}
#[doc(alias = "LegSecurityIDSource")]
pub fn leg_security_id_source(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(603))
}
#[doc(alias = "NoLegSecurityAltID")]
pub fn leg_security_alt_id(&self) -> Result<Instances<'a, LegSecAltIDGrp<'a>>, InvalidValue> {
self.0.get_group(&LegSecAltIDGrp::TABLE, &self.1).map(Instances::from)
}
#[doc(alias = "LegProduct")]
pub fn leg_product(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(607))
}
#[doc(alias = "LegCFICode")]
pub fn leg_cfi_code(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(608))
}
#[doc(alias = "LegSecurityType")]
pub fn leg_security_type(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(609))
}
#[doc(alias = "LegSecuritySubType")]
pub fn leg_security_sub_type(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(764))
}
#[doc(alias = "LegMaturityMonthYear")]
pub fn leg_maturity_month_year(&self) -> Result<Option<MonthYear>, InvalidValue> {
self.0.get_month_year(Tag(610))
}
#[doc(alias = "LegMaturityDate")]
pub fn leg_maturity_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(611))
}
#[doc(alias = "LegCouponPaymentDate")]
pub fn leg_coupon_payment_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(248))
}
#[doc(alias = "LegIssueDate")]
pub fn leg_issue_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(249))
}
#[doc(alias = "LegRepoCollateralSecurityType")]
pub fn leg_repo_collateral_security_type(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(250))
}
#[doc(alias = "LegRepurchaseTerm")]
pub fn leg_repurchase_term(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(251))
}
#[doc(alias = "LegRepurchaseRate")]
pub fn leg_repurchase_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(252))
}
#[doc(alias = "LegFactor")]
pub fn leg_factor(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(253))
}
#[doc(alias = "LegCreditRating")]
pub fn leg_credit_rating(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(257))
}
#[doc(alias = "LegInstrRegistry")]
pub fn leg_instr_registry(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(599))
}
#[doc(alias = "LegCountryOfIssue")]
pub fn leg_country_of_issue(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(596))
}
#[doc(alias = "LegStateOrProvinceOfIssue")]
pub fn leg_state_or_province_of_issue(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(597))
}
#[doc(alias = "LegLocaleOfIssue")]
pub fn leg_locale_of_issue(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(598))
}
#[doc(alias = "LegRedemptionDate")]
pub fn leg_redemption_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(254))
}
#[doc(alias = "LegStrikePrice")]
pub fn leg_strike_price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(612))
}
#[doc(alias = "LegStrikeCurrency")]
pub fn leg_strike_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(942))
}
#[doc(alias = "LegOptAttribute")]
pub fn leg_opt_attribute(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(613))
}
#[doc(alias = "LegContractMultiplier")]
pub fn leg_contract_multiplier(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(614))
}
#[doc(alias = "LegCouponRate")]
pub fn leg_coupon_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(615))
}
#[doc(alias = "LegSecurityExchange")]
pub fn leg_security_exchange(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(616))
}
#[doc(alias = "LegIssuer")]
pub fn leg_issuer(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(617))
}
#[doc(alias = "EncodedLegIssuerLen")]
pub fn encoded_leg_issuer_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(618))
}
#[doc(alias = "EncodedLegIssuer")]
pub fn encoded_leg_issuer(&self) -> Option<&'a [u8]> {
self.0.get(Tag(619))
}
#[doc(alias = "LegSecurityDesc")]
pub fn leg_security_desc(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(620))
}
#[doc(alias = "EncodedLegSecurityDescLen")]
pub fn encoded_leg_security_desc_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(621))
}
#[doc(alias = "EncodedLegSecurityDesc")]
pub fn encoded_leg_security_desc(&self) -> Option<&'a [u8]> {
self.0.get(Tag(622))
}
#[doc(alias = "LegRatioQty")]
pub fn leg_ratio_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(623))
}
#[doc(alias = "LegSide")]
pub fn leg_side(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(624))
}
#[doc(alias = "LegCurrency")]
pub fn leg_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(556))
}
#[doc(alias = "LegPool")]
pub fn leg_pool(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(740))
}
#[doc(alias = "LegDatedDate")]
pub fn leg_dated_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(739))
}
#[doc(alias = "LegContractSettlMonth")]
pub fn leg_contract_settl_month(&self) -> Result<Option<MonthYear>, InvalidValue> {
self.0.get_month_year(Tag(955))
}
#[doc(alias = "LegInterestAccrualDate")]
pub fn leg_interest_accrual_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(956))
}
}
impl std::fmt::Debug for InstrumentLeg<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "InstrumentLeg({})", self.0.display_known(&Self::known_tags().get()))
}
}