#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Date, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{
FinancingDetails, Header, InstrmtLegGrp, Instrument, InstrumentExtension, Parties, Trailer,
TrdCapDtGrp, UndInstrmtGrp,
};
use super::super::enums::{
ExecType, MatchStatus, MultiLegReportingType, ResponseTransportType, Side,
SubscriptionRequestType, TradeRequestType, TrdType,
};
pub struct TradeCaptureReportRequest(RawMessage);
impl TradeCaptureReportRequest {
pub const MSG_TYPE: &[u8] = b"AD";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(568), Tag(569), Tag(263), Tag(571), Tag(818), Tag(17), Tag(150), Tag(37),
Tag(11), Tag(573), Tag(828), Tag(829), Tag(830), Tag(855), Tag(820), Tag(880),
Tag(453), Tag(711), Tag(555), Tag(580), Tag(715), Tag(336), Tag(625), Tag(943),
Tag(54), Tag(442), Tag(578), Tag(579), Tag(725), Tag(726), Tag(58), Tag(354),
Tag(355),
],
&[
Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
Instrument::known_tags(), InstrumentExtension::known_tags(),
FinancingDetails::known_tags(), UndInstrmtGrp::known_tags(),
InstrmtLegGrp::known_tags(), TrdCapDtGrp::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(), Self::known_tags().get())
}
pub fn trailer(&self) -> Trailer<'_> {
Trailer(self.0.scope())
}
#[doc(alias = "TradeRequestID")]
pub fn trade_request_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(568))
}
#[doc(alias = "TradeRequestType")]
pub fn trade_request_type(&self) -> Result<Option<TradeRequestType>, InvalidValue> {
Ok(self.0.get_int(Tag(569))?.map(TradeRequestType::from_value))
}
#[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 = "TradeReportID")]
pub fn trade_report_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(571))
}
#[doc(alias = "SecondaryTradeReportID")]
pub fn secondary_trade_report_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(818))
}
#[doc(alias = "ExecID")]
pub fn exec_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(17))
}
#[doc(alias = "ExecType")]
pub fn exec_type(&self) -> Result<Option<ExecType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(150))?.map(ExecType::from_value))
}
#[doc(alias = "OrderID")]
pub fn order_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(37))
}
#[doc(alias = "ClOrdID")]
pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(11))
}
#[doc(alias = "MatchStatus")]
pub fn match_status(&self) -> Result<Option<MatchStatus<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(573))?.map(MatchStatus::from_value))
}
#[doc(alias = "TrdType")]
pub fn trd_type(&self) -> Result<Option<TrdType>, InvalidValue> {
Ok(self.0.get_int(Tag(828))?.map(TrdType::from_value))
}
#[doc(alias = "TrdSubType")]
pub fn trd_sub_type(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(829))
}
#[doc(alias = "TransferReason")]
pub fn transfer_reason(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(830))
}
#[doc(alias = "SecondaryTrdType")]
pub fn secondary_trd_type(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(855))
}
#[doc(alias = "TradeLinkID")]
pub fn trade_link_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(820))
}
#[doc(alias = "TrdMatchID")]
pub fn trd_match_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(880))
}
#[doc(alias = "NoPartyIDs")]
pub fn party_ids(&self) -> Result<Instances<'_, Parties<'_>>, InvalidValue> {
self.0.get_group(&Parties::TABLE, &Self::known_tags().get()).map(Instances::from)
}
pub fn instrument(&self) -> Instrument<'_> {
Instrument(self.0.scope(), Self::known_tags().get())
}
pub fn instrument_extension(&self) -> InstrumentExtension<'_> {
InstrumentExtension(self.0.scope(), Self::known_tags().get())
}
pub fn financing_details(&self) -> FinancingDetails<'_> {
FinancingDetails(self.0.scope())
}
#[doc(alias = "NoUnderlyings")]
pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoLegs")]
pub fn legs(&self) -> Result<Instances<'_, InstrmtLegGrp<'_>>, InvalidValue> {
self.0.get_group(&InstrmtLegGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoDates")]
pub fn dates(&self) -> Result<Instances<'_, TrdCapDtGrp<'_>>, InvalidValue> {
self.0.get_group(&TrdCapDtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "ClearingBusinessDate")]
pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(715))
}
#[doc(alias = "TradingSessionID")]
pub fn trading_session_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(336))
}
#[doc(alias = "TradingSessionSubID")]
pub fn trading_session_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(625))
}
#[doc(alias = "TimeBracket")]
pub fn time_bracket(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(943))
}
#[doc(alias = "Side")]
pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
}
#[doc(alias = "MultiLegReportingType")]
pub fn multi_leg_reporting_type(&self) -> Result<Option<MultiLegReportingType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(442))?.map(MultiLegReportingType::from_value))
}
#[doc(alias = "TradeInputSource")]
pub fn trade_input_source(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(578))
}
#[doc(alias = "TradeInputDevice")]
pub fn trade_input_device(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(579))
}
#[doc(alias = "ResponseTransportType")]
pub fn response_transport_type(&self) -> Result<Option<ResponseTransportType>, InvalidValue> {
Ok(self.0.get_int(Tag(725))?.map(ResponseTransportType::from_value))
}
#[doc(alias = "ResponseDestination")]
pub fn response_destination(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(726))
}
#[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))
}
}
impl std::fmt::Debug for TradeCaptureReportRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "TradeCaptureReportRequest({})", self.0)
}
}
impl std::fmt::Display for TradeCaptureReportRequest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}