#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Date, Decimal, Instances, InvalidValue, LazyKnownTags, MultipleValues, RawMessage, Tag,
UtcTimestamp,
};
use super::super::components::{
DiscretionInstructions, Header, InstrmtLegGrp, Instrument, PegInstructions, SideCrossOrdModGrp,
SpreadOrBenchmarkCurveData, Stipulations, Trailer, TrdgSesGrp, UndInstrmtGrp, YieldData,
};
use super::super::enums::{
CancellationRights, CrossPrioritization, CrossType, ExecInst, GTBookingInst, HandlInst,
MoneyLaunderingStatus, OrdType, PriceType, ProcessCode, SettlType, TargetStrategy, TimeInForce,
};
pub struct NewOrderCross(RawMessage);
impl NewOrderCross {
pub const MSG_TYPE: &[u8] = b"s";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(548), Tag(549), Tag(550), Tag(552), Tag(711), Tag(555), Tag(63), Tag(64),
Tag(21), Tag(18), Tag(110), Tag(111), Tag(100), Tag(386), Tag(81), Tag(140),
Tag(114), Tag(60), Tag(232), Tag(40), Tag(423), Tag(44), Tag(99), Tag(15), Tag(376),
Tag(23), Tag(117), Tag(59), Tag(168), Tag(432), Tag(126), Tag(427), Tag(210),
Tag(847), Tag(848), Tag(849), Tag(480), Tag(481), Tag(513), Tag(494),
],
&[
Header::known_tags(), Trailer::known_tags(), SideCrossOrdModGrp::known_tags(),
Instrument::known_tags(), UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(),
TrdgSesGrp::known_tags(), Stipulations::known_tags(),
SpreadOrBenchmarkCurveData::known_tags(), YieldData::known_tags(),
PegInstructions::known_tags(), DiscretionInstructions::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 = "CrossID")]
pub fn cross_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(548))
}
#[doc(alias = "CrossType")]
pub fn cross_type(&self) -> Result<Option<CrossType>, InvalidValue> {
Ok(self.0.get_int(Tag(549))?.map(CrossType::from_value))
}
#[doc(alias = "CrossPrioritization")]
pub fn cross_prioritization(&self) -> Result<Option<CrossPrioritization>, InvalidValue> {
Ok(self.0.get_int(Tag(550))?.map(CrossPrioritization::from_value))
}
#[doc(alias = "NoSides")]
pub fn sides(&self) -> Result<Instances<'_, SideCrossOrdModGrp<'_>>, InvalidValue> {
self.0.get_group(&SideCrossOrdModGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
pub fn instrument(&self) -> Instrument<'_> {
Instrument(self.0.scope(), Self::known_tags().get())
}
#[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 = "SettlType")]
pub fn settl_type(&self) -> Result<Option<SettlType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(63))?.map(SettlType::from_value))
}
#[doc(alias = "SettlDate")]
pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(64))
}
#[doc(alias = "HandlInst")]
pub fn handl_inst(&self) -> Result<Option<HandlInst<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(21))?.map(HandlInst::from_value))
}
#[doc(alias = "ExecInst")]
pub fn exec_inst(&self) -> Result<Option<MultipleValues<'_, ExecInst<'_>>>, InvalidValue> {
self.0.get_multiple_values(Tag(18))
}
#[doc(alias = "MinQty")]
pub fn min_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(110))
}
#[doc(alias = "MaxFloor")]
pub fn max_floor(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(111))
}
#[doc(alias = "ExDestination")]
pub fn ex_destination(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(100))
}
#[doc(alias = "NoTradingSessions")]
pub fn trading_sessions(&self) -> Result<Instances<'_, TrdgSesGrp<'_>>, InvalidValue> {
self.0.get_group(&TrdgSesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "ProcessCode")]
pub fn process_code(&self) -> Result<Option<ProcessCode<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(81))?.map(ProcessCode::from_value))
}
#[doc(alias = "PrevClosePx")]
pub fn prev_close_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(140))
}
#[doc(alias = "LocateReqd")]
pub fn locate_reqd(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(114))
}
#[doc(alias = "TransactTime")]
pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(60))
}
#[doc(alias = "NoStipulations")]
pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "OrdType")]
pub fn ord_type(&self) -> Result<Option<OrdType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(40))?.map(OrdType::from_value))
}
#[doc(alias = "PriceType")]
pub fn price_type(&self) -> Result<Option<PriceType>, InvalidValue> {
Ok(self.0.get_int(Tag(423))?.map(PriceType::from_value))
}
#[doc(alias = "Price")]
pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(44))
}
#[doc(alias = "StopPx")]
pub fn stop_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(99))
}
pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
SpreadOrBenchmarkCurveData(self.0.scope())
}
pub fn yield_data(&self) -> YieldData<'_> {
YieldData(self.0.scope())
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[doc(alias = "ComplianceID")]
pub fn compliance_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(376))
}
#[doc(alias = "IOIID")]
pub fn ioiid(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(23))
}
#[doc(alias = "QuoteID")]
pub fn quote_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(117))
}
#[doc(alias = "TimeInForce")]
pub fn time_in_force(&self) -> Result<Option<TimeInForce<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(59))?.map(TimeInForce::from_value))
}
#[doc(alias = "EffectiveTime")]
pub fn effective_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(168))
}
#[doc(alias = "ExpireDate")]
pub fn expire_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(432))
}
#[doc(alias = "ExpireTime")]
pub fn expire_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(126))
}
#[doc(alias = "GTBookingInst")]
pub fn gt_booking_inst(&self) -> Result<Option<GTBookingInst>, InvalidValue> {
Ok(self.0.get_int(Tag(427))?.map(GTBookingInst::from_value))
}
#[doc(alias = "MaxShow")]
pub fn max_show(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(210))
}
pub fn peg_instructions(&self) -> PegInstructions<'_> {
PegInstructions(self.0.scope())
}
pub fn discretion_instructions(&self) -> DiscretionInstructions<'_> {
DiscretionInstructions(self.0.scope())
}
#[doc(alias = "TargetStrategy")]
pub fn target_strategy(&self) -> Result<Option<TargetStrategy>, InvalidValue> {
Ok(self.0.get_int(Tag(847))?.map(TargetStrategy::from_value))
}
#[doc(alias = "TargetStrategyParameters")]
pub fn target_strategy_parameters(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(848))
}
#[doc(alias = "ParticipationRate")]
pub fn participation_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(849))
}
#[doc(alias = "CancellationRights")]
pub fn cancellation_rights(&self) -> Result<Option<CancellationRights<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(480))?.map(CancellationRights::from_value))
}
#[doc(alias = "MoneyLaunderingStatus")]
pub fn money_laundering_status(&self) -> Result<Option<MoneyLaunderingStatus<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(481))?.map(MoneyLaunderingStatus::from_value))
}
#[doc(alias = "RegistID")]
pub fn regist_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(513))
}
#[doc(alias = "Designation")]
pub fn designation(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(494))
}
}
impl std::fmt::Debug for NewOrderCross {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "NewOrderCross({})", self.0)
}
}
impl std::fmt::Display for NewOrderCross {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}