#![cfg_attr(rustfmt, rustfmt::skip)]
use refix_message::{
Date, Decimal, Instances, InvalidValue, LazyKnownTags, RawMessage, Tag, UtcTimestamp,
};
use super::super::components::{
FinancingDetails, Header, Instrument, LegQuotGrp, OrderQtyData, Parties, QuotQualGrp,
SpreadOrBenchmarkCurveData, Stipulations, Trailer, UndInstrmtGrp, YieldData,
};
use super::super::enums::{
AccountType, AcctIDSource, CommType, CustOrderCapacity, OrdType, OrderCapacity, PriceType,
QuoteResponseLevel, QuoteType, SettlCurrFxRateCalc, SettlType, Side,
};
pub struct Quote(RawMessage);
impl Quote {
pub const MSG_TYPE: &[u8] = b"S";
pub(in super::super) const fn known_tags() -> &'static LazyKnownTags {
static TAGS: LazyKnownTags = LazyKnownTags::new(
&[
Tag(131), Tag(117), Tag(693), Tag(537), Tag(735), Tag(301), Tag(453), Tag(336),
Tag(625), Tag(711), Tag(54), Tag(63), Tag(64), Tag(193), Tag(192), Tag(15),
Tag(232), Tag(1), Tag(660), Tag(581), Tag(555), Tag(132), Tag(133), Tag(645),
Tag(646), Tag(647), Tag(134), Tag(648), Tag(135), Tag(62), Tag(188), Tag(190),
Tag(189), Tag(191), Tag(631), Tag(632), Tag(633), Tag(634), Tag(60), Tag(40),
Tag(642), Tag(643), Tag(656), Tag(657), Tag(156), Tag(13), Tag(12), Tag(582),
Tag(100), Tag(528), Tag(423), Tag(58), Tag(354), Tag(355),
],
&[
Header::known_tags(), Trailer::known_tags(), QuotQualGrp::known_tags(),
Parties::known_tags(), Instrument::known_tags(), FinancingDetails::known_tags(),
UndInstrmtGrp::known_tags(), OrderQtyData::known_tags(), Stipulations::known_tags(),
LegQuotGrp::known_tags(), SpreadOrBenchmarkCurveData::known_tags(),
YieldData::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 = "QuoteReqID")]
pub fn quote_req_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(131))
}
#[doc(alias = "QuoteID")]
pub fn quote_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(117))
}
#[doc(alias = "QuoteRespID")]
pub fn quote_resp_id(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(693))
}
#[doc(alias = "QuoteType")]
pub fn quote_type(&self) -> Result<Option<QuoteType>, InvalidValue> {
Ok(self.0.get_int(Tag(537))?.map(QuoteType::from_value))
}
#[doc(alias = "NoQuoteQualifiers")]
pub fn quote_qualifiers(&self) -> Result<Instances<'_, QuotQualGrp<'_>>, InvalidValue> {
self.0.get_group(&QuotQualGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "QuoteResponseLevel")]
pub fn quote_response_level(&self) -> Result<Option<QuoteResponseLevel>, InvalidValue> {
Ok(self.0.get_int(Tag(301))?.map(QuoteResponseLevel::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 = "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))
}
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 = "NoUnderlyings")]
pub fn underlyings(&self) -> Result<Instances<'_, UndInstrmtGrp<'_>>, InvalidValue> {
self.0.get_group(&UndInstrmtGrp::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))
}
pub fn order_qty_data(&self) -> OrderQtyData<'_> {
OrderQtyData(self.0.scope())
}
#[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 = "SettlDate2")]
pub fn settl_date2(&self) -> Result<Option<Date>, InvalidValue> {
self.0.get_date(Tag(193))
}
#[doc(alias = "OrderQty2")]
pub fn order_qty2(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(192))
}
#[doc(alias = "Currency")]
pub fn currency(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(15))
}
#[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 = "Account")]
pub fn account(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(1))
}
#[doc(alias = "AcctIDSource")]
pub fn acct_id_source(&self) -> Result<Option<AcctIDSource>, InvalidValue> {
Ok(self.0.get_int(Tag(660))?.map(AcctIDSource::from_value))
}
#[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 = "NoLegs")]
pub fn legs(&self) -> Result<Instances<'_, LegQuotGrp<'_>>, InvalidValue> {
self.0.get_group(&LegQuotGrp::TABLE, &Self::known_tags().get()).map(Instances::from)
}
#[doc(alias = "BidPx")]
pub fn bid_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(132))
}
#[doc(alias = "OfferPx")]
pub fn offer_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(133))
}
#[doc(alias = "MktBidPx")]
pub fn mkt_bid_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(645))
}
#[doc(alias = "MktOfferPx")]
pub fn mkt_offer_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(646))
}
#[doc(alias = "MinBidSize")]
pub fn min_bid_size(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(647))
}
#[doc(alias = "BidSize")]
pub fn bid_size(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(134))
}
#[doc(alias = "MinOfferSize")]
pub fn min_offer_size(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(648))
}
#[doc(alias = "OfferSize")]
pub fn offer_size(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(135))
}
#[doc(alias = "ValidUntilTime")]
pub fn valid_until_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(62))
}
#[doc(alias = "BidSpotRate")]
pub fn bid_spot_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(188))
}
#[doc(alias = "OfferSpotRate")]
pub fn offer_spot_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(190))
}
#[doc(alias = "BidForwardPoints")]
pub fn bid_forward_points(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(189))
}
#[doc(alias = "OfferForwardPoints")]
pub fn offer_forward_points(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(191))
}
#[doc(alias = "MidPx")]
pub fn mid_px(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(631))
}
#[doc(alias = "BidYield")]
pub fn bid_yield(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(632))
}
#[doc(alias = "MidYield")]
pub fn mid_yield(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(633))
}
#[doc(alias = "OfferYield")]
pub fn offer_yield(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(634))
}
#[doc(alias = "TransactTime")]
pub fn transact_time(&self) -> Result<Option<UtcTimestamp>, InvalidValue> {
self.0.get_utc_timestamp(Tag(60))
}
#[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 = "BidForwardPoints2")]
pub fn bid_forward_points2(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(642))
}
#[doc(alias = "OfferForwardPoints2")]
pub fn offer_forward_points2(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(643))
}
#[doc(alias = "SettlCurrBidFxRate")]
pub fn settl_curr_bid_fx_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(656))
}
#[doc(alias = "SettlCurrOfferFxRate")]
pub fn settl_curr_offer_fx_rate(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(657))
}
#[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 = "CommType")]
pub fn comm_type(&self) -> Result<Option<CommType<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(13))?.map(CommType::from_value))
}
#[doc(alias = "Commission")]
pub fn commission(&self) -> Result<Option<Decimal>, InvalidValue> {
self.0.get_decimal(Tag(12))
}
#[doc(alias = "CustOrderCapacity")]
pub fn cust_order_capacity(&self) -> Result<Option<CustOrderCapacity>, InvalidValue> {
Ok(self.0.get_int(Tag(582))?.map(CustOrderCapacity::from_value))
}
#[doc(alias = "ExDestination")]
pub fn ex_destination(&self) -> Result<Option<&str>, InvalidValue> {
self.0.get_str(Tag(100))
}
#[doc(alias = "OrderCapacity")]
pub fn order_capacity(&self) -> Result<Option<OrderCapacity<'_>>, InvalidValue> {
Ok(self.0.get_str(Tag(528))?.map(OrderCapacity::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))
}
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 = "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 Quote {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Quote({})", self.0)
}
}
impl std::fmt::Display for Quote {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(&self.0, f)
}
}