#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{Date, Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag};
use super::super::components::{
ExecCollGrp, FinancingDetails, Header, InstrmtLegGrp, Instrument, MiscFeesGrp, Parties,
SettlInstructionsData, SpreadOrBenchmarkCurveData, Stipulations, Trailer, TrdCollGrp,
TrdRegTimestamps, UndInstrmtGrp,
};
use super::super::enums::{AccountType, CollStatus, PriceType, QtyType, SettlSessID, Side};
pub struct CollateralReport(RawMessage);
impl CollateralReport {
pub const MSG_TYPE: &[u8] = b"BA";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(908), Tag(909), Tag(910), Tag(911), Tag(912), Tag(453), Tag(1), Tag(581),
Tag(11), Tag(37), Tag(198), Tag(526), Tag(124), Tag(897), Tag(64), Tag(53),
Tag(854), Tag(15), Tag(555), Tag(711), Tag(899), Tag(900), Tag(901), Tag(768),
Tag(54), Tag(136), Tag(44), Tag(423), Tag(159), Tag(920), Tag(921), Tag(922),
Tag(232), Tag(336), Tag(625), Tag(716), Tag(717), Tag(715), Tag(58), Tag(354),
Tag(355),
],
&[
Header::known_tags(), Trailer::known_tags(), Parties::known_tags(),
ExecCollGrp::known_tags(), TrdCollGrp::known_tags(), Instrument::known_tags(),
FinancingDetails::known_tags(), InstrmtLegGrp::known_tags(),
UndInstrmtGrp::known_tags(), TrdRegTimestamps::known_tags(),
MiscFeesGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
Stipulations::known_tags(), SettlInstructionsData::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 = "CollRptID")]
pub fn coll_rpt_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(908))
}
#[doc(alias = "CollInquiryID")]
pub fn coll_inquiry_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(909))
}
#[doc(alias = "CollStatus")]
pub fn coll_status(&self) -> Result<Option<CollStatus>, InvalidValue> {
Ok(self.0.get_int(Tag(910))?.map(CollStatus::from_value))
}
#[doc(alias = "TotNumReports")]
pub fn tot_num_reports(&self) -> Result<Option<i64>, InvalidValue> {
self.0.get_int(Tag(911))
}
#[doc(alias = "LastRptRequested")]
pub fn last_rpt_requested(&self) -> Result<Option<bool>, InvalidValue> {
self.0.get_bool(Tag(912))
}
#[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 = "Account")]
pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(1))
}
#[doc(alias = "AccountType")]
pub fn account_type(&self) -> Result<Option<AccountType>, InvalidValue> {
Ok(self.0.get_int(Tag(581))?.map(AccountType::from_value))
}
#[doc(alias = "ClOrdID")]
pub fn cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(11))
}
#[doc(alias = "OrderID")]
pub fn order_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(37))
}
#[doc(alias = "SecondaryOrderID")]
pub fn secondary_order_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(198))
}
#[doc(alias = "SecondaryClOrdID")]
pub fn secondary_cl_ord_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(526))
}
#[doc(alias = "NoExecs")]
pub fn execs(&self) -> Result<Instances<'_, ExecCollGrp<'_>>, InvalidValue> {
self.0.get_group(&ExecCollGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "NoTrades")]
pub fn trades(&self) -> Result<Instances<'_, TrdCollGrp<'_>>, InvalidValue> {
self.0.get_group(&TrdCollGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
pub fn instrument(&self) -> Instrument<'_> {
Instrument(self.0.scope(), Self::known_tags().get())
}
pub fn financing_details(&self) -> FinancingDetails<'_> {
FinancingDetails(self.0.scope())
}
#[doc(alias = "SettlDate")]
pub fn settl_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(64))
}
#[doc(alias = "Quantity")]
pub fn quantity(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(53))
}
#[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 = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[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 = "NoUnderlyings")]
pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
self.0.get_group(&UndInstrmtGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "MarginExcess")]
pub fn margin_excess(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(899))
}
#[doc(alias = "TotalNetValue")]
pub fn total_net_value(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(900))
}
#[doc(alias = "CashOutstanding")]
pub fn cash_outstanding(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(901))
}
#[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)
}
#[doc(alias = "Side")]
pub fn side(&self) -> Result<Option<Side<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(54))?.map(Side::from_value))
}
#[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)
}
#[doc(alias = "Price")]
pub fn price(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(44))
}
#[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 = "AccruedInterestAmt")]
pub fn accrued_interest_amt(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(159))
}
#[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))
}
pub fn spread_or_benchmark_curve_data(&self) -> SpreadOrBenchmarkCurveData<'_> {
SpreadOrBenchmarkCurveData(self.0.scope())
}
#[doc(alias = "NoStipulations")]
pub fn stipulations(&self) -> Result<Instances<'_, Stipulations<'_>>, InvalidValue> {
self.0.get_group(&Stipulations::TABLE, &Self::known_tags().get()).map(Instances::from)
}
pub fn settl_instructions_data(&self) -> SettlInstructionsData<'_> {
SettlInstructionsData(self.0.scope(), Self::known_tags().get())
}
#[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 = "SettlSessID")]
pub fn settl_sess_id(&self) -> Result<Option<SettlSessID<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(716))?.map(SettlSessID::from_value))
}
#[doc(alias = "SettlSessSubID")]
pub fn settl_sess_sub_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(717))
}
#[doc(alias = "ClearingBusinessDate")]
pub fn clearing_business_date(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(715))
}
#[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 CollateralReport {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "CollateralReport({})", self.0)
}
}
impl std::fmt::Display for CollateralReport {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}