#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Date, Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp,
};
use super::super::components::{
CommissionData, CpctyConfGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument,
InstrumentExtension, MiscFeesGrp, OrdAllocGrp, Parties, SettlInstructionsData,
SpreadOrBenchmarkCurveData, Stipulations, Trailer, TrdRegTimestamps, UndInstrmtGrp, YieldData,
};
use super::super::enums::{
AllocAccountType, ConfirmStatus, ConfirmTransType, ConfirmType, PriceType, ProcessCode, QtyType,
SettlCurrFxRateCalc, SettlType, Side,
};
pub struct Confirmation(RawMessage);
impl Confirmation {
pub const MSG_TYPE: &[u8] = b"AK";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(664), Tag(772), Tag(859), Tag(666), Tag(773), Tag(797), Tag(650), Tag(665),
Tag(453), Tag(73), Tag(70), Tag(793), Tag(467), Tag(60), Tag(75), Tag(768),
Tag(711), Tag(555), Tag(80), Tag(854), Tag(54), Tag(15), Tag(30), Tag(862), Tag(79),
Tag(661), Tag(798), Tag(6), Tag(74), Tag(423), Tag(860), Tag(861), Tag(58),
Tag(354), Tag(355), Tag(81), Tag(381), Tag(157), Tag(230), Tag(158), Tag(159),
Tag(738), Tag(920), Tag(921), Tag(922), Tag(238), Tag(237), Tag(118), Tag(890),
Tag(119), Tag(120), Tag(155), Tag(156), Tag(63), Tag(64), Tag(858), Tag(232),
Tag(136),
],
&[
Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
OrdAllocGrp::known_tags(), TrdRegTimestamps::known_tags(), Instrument::known_tags(),
InstrumentExtension::known_tags(), FinancingDetails::known_tags(),
UndInstrmtGrp::known_tags(), InstrmtLegGrp::known_tags(), YieldData::known_tags(),
CpctyConfGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
SettlInstructionsData::known_tags(), CommissionData::known_tags(),
Stipulations::known_tags(), MiscFeesGrp::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 = "ConfirmID")]
pub fn confirm_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(664))
}
#[doc(alias = "ConfirmRefID")]
pub fn confirm_ref_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(772))
}
#[doc(alias = "ConfirmReqID")]
pub fn confirm_req_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(859))
}
#[doc(alias = "ConfirmTransType")]
pub fn confirm_trans_type(&self) -> Result<Option<ConfirmTransType>, InvalidValue> {
Ok(self.0.get_int(Tag(666))?.map(ConfirmTransType::from_value))
}
#[doc(alias = "ConfirmType")]
pub fn confirm_type(&self) -> Result<Option<ConfirmType>, InvalidValue> {
Ok(self.0.get_int(Tag(773))?.map(ConfirmType::from_value))
}
#[doc(alias = "CopyMsgIndicator")]
pub fn copy_msg_indicator(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(797))
}
#[doc(alias = "LegalConfirm")]
pub fn legal_confirm(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(650))
}
#[doc(alias = "ConfirmStatus")]
pub fn confirm_status(&self) -> Result<Option<ConfirmStatus>, InvalidValue> {
Ok(self.0.get_int(Tag(665))?.map(ConfirmStatus::from_value))
}
#[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)
}
#[doc(alias = "NoOrders")]
pub fn orders(&self) -> Result<Instances<'_, OrdAllocGrp<'_>>, InvalidValue> {
self.0.get_group(&OrdAllocGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "AllocID")]
pub fn alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(70))
}
#[doc(alias = "SecondaryAllocID")]
pub fn secondary_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(793))
}
#[doc(alias = "IndividualAllocID")]
pub fn individual_alloc_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(467))
}
#[doc(alias = "TransactTime")]
pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(60))
}
#[doc(alias = "TradeDate")]
pub fn trade_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(75))
}
#[doc(alias = "NoTrdRegTimestamps")]
pub fn trd_reg_timestamps(&self) -> Result<Instances<'_, TrdRegTimestamps<'_>>, InvalidValue> {
self.0.get_group(&TrdRegTimestamps::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)
}
pub fn yield_data(&self) -> YieldData<'_> {
YieldData(self.0.scope())
}
#[doc(alias = "AllocQty")]
pub fn alloc_qty(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(80))
}
#[doc(alias = "QtyType")]
pub fn qty_type(&self) -> Result<Option<QtyType>, InvalidValue> {
Ok(self.0.get_int(Tag(854))?.map(QtyType::from_value))
}
#[doc(alias = "Side")]
pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[doc(alias = "LastMkt")]
pub fn last_mkt(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(30))
}
#[doc(alias = "NoCapacities")]
pub fn capacities(&self) -> Result<Instances<'_, CpctyConfGrp<'_>>, InvalidValue> {
self.0.get_group(&CpctyConfGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "AllocAccount")]
pub fn alloc_account(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(79))
}
#[doc(alias = "AllocAcctIDSource")]
pub fn alloc_acct_id_source(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(661))
}
#[doc(alias = "AllocAccountType")]
pub fn alloc_account_type(&self) -> Result<Option<AllocAccountType>, InvalidValue> {
Ok(self.0.get_int(Tag(798))?.map(AllocAccountType::from_value))
}
#[doc(alias = "AvgPx")]
pub fn avg_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(6))
}
#[doc(alias = "AvgPxPrecision")]
pub fn avg_px_precision(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(74))
}
#[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 = "AvgParPx")]
pub fn avg_par_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(860))
}
pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
SpreadOrBenchmarkCurveData(self.0.scope())
}
#[doc(alias = "ReportedPx")]
pub fn reported_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(861))
}
#[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 = "ProcessCode")]
pub fn process_code(&self) -> Result<Option<ProcessCode<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(81))?.map(ProcessCode::from_value))
}
#[doc(alias = "GrossTradeAmt")]
pub fn gross_trade_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(381))
}
#[doc(alias = "NumDaysInterest")]
pub fn num_days_interest(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(157))
}
#[doc(alias = "ExDate")]
pub fn ex_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(230))
}
#[doc(alias = "AccruedInterestRate")]
pub fn accrued_interest_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(158))
}
#[doc(alias = "AccruedInterestAmt")]
pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(159))
}
#[doc(alias = "InterestAtMaturity")]
pub fn interest_at_maturity(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(738))
}
#[doc(alias = "EndAccruedInterestAmt")]
pub fn end_accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(920))
}
#[doc(alias = "StartCash")]
pub fn start_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(921))
}
#[doc(alias = "EndCash")]
pub fn end_cash(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(922))
}
#[doc(alias = "Concession")]
pub fn concession(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(238))
}
#[doc(alias = "TotalTakedown")]
pub fn total_takedown(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(237))
}
#[doc(alias = "NetMoney")]
pub fn net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(118))
}
#[doc(alias = "MaturityNetMoney")]
pub fn maturity_net_money(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(890))
}
#[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<&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<SettlCurrFxRateCalc<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(156))?.map(SettlCurrFxRateCalc::from_value))
}
#[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))
}
pub fn settl_instructions_data(&self) -> SettlInstructionsData<'_> {
SettlInstructionsData(self.0.scope(), Self::known_tags().get())
}
pub fn commission_data(&self) -> CommissionData<'_> {
CommissionData(self.0.scope())
}
#[doc(alias = "SharedCommission")]
pub fn shared_commission(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(858))
}
#[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 = "NoMiscFees")]
pub fn misc_fees(&self) -> Result<Instances<'_, MiscFeesGrp<'_>>, InvalidValue> {
self.0.get_group(&MiscFeesGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
}
impl std::fmt::Debug for Confirmation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Confirmation({})", self.0)
}
}
impl std::fmt::Display for Confirmation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}