#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Date, Decimal, GroupTable, Instances, InvalidValue, LazyKnownTags, MonthYear, RawMessage, Tag,
UtcTimestamp,
};
use super::super::components::{Header, Trailer};
use super::super::enums::{
AllocHandlInst, AllocLinkType, AllocTransType, CommType, IDSource, LastCapacity, MiscFeeType,
OpenClose, ProcessCode, PutOrCall, SecurityType, SettlInstMode, SettlmntTyp, Side,
};
pub struct Allocation(RawMessage);
impl Allocation {
pub const MSG_TYPE: &[u8] = b"J";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(70), Tag(71), Tag(72), Tag(196), Tag(197), Tag(73), Tag(124), Tag(54), 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(53), Tag(30), Tag(336), Tag(6), Tag(15), Tag(74), Tag(75),
Tag(60), Tag(63), Tag(64), Tag(381), Tag(118), Tag(77), Tag(58), Tag(354), Tag(355),
Tag(157), Tag(158), Tag(78),
],
&[
Header::known_tags(), Trailer::known_tags(), AllocationOrders::known_tags(),
AllocationExecs::known_tags(), AllocationAllocs::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 = "AllocID")]
pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(70))
}
#[doc(alias = "AllocTransType")]
pub fn alloc_trans_type(&self) -> Result<Option<AllocTransType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(71))?.map(AllocTransType::from_value))
}
#[doc(alias = "RefAllocID")]
pub fn ref_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(72))
}
#[doc(alias = "AllocLinkID")]
pub fn alloc_link_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(196))
}
#[doc(alias = "AllocLinkType")]
pub fn alloc_link_type(&self) -> Result<Option<AllocLinkType>, InvalidValue> {
Ok(self.0.get_int(Tag(197))?.map(AllocLinkType::from_value))
}
#[doc(alias = "NoOrders")]
pub fn orders(&self) -> Result<Instances<'_, AllocationOrders<'_>>, InvalidValue> {
self.0.get_group(&AllocationOrders::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoExecs")]
pub fn execs(&self) -> Result<Instances<'_, AllocationExecs<'_>>, InvalidValue> {
self.0.get_group(&AllocationExecs::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "Side")]
pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
}
#[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 = "Shares")]
pub fn shares(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(53))
}
#[doc(alias = "LastMkt")]
pub fn last_mkt(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(30))
}
#[doc(alias = "TradingSessionID")]
pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(336))
}
#[doc(alias = "AvgPx")]
pub fn avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(6))
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[doc(alias = "AvgPrxPrecision")]
pub fn avg_prx_precision(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(74))
}
#[doc(alias = "TradeDate")]
pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(75))
}
#[doc(alias = "TransactTime")]
pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(60))
}
#[doc(alias = "SettlmntTyp")]
pub fn settlmnt_typ(&self) -> Result<Option<SettlmntTyp<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(63))?.map(SettlmntTyp::from_value))
}
#[doc(alias = "FutSettDate")]
pub fn fut_sett_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(64))
}
#[doc(alias = "GrossTradeAmt")]
pub fn gross_trade_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(381))
}
#[doc(alias = "NetMoney")]
pub fn net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(118))
}
#[doc(alias = "OpenClose")]
pub fn open_close(&self) -> Result<Option<OpenClose<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(77))?.map(OpenClose::from_value))
}
#[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 = "NumDaysInterest")]
pub fn num_days_interest(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(157))
}
#[doc(alias = "AccruedInterestRate")]
pub fn accrued_interest_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(158))
}
#[doc(alias = "NoAllocs")]
pub fn allocs(&self) -> Result<Instances<'_, AllocationAllocs<'_>>, InvalidValue> {
self.0.get_group(&AllocationAllocs::TABLE, &Self::known_tags().get()).map(Instances::from)
}
}
impl std::fmt::Debug for Allocation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Allocation({})", self.0)
}
}
impl std::fmt::Display for Allocation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}
#[derive(Clone, Copy)]
pub struct AllocationOrders<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for AllocationOrders<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> AllocationOrders<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(73),
Tag(11),
&[Tag(11), Tag(37), Tag(66), Tag(105), Tag(198)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(11), Tag(37), Tag(198), Tag(66), Tag(105)],
&[],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "ClOrdID")]
pub fn cl_ord_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(11))
}
#[doc(alias = "OrderID")]
pub fn order_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(37))
}
#[doc(alias = "SecondaryOrderID")]
pub fn secondary_order_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(198))
}
#[doc(alias = "ListID")]
pub fn list_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(66))
}
#[doc(alias = "WaveNo")]
pub fn wave_no(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(105))
}
}
impl std::fmt::Debug for AllocationOrders<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "AllocationOrders({})", self.0)
}
}
#[derive(Clone, Copy)]
pub struct AllocationExecs<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for AllocationExecs<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> AllocationExecs<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(124),
Tag(32),
&[Tag(17), Tag(29), Tag(31), Tag(32)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[Tag(32), Tag(17), Tag(31), Tag(29)],
&[],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "LastShares")]
pub fn last_shares(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(32))
}
#[doc(alias = "ExecID")]
pub fn exec_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(17))
}
#[doc(alias = "LastPx")]
pub fn last_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(31))
}
#[doc(alias = "LastCapacity")]
pub fn last_capacity(&self) -> Result<Option<LastCapacity<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(29))?.map(LastCapacity::from_value))
}
}
impl std::fmt::Debug for AllocationExecs<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "AllocationExecs({})", self.0)
}
}
#[derive(Clone, Copy)]
pub struct AllocationAllocs<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for AllocationAllocs<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> AllocationAllocs<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(78),
Tag(79),
&[
Tag(12), Tag(13), Tag(76), Tag(79), Tag(80), Tag(81), Tag(92), Tag(109), Tag(119),
Tag(120), Tag(136), Tag(153), Tag(154), Tag(155), Tag(156), Tag(159), Tag(160),
Tag(161), Tag(208), Tag(209), Tag(360), Tag(361), Tag(366),
],
&[AllocationAllocsMiscFees::TABLE],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(79), Tag(366), Tag(80), Tag(81), Tag(92), Tag(208), Tag(209), Tag(161),
Tag(360), Tag(361), Tag(76), Tag(109), Tag(12), Tag(13), Tag(153), Tag(154),
Tag(119), Tag(120), Tag(155), Tag(156), Tag(159), Tag(160), Tag(136),
],
&[AllocationAllocsMiscFees::known_tags()],
);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "AllocAccount")]
pub fn alloc_account(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(79))
}
#[doc(alias = "AllocPrice")]
pub fn alloc_price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(366))
}
#[doc(alias = "AllocShares")]
pub fn alloc_shares(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(80))
}
#[doc(alias = "ProcessCode")]
pub fn process_code(&self) -> Result<Option<ProcessCode<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(81))?.map(ProcessCode::from_value))
}
#[doc(alias = "BrokerOfCredit")]
pub fn broker_of_credit(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(92))
}
#[doc(alias = "NotifyBrokerOfCredit")]
pub fn notify_broker_of_credit(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(208))
}
#[doc(alias = "AllocHandlInst")]
pub fn alloc_handl_inst(&self) -> Result<Option<AllocHandlInst>, InvalidValue> {
Ok(self.0.get_int(Tag(209))?.map(AllocHandlInst::from_value))
}
#[doc(alias = "AllocText")]
pub fn alloc_text(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(161))
}
#[doc(alias = "EncodedAllocTextLen")]
pub fn encoded_alloc_text_len(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(360))
}
#[doc(alias = "EncodedAllocText")]
pub fn encoded_alloc_text(&self) -> Option<&'a [u8]> {
self.0.get(Tag(361))
}
#[doc(alias = "ExecBroker")]
pub fn exec_broker(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(76))
}
#[doc(alias = "ClientID")]
pub fn client_id(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(109))
}
#[doc(alias = "Commission")]
pub fn commission(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(12))
}
#[doc(alias = "CommType")]
pub fn comm_type(&self) -> Result<Option<CommType<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(13))?.map(CommType::from_value))
}
#[doc(alias = "AllocAvgPx")]
pub fn alloc_avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(153))
}
#[doc(alias = "AllocNetMoney")]
pub fn alloc_net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(154))
}
#[doc(alias = "SettlCurrAmt")]
pub fn settl_curr_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(119))
}
#[doc(alias = "SettlCurrency")]
pub fn settl_currency(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(120))
}
#[doc(alias = "SettlCurrFxRate")]
pub fn settl_curr_fx_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(155))
}
#[doc(alias = "SettlCurrFxRateCalc")]
pub fn settl_curr_fx_rate_calc(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(156))
}
#[doc(alias = "AccruedInterestAmt")]
pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(159))
}
#[doc(alias = "SettlInstMode")]
pub fn settl_inst_mode(&self) -> Result<Option<SettlInstMode<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(160))?.map(SettlInstMode::from_value))
}
#[doc(alias = "NoMiscFees")]
pub fn misc_fees(&self) -> Result<Instances<'a, AllocationAllocsMiscFees<'a>>, InvalidValue> {
self.0.get_group(&AllocationAllocsMiscFees::TABLE, &Self::known_tags().get()).map(Instances::from)
}
}
impl std::fmt::Debug for AllocationAllocs<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "AllocationAllocs({})", self.0)
}
}
#[derive(Clone, Copy)]
pub struct AllocationAllocsMiscFees<'a>(refix_message::Scope<'a>);
impl<'a> From<refix_message::Scope<'a>> for AllocationAllocsMiscFees<'a> {
fn from(scope: refix_message::Scope<'a>) -> Self {
Self(scope)
}
}
impl<'a> AllocationAllocsMiscFees<'a> {
pub(in super::super) const TABLE: GroupTable<'static> = GroupTable::new(
Tag(136),
Tag(137),
&[Tag(137), Tag(138), Tag(139)],
&[],
);
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(&[Tag(137), Tag(138), Tag(139)], &[]);
&TAGS
}
pub fn raw(&self) -> refix_message::Scope<'a> {
self.0
}
#[doc(alias = "MiscFeeAmt")]
pub fn misc_fee_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(137))
}
#[doc(alias = "MiscFeeCurr")]
pub fn misc_fee_curr(&self) -> Result<Option<&'a str>, InvalidValue> {
self.0.get_str(Tag(138))
}
#[doc(alias = "MiscFeeType")]
pub fn misc_fee_type(&self) -> Result<Option<MiscFeeType<'a>>, InvalidValue> {
Ok(self.0.get_str(Tag(139))?.map(MiscFeeType::from_value))
}
}
impl std::fmt::Debug for AllocationAllocsMiscFees<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "AllocationAllocsMiscFees({})", self.0)
}
}