Files
externals/linux/include/OnixS/CME/MDP3/SecurityDefinition.h
T
2017-08-09 14:33:06 +00:00

1262 lines
44 KiB
C++
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
//
// This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
// and international copyright treaties.
//
// Access to and use of the software is governed by the terms of the applicable OnixS Software
// Services Agreement (the Agreement) and Customer end user license agreements granting
// a non-assignable, non-transferable and non-exclusive license to use the software
// for it's own data processing purposes under the terms defined in the Agreement.
//
// Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
// of this source code or associated reference material to any other location for further reproduction
// or redistribution, and any amendments to this copyright notice, are expressly prohibited.
//
// Any reproduction or redistribution for sale or hiring of the Software not in accordance with
// the terms of the Agreement is a violation of copyright law.
//
#pragma once
#include "OnixS/CME/MDP3/Types.h"
#include "OnixS/CME/MDP3/Tags.h"
#include "OnixS/CME/MDP3/Messaging.h"
#include "OnixS/CME/MDP3/EventIndicator.h"
#include "OnixS/CME/MDP3/SettlementPriceType.h"
#include "OnixS/CME/MDP3/SecurityStatus.h"
namespace OnixS
{
namespace CME
{
namespace MDP3
{
/// Security update actions.
struct
ONIXS_CME_MDP3_API
SecurityUpdateActions
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Represents Security Definition messages that are :
/// - Newly added during the current week;
/// - Disseminated during the Sunday Startup period;
/// - Resent by the system during the week.
Add = 'A',
/// Represents deletions of a Security Definition.
Delete = 'D',
/// Represents modifications to a Security Definition.
Modify = 'M'
};
};
typedef
SecurityUpdateActions::Enum
SecurityUpdateAction;
/// Indicates the product complex.
struct
ONIXS_CME_MDP3_API
UnderlyingProducts
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Commodity/Agriculture.
CommodityOrAgriculture= 2,
/// Currency.
Currency = 4,
/// Equity.
Equity = 5,
/// Other.
Other = 12,
/// Interest rate.
InterestRate = 14,
/// FX cash.
FxCash = 15,
/// Energy.
Energy = 16,
/// Metals.
Metals = 17
};
};
/// Indicates the product complex.
typedef
UnderlyingProducts::Enum
UnderlyingProduct;
/// Matching Algorithms.
struct
ONIXS_CME_MDP3_API
MatchAlgorithms
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// FIFO.
Fifo = 'F',
/// Split FIFO or Pro-Rata.
SplitFifoOrProRata = 'K',
/// Pro-Rata.
ProRata = 'C',
/// Allocation.
Allocation = 'A',
/// FIFO with LMM.
FifoWithLmm = 'T',
/// Threshold Pro-Rata.
ThresholdProRata = 'O',
/// FIFO with top and LMM.
FifoWithTopAndLmm = 'S',
/// Threshold Pro-Rata with LMM.
ThresholdProRataWithLmm = 'Q',
/// Euro/Dollar options.
EuroDollarOptions = 'Y'
};
};
typedef
MatchAlgorithms::Enum
MatchAlgorithm;
/// Indicates the type of multiplier being applied to the product.
struct
ONIXS_CME_MDP3_API
ContractMultiplierUnits
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Multiplied by hour.
MultipliedByHour = 1,
/// Multiplied by day.
MultipliedByDay = 2
};
};
typedef
ContractMultiplierUnits::Enum
ContractMultiplierUnit;
/// The schedule according to which the electricity is delivered
/// in a physical contract, or priced in a financial contract.
struct
ONIXS_CME_MDP3_API
FlowScheduleTypes
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// NERC Eastern Off-Peak.
EasternOffPeak = 0,
/// NERC Western Off-Peak.
WesternOffPeak = 1,
/// Calendar-All Days in month.
Calendar = 2,
/// NERC Eastern Peak.
EasternPeak = 3,
/// NERC Western Peak.
WesternPeak = 4
};
};
typedef
FlowScheduleTypes::Enum
FlowScheduleType;
/// Leg sides (buy or sell).
struct
ONIXS_CME_MDP3_API
LegSides
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Buy side.
Buy = 1,
/// Sell side.
Sell = 2
};
};
typedef
LegSides::Enum
LegSide;
struct
ONIXS_CME_MDP3_API
EventTypes
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Activation.
Activation = 5,
/// Last eligible trade date.
LastEligibleTradeDate = 7
};
};
typedef
EventTypes::Enum
EventType;
/// Available instrument attribute types.
struct ONIXS_CME_MDP3_API InstrumentAttributeTypes
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Instrument eligibility.
Eligibility = 24
};
};
typedef
InstrumentAttributeTypes::Enum
InstrumentAttributeType;
/// Available lot types.
struct
ONIXS_CME_MDP3_API
LotTypes
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Minimum order entry quantity for an instrument.
MinimumOrderEntryQtyForAnInstrument = 2,
/// The minimum qty required for a block trade.
MinimumQtyRequiredForBlockTrade = 3,
/// The round lot for Variable Quantity Products.
RoundLot = 4
};
};
typedef
LotTypes::Enum
LotType;
/// Available option types.
struct
ONIXS_CME_MDP3_API
OptionTypes
{
enum Enum
{
/// Used to identify absence of value.
Undefined = -1,
/// Put option.
Put = 0,
/// Call option.
Call = 1
};
};
typedef
OptionTypes::Enum
OptionType;
inline
bool
getYearMonth(
const FieldSet& fieldSet,
Tag tag,
YearMonth& yearMonth)
{
const FieldValueRef valueRef = fieldSet.get(tag);
StringRef yearMonthStr;
if(valueRef && valueRef.toStringRef(yearMonthStr))
{
yearMonth = YearMonth::deserialize(yearMonthStr);
return true;
}
return false;
}
/// Events of a security definition.
class
ONIXS_CME_MDP3_API
Event : public GroupInstance
{
public:
/// Cleans up underlying resources.
~Event()
{
}
/// Code to represent the type of event.
EventType type() const
{
return getIntEnumFieldValue<EventTypes>(*this, Tags::EventType);
}
/// Time of event.
Timestamp time() const
{
return getTimestamp(Tags::EventTime, SinceEpochUnits::Nanoseconds);
}
private:
friend class TypedGroup<Event>;
Event(const GroupInstance& entry)
: GroupInstance(entry)
{
}
};
/// Security events group.
class ONIXS_CME_MDP3_API Events : public TypedGroup<Event>
{
private:
Events (const Group& group)
: TypedGroup<Event> (group)
{
}
friend class SecurityDefinition;
};
/// Feed types of a security definition.
class
ONIXS_CME_MDP3_API
MarketDataFeedType: public GroupInstance
{
public:
/// Cleans up underlying resources.
~MarketDataFeedType()
{}
/// Describes a class of service for a given data feed.
/// GBX- Real Book, GBI-Implied Book.
StringRef type() const
{
return getStringRef(Tags::MDFeedType);
}
/// Book depth.
Int32 marketDepth() const
{
return getInt32(Tags::MarketDepth);
}
private:
friend class TypedGroup<MarketDataFeedType>;
MarketDataFeedType(const GroupInstance& entry)
: GroupInstance(entry)
{}
};
/// Security feed types.
class ONIXS_CME_MDP3_API MarketDataFeedTypes:
public TypedGroup<MarketDataFeedType>
{
private:
MarketDataFeedTypes(const Group& group)
: TypedGroup<MarketDataFeedType>(group)
{}
friend class SecurityDefinition;
};
/// Strategy leg attributes.
class ONIXS_CME_MDP3_API Leg : public GroupInstance
{
public:
/// Cleans up underlying resources.
~Leg()
{
}
/// Unique instrument ID for the leg.
SecurityId securityId() const
{
return getInt32(Tags::LegSecurityID);
}
/// Identifies class or source of the leg security ID (Tag 602) value.
/// This tag is always '8' for CME.
StringRef securityIdSource() const
{
return getStringRef(Tags::LegSecurityIDSource);
}
/// The side of the leg for this repeating group.
LegSide side() const
{
return getIntEnumFieldValue<LegSides>(*this, Tags::LegSide);
}
/// The ratio of quantity for this individual leg
/// relative to the entire multi-leg instrument.
Quantity ratioQty() const
{
return getUInt32(Tags::LegRatioQty);
}
/// Price for a futures leg of a covered.
bool price(Price& price) const
{
return get(Tags::LegPrice).toNumber(price);
}
/// Delta used to calculate the quantity of futures
/// used to cover the option or option strategy.
bool optionDelta(FloatQuantity& qty) const
{
return get(Tags::LegOptionDelta).toNumber(qty);
}
private:
friend class TypedGroup<Leg>;
Leg(const GroupInstance& entry)
: GroupInstance(entry)
{
}
};
/// Strategy legs group.
class ONIXS_CME_MDP3_API Legs : public TypedGroup<Leg>
{
private:
Legs (const Group& group)
: TypedGroup<Leg> (group)
{
}
friend class SecurityDefinition;
};
/// Underlying security attributes.
class ONIXS_CME_MDP3_API Underlying : public GroupInstance
{
public:
/// Cleans up underlying resources.
~Underlying()
{
}
/// Unique instrument ID as qualified by the exchange.
SecurityId securityId() const
{
return getUInt32(Tags::UnderlyingSecurityID);
}
/// Identifies class or source of the underlying security ID (Tag 309) value.
/// This tag is always '8' for CME.
StringRef securityIdSource() const
{
return getStringRef(Tags::UnderlyingSecurityIDSource);
}
/// Underlying Instrument Name or Symbol.
/// This value will be the same as that contained in Leg Instrument’s
/// Security Definition Tag 55-Symbol.
StringRef symbol() const
{
StringRef val;
return get(Tags::UnderlyingSymbol).toStringRef(val) ? val : StringRef();
}
private:
friend class TypedGroup<Underlying>;
Underlying(
const GroupInstance& entry)
: GroupInstance(entry)
{
}
};
/// Underlying securities group.
class ONIXS_CME_MDP3_API Underlyings : public TypedGroup<Underlying>
{
private:
Underlyings (const Group& group)
: TypedGroup<Underlying> (group)
{
}
friend class SecurityDefinition;
};
ONIXS_CME_MDP3_API_DECL(class, InstrumentAttribute);
/// Security eligibility bitmap field.
class ONIXS_CME_MDP3_API Eligibility: BitmapField
{
public:
/// Initializes from instrument attribute containing Tag 871-InstAttribType
/// equal to Eligibility and Tag 872-InstAttribValue.
/// @note Attribute type is checked to be equal to Eligibility.
/// If it's different or missing empty instance is created.
Eligibility(const InstrumentAttribute* attr = NULL);
/// Initializes from instrument attribute containing Tag 872-InstAttribValue.
/// @note No actual checking for attribute type is done.
Eligibility(const InstrumentAttribute& attr);
/// Checks whether given attribute is valid and contains Eligibility value.
static bool validAttribute(const InstrumentAttribute& attr);
/// Indicates product is Electronic Match Eligible.
bool isElectronicMatch() const
{
return state(Bits::ElectronicMatch);
}
/// Indicates product is Order Cross Eligible.
bool isOrderCross() const
{
return state(Bits::OrderCross);
}
/// Indicates product is Block Trade Eligible.
bool isBlockTrade() const
{
return state(Bits::BlockTrade);
}
/// Indicates product is EFP Eligible.
bool isEFP() const
{
return state(Bits::EFP);
}
/// Indicates product is EBF Eligible.
bool isEBF() const
{
return state(Bits::EBF);
}
/// Indicates product is EFS Eligible.
bool isEFS() const
{
return state(Bits::EFS);
}
/// Indicates product is EFR Eligible.
bool isEFR() const
{
return state(Bits::EFR);
}
/// Indicates product is OTC Eligible.
bool isOTC() const
{
return state(Bits::OTC);
}
/// Indicates product is iLink Indicative Mass Quoting Eligible.
bool isILinkIndicativeMassQuoting() const
{
return state(Bits::ILinkIndicativeMassQuoting);
}
/// Indicates product is Negative Strike Eligible.
bool isNegativeStrike() const
{
return state(Bits::NegativeStrike);
}
/// Indicates product is Negative Price Outright Eligible.
bool isNegativePriceOutright() const
{
return state(Bits::NegativePriceOutright);
}
/// Indicates product has fractional display price.
bool isFractional() const
{
return state(Bits::IsFractional);
}
/// Indicates product is RFQ Cross Eligible.
bool isRFQCross() const
{
return state(Bits::RFQCross);
}
/// Indicates product is Zero Price Outright Eligible.
bool isZeroPriceOutright() const
{
return state(Bits::ZeroPriceOutright);
}
/// Indicates Decaying Product Eligibility.
bool isDecayingProduct() const
{
return state(Bits::DecayingProduct);
}
/// Indicates Variable Product Eligibility.
bool isVariableProduct() const
{
return state(Bits::VariableProduct);
}
/// Indicates Daily Product Eligibility.
bool isDailyProduct() const
{
return state(Bits::DailyProduct);
}
/// Indicates GT Orders Eligibility (Previously Tag 827).
bool isGTOrders() const
{
return state(Bits::GTOrders);
}
/// Indicates Implied Matching Eligibility (Previously tag 1144).
bool isImpliedMatching() const
{
return state(Bits::ImpliedMatching);
}
private:
struct Bits
{
enum Enum
{
ElectronicMatch = 0,
OrderCross = 1,
BlockTrade = 2,
EFP = 3,
EBF = 4,
EFS = 5,
EFR = 6,
OTC = 7,
ILinkIndicativeMassQuoting = 8,
NegativeStrike = 9,
NegativePriceOutright = 10,
IsFractional = 11,
// Bit 12 is currently not used (was VolatilityQuotedOption).
RFQCross = 13,
ZeroPriceOutright = 14,
DecayingProduct = 15,
VariableProduct = 16,
DailyProduct = 17,
GTOrders = 18,
ImpliedMatching = 19
// Bits 20-32 are reserved.
};
};
};
/// Instrument attribute.
class ONIXS_CME_MDP3_API InstrumentAttribute : public GroupInstance
{
public:
/// Cleans up underlying resources.
~InstrumentAttribute()
{
}
/// Indicates the type of value that the value() returns.
InstrumentAttributeType type() const
{
return getIntEnumFieldValue<InstrumentAttributeTypes>(
*this, Tags::InstrAttribType);
}
/// Attribute value appropriate to the type field.
Eligibility value() const
{
return Eligibility(this);
}
private:
friend class TypedGroup<InstrumentAttribute>;
InstrumentAttribute(
const GroupInstance& entry)
: GroupInstance(entry)
{
}
};
inline Eligibility::Eligibility(const InstrumentAttribute& attr)
: BitmapField(attr.getUInt32(Tags::InstrAttribValue))
{}
inline Eligibility::Eligibility(const InstrumentAttribute* attr)
: BitmapField(attr && validAttribute(*attr) ?
attr->getUInt32(Tags::InstrAttribValue) : 0)
{}
inline bool Eligibility::validAttribute(const InstrumentAttribute& attr)
{
return attr.type() == InstrumentAttributeTypes::Eligibility;
}
/// Instrument Attributes group.
class ONIXS_CME_MDP3_API InstrumentAttributes : public TypedGroup<InstrumentAttribute>
{
private:
InstrumentAttributes (const Group& group)
: TypedGroup<InstrumentAttribute> (group)
{
}
friend class SecurityDefinition;
};
/// Lot type rule.
struct ONIXS_CME_MDP3_API LotTypeRule : public GroupInstance
{
public:
/// Cleans up underlying resources.
~LotTypeRule()
{
}
/// The quantity type used for the leg of the spread.
LotType type() const
{
return getIntEnumFieldValue<LotTypes>(*this, Tags::LotType);
}
/// Minimum quantity accepted for order entry.
/// If LotType is this value is the minimum quantity
/// for order entry expressed in the applicable units,
/// specified in tag 996-UnitOfMeasure, (e.g., megawatts).
bool minLotSize(FloatQuantity& size) const
{
return get(Tags::MinLotSize).toNumber(size);
}
private:
friend class TypedGroup<LotTypeRule>;
LotTypeRule(
const GroupInstance& entry)
: GroupInstance(entry)
{
}
};
/// Lot type rules group.
class ONIXS_CME_MDP3_API LotTypeRules : public TypedGroup<LotTypeRule>
{
private:
LotTypeRules (const Group& group)
: TypedGroup<LotTypeRule> (group)
{
}
friend class SecurityDefinition;
};
/// Security Definition.
class ONIXS_CME_MDP3_API SecurityDefinition
{
public:
/// Initializes instance from given FIX message.
SecurityDefinition(const Message&);
/// Market data events present in the message containing given instance.
EventIndicator eventIndicator() const
{
return EventIndicator(message_);
}
/// Total number of instruments in the Replay loop.Used on Replay Feed only.
bool totNumReports(UInt32& value) const
{
return message_.get(Tags::TotNumReports).toNumber(value);
}
/// Action related to the current security definition instance.
SecurityUpdateAction securityUpdateAction() const
{
return getCharEnumFieldValue<SecurityUpdateActions>(
message_, Tags::SecurityUpdateAction);
}
/// Events entries.
Events events() const
{
return Events(message_.getGroup(Tags::NoEvents));
}
/// Timestamp of when the instrument was last added, modified or deleted.
Timestamp lastUpdateTime() const
{
return message_.getTimestamp(Tags::LastUpdateTime,
SinceEpochUnits::Nanoseconds);
}
/// Security type.
StringRef securityType() const
{
return message_.getStringRef(Tags::SecurityType);
}
/// VTT code. Provided for instruments with variable tick in addition to Tick
/// Size in tag 969 MinPriceIncrement. For VTT ineligible instruments, this field
/// will be sent as null.
bool tickRule(UInt32& value) const
{
return message_.get(Tags::TickRule).toNumber(value);
}
/// Price Denominator of Main Fraction.
bool mainFraction(UInt32& value) const
{
return message_.get(Tags::MainFraction).toNumber(value);
}
/// Price Denominator of Sub Fraction.
bool subFraction(UInt32& value) const
{
return message_.get(Tags::SubFraction).toNumber(value);
}
/// Number of Decimals in Displayed Price.
bool priceDisplayFormat(UInt32& value) const
{
return message_.get(Tags::PriceDisplayFormat).toNumber(value);
}
/// Bitmap field of eight Boolean type indicators
/// representing settlement price type.
SettlementPriceType settlPriceType() const
{
return SettlementPriceType(message_);
}
/// Identifies the market segment. Populated for all CME Globex instruments.
bool marketSegmentId(MarketSegmentId& id) const
{
return message_.get(Tags::MarketSegmentID).toNumber(id);
}
/// Reference price for prelisted instruments or the last calculated
/// Settlement, which can be Theoretical, Preliminary or
/// a Final Settlement of the session.
bool tradingReferencePrice(Price& price) const
{
return message_.get(Tags::TradingReferencePrice).toNumber(price);
}
/// Upper price threshold for the instrument.
/// Orders submitted with prices above the
/// upper limit will be rejected.
bool highLimitPrice(Price& price) const
{
return message_.get(Tags::HighLimitPrice).toNumber(price);
}
/// Lower price threshold for the instrument.
/// Orders submitted with prices below the lower
/// limit will be rejected.
bool lowLimitPrice(Price& price) const
{
return message_.get(Tags::LowLimitPrice).toNumber(price);
}
/// An exchange specific code assigned to a group of related securities,
/// which are concurrently affected by market events.
StringRef securityGroup() const
{
return message_.getStringRef(Tags::SecurityGroup);
}
/// Instrument Name or Symbol. e.g. ‘6EN2 P1220’, 6AZ4
StringRef symbol() const
{
return message_.getStringRef(Tags::Symbol);
}
/// String field that indicates the underlying asset code (Product Code).
/// Example: GE (Eurodollars), ES (E-Minis).
StringRef asset() const
{
return message_.getStringRef(Tags::Asset);
}
/// Unique instrument id (FIX tag 48) as qualified
/// by the exchange per tag 22-SecurityIDSource.
/// Returns 'false' if no data (FIX tag) available
/// in underlying security definition message.
SecurityId securityId() const
{
return message_.getUInt32(Tags::SecurityID);
}
/// Identifies class or source of the security ID (Tag 48) value.
/// This tag is always '8' for CME.
StringRef securityIdSource() const
{
return message_.getStringRef(Tags::SecurityIDSource);
}
/// Indicates the type of security using ISO 10962 standard,
/// Classification of Financial Instruments (CFI code) values.
/// ISO 10962 is maintained by ANNA (association of National
/// Numbering Agencies) acting as registration Authority.
StringRef CFICode() const
{
return message_.getStringRef(Tags::CFICode);
}
/// Indicates the option type (Put or Call).
OptionType putOrCall() const
{
return getIntEnumFieldValue<OptionTypes>(message_, Tags::PutOrCall);
}
/// Indicates the product complex.
UnderlyingProduct underlyingProduct() const
{
return getIntEnumFieldValue<UnderlyingProducts>(
message_, Tags::UnderlyingProduct);
}
/// Exchange used to identify a security.
StringRef securityExchange() const
{
return message_.getStringRef(Tags::SecurityExchange);
}
/// Accesses to security trading status if available.
SecurityTradingStatus tradingStatus() const
{
return getIntEnumFieldValue<SecurityTradingStatuses>(
message_, Tags::MDSecurityTradingStatus);
}
/// The channel ID as defined in the XML Configuration file.
Int32 applId() const
{
return message_.getInt32(Tags::ApplID);
}
/// Defines cabinet price for outright options products.
bool minCabPrice(Price& price) const
{
return message_.get(Tags::MinCabPrice).toNumber(price);
}
/// This field contains the contract size for each instrument.
bool unitOfMeasureQty(FloatQuantity& qty) const
{
return message_.get(Tags::UnitOfMeasureQty).toNumber(qty);
}
/// Strike Price for an option.
bool strikePrice(Price& price) const
{
return message_.get(Tags::StrikePrice).toNumber(price);
}
/// Currency in which the StrikePrice is denominated.
StringRef strikeCurrency() const
{
StringRef val;
return message_.get(Tags::StrikeCurrency).toStringRef(val) ? val : StringRef();
}
/// The minimum trading volume for a security.
bool minTradeVol(Quantity& volume) const
{
return message_.get(Tags::MinTradeVol).toNumber(volume);
}
/// The maximum trading volume for a security.
bool maxTradeVol(Quantity& volume) const
{
return message_.get(Tags::MaxTradeVol).toNumber(volume);
}
/// Identifies currency used for price.
/// Absence of this field is interpreted as the default
/// for the security. It is recommended that systems
/// provide the currency value whenever possible.
StringRef currency() const
{
return message_.getStringRef(Tags::Currency);
}
/// Identifies currency used for settlement price.
StringRef settlCurrency() const
{
StringRef val;
return message_.get(Tags::SettlCurrency).toStringRef(val) ? val : StringRef();
}
/// Retrieves depth values for direct and implied book.
/// @note Assigns zero in case of book depth value absence.
void bookDepths(MarketDepth& direct, MarketDepth& implied) const;
/// Matching Algorithm - CME assigned values.
MatchAlgorithm matchAlgorithm() const
{
return getCharEnumFieldValue<MatchAlgorithms>(message_, Tags::MatchAlgorithm);
}
/// Strategy type.
StringRef securitySubType() const
{
StringRef val;
return message_.get(Tags::SecuritySubType).toStringRef(val)
? val : StringRef();
}
/// Underlying legs that make up the security.
Underlyings underlyings() const
{
return Underlyings(message_.getOptionalGroup(Tags::NoUnderlyings));
}
/// Differential value for price banding.
bool maxPriceVariation(Price& price) const
{
return message_.get(Tags::MaxPriceVariation).toNumber(price);
}
/// Collection of instrument attributes.
InstrumentAttributes instrumentAttributes() const
{
return InstrumentAttributes(message_.getGroup(Tags::NoInstrAttrib));
}
/// Security eligibility bitmap contained in Instrument Attributes, Type=24.
/// @note This function returns data from the first found Instrument
/// Attributes group instance of Type=24.
Eligibility eligibility() const
{
const InstrumentAttributes& attrs = instrumentAttributes();
for(size_t i = 0; i < attrs.size(); ++i)
{
if(Eligibility::validAttribute(attrs[i]))
{
return Eligibility(attrs[i]);
}
}
return Eligibility();
}
/// This field provides the actual calendar date for contract maturity -
/// month and year (used for standardized futures and options) - fmt YYYYMM.
/// For futures spreads and options spreads, this field contains
/// the first leg maturity (YYYYMMDD).
/// For packs and bundles, this value represents the rollover date (YYYYMMDD).
/// For daily products, this tag contains the daily maturity (YYYYMMDD).
/// For weekly options products, this tag contains the weekly maturity (YYYYMMWW)
/// denoted 1, 2, 3, 4, or 5.
bool maturityMonthYear(YearMonth& yearMonth) const
{
return getYearMonth(message_, Tags::MaturityMonthYear, yearMonth);
}
/// Minimum constant tick for the instrument,
/// sent only if instrument is non-VTT (Variable
/// Tick Table) eligible.
bool minPriceIncrement(Price& increment) const
{
return message_.get(Tags::MinPriceIncrement).toNumber(increment);
}
/// Minimum price increment amount associated with the MinPriceIncrement (969).
bool minPriceIncrementAmount(Amount& increment) const
{
return message_.get(Tags::MinPriceIncrementAmount).toNumber(increment);
}
/// Contains the multiplier to convert the CME
/// Globex display price to the conventional price.
bool displayFactor(PriceFactor& factor) const
{
return message_.get(Tags::DisplayFactor).toNumber(factor);
}
/// Collection of legs.
Legs legs() const
{
return Legs(message_.getOptionalGroup(Tags::NoLegs));
}
/// Collection of feed types.
MarketDataFeedTypes feedTypes() const
{
return MarketDataFeedTypes(message_.getGroup(Tags::NoMdFeedTypes));
}
/// Identifies user-defined instruments.
bool userDefinedInstrument() const
{
return message_.hasFlag(Tags::UserDefinedInstrument);
}
/// Used for price calculation in spread and leg pricing.
bool priceRatio(PriceFactor& ratio) const
{
return message_.get(Tags::PriceRatio).toNumber(ratio);
}
/// Indicates the type of multiplier being applied to the product.
/// Optionally used in combination with tag 231-ContractMultiplier.
ContractMultiplierUnit contractMultiplierUnit() const
{
return getIntEnumFieldValue<ContractMultiplierUnits>(
message_, Tags::ContractMultiplierUnit);
}
/// The schedule according to which the electricity is delivered
/// in a physical contract, or priced in a financial contract.
/// Specifies whether the contract is defined according to the
/// Easter Peak, Eastern Off-Peak, Western Peak or Western Off-Peak.
FlowScheduleType flowScheduleType() const
{
return getIntEnumFieldValue<FlowScheduleTypes>(
message_, Tags::FlowScheduleType);
}
/// Number of deliverable units per instrument, e.g., peak days
/// in maturity month or number of calendar days in maturity month.
/// Security Definition for the variable quantity spread will be
/// populated with the value '0' for ContractMultiplier.
/// Security Definition is populated with values for the outright
/// legs for ContractMultiplier and customers must extract this value.
bool contractMultiplier(SignedQuantity& multiplier) const
{
return message_.get(Tags::ContractMultiplier).toNumber(multiplier);
}
/// Unit of measure for the products' original contract size.
/// This will be populated for all products listed on CME Globex.
StringRef unitOfMeasure() const
{
StringRef val;
return message_.get(Tags::UnitOfMeasure).toStringRef(val) ? val : StringRef();
}
/// Indicates the quantity that a contract will decay daily by once
/// the decay start date is reached.
bool decayQty(SignedQuantity& decayBy) const
{
return message_.get(Tags::DecayQty).toNumber(decayBy);
}
/// Indicates the date at which a decay contract will begin to decay.
bool decayStartDate(Timestamp& date) const
{
return getDate(message_, Tags::DecayStartDate, date);
}
/// Fixed contract value assigned to a product.
bool originalContractSize(SignedQuantity& size) const
{
return message_.get(Tags::OriginalContractSize).toNumber(size);
}
/// Indicates the total cleared volume of instruments
/// traded during the prior trading session.
bool clearedVolume(SignedQuantity& volume) const
{
return message_.get(Tags::ClearedVolume).toNumber(volume);
}
/// Indicates the total open interest for the market
/// at the close of the prior trading session.
bool openInterestQty(SignedQuantity& qty) const
{
return message_.get(Tags::OpenInterestQty).toNumber(qty);
}
/// Quantity types.
LotTypeRules lotTypeRules() const
{
return LotTypeRules(message_.getGroup(Tags::NoLotTypeRules));
}
/// Trading reference date.
bool tradingReferenceDate(Timestamp& date) const
{
return getDate(message_, Tags::TradingReferenceDate, date);
}
/// The source FIX Security Definition (35=d) message.
const Message& message() const
{
return message_;
}
/// Returns string representation of an object.
std::string toString() const
{
std::string str;
toString(str);
return str;
}
/// Appends string representation of an object.
void toString(std::string&) const;
private:
Message message_;
};
}
}
}