TaggedFlag
Tagged Instruments are used in MarketGrid to distinguish between specific instances of otherwise identical Instruments.
Overview
More correctly, the Tag attribute is used to distinguish one specific Holding from another, whilst still presenting all the Orders for the actual Instrument in a consolidated book.
An example of this is the concept of ProjectId in the Voluntary Carbon market where a specific project is attached to a particular Holding and when a participant places an Order, they place it for a specific project.
In order for the matching algorithm to take these distinguishing attributes into account when matching, the Instruments must have some of the TaggedFlag enum values stored in the Instrument.TaggedFlag attribute. The attribute is implemented as a bitmask of the values in the TaggedFlag enumeration.
Operation
The use of "tagging" has an impact across a number of areas of the system;
Order Validation
The operation of these values when validating an incoming Order is as follows;
- if the Order is off market or it is not a quote then
- if the
Order.Tagis blank and theTaggedFlagvalue of theOrder.Sideis set then- the order is invalid -
Result::OrderTagBlank
- the order is invalid -
- else
- the
Order.Tagvalue is valid
- the
- if the
- else if neither the
<Side>QuoteNoTagnor the<Side>QuoteTagvalues associated with theOrder.Sideare set then- the order is invalid -
Result::OrderTagNoQuote
- the order is invalid -
- else if the
Order.Tagis blank and the<Side>QuoteNoTagvalue associated with theOrder.Sideis not set- the order is invalid -
Result::OrderTagBlankQuote
- the order is invalid -
- else if the
Order.Tagis not blank and the<Side>QuoteTagvalue associated with theOrder.Sideis not set- the order is invalid -
Result::OrderTagNotBlankQuote
- the order is invalid -
- else
- the
Order.Tagvalue is valid
- the
Example
The following is the Instrument.TaggedFlag setting for the Voluntary Carbon market.
Instrument.TaggedFlag=TaggedFlag.Sell|TaggedFlag.BuyQuoteTag|TaggedFlag.BuyQuoteNoTag- hittable Sells that must include a
Tag - indicative Buys, that may include a
Tagif the Buyer wishes
- hittable Sells that must include a
Locating Holdings
Where an Instrument is "tagged" then the Matching Engine will check the Holding.Tag value to ensure that when searching for a specific Tag value that the Holding matches that value.
Matching
The matching algorithm will only match Orders where the Tag values of the otherwise matching Orders are identical.
Metadata
- Underlying type:
u8
Values
| Key | Value | Description |
|---|---|---|
| Buy | 1 | Buy Orders that are off market, or that have a Type that does not include OrderType.Quote, must have a tag |
| Sell | 2 | Sell Orders that are off market, or that have a Type that does not include OrderType.Quote, must have a tag |
| BuyQuoteTag | 4 | Buy Orders with a Type that includes OrderType.Quote are permitted to have a tag |
| SellQuoteTag | 8 | Sell Orders with a Type that includes OrderType.Quote are permitted to have a tag |
| BuyQuoteNoTag | 16 | Buy Orders with a Type that includes OrderType.Quote are permitted to not have a tag |
| SellQuoteNoTag | 32 | Sell Orders with a Type that includes OrderType.Quote are permitted to not have a tag |
| Firm | 128 | Unused |
| Tagged | 3 | Used to detect if a given Instrument is using "tagged" features or not |
Referenced by
Tables
| Table | Field | Description |
|---|---|---|
| Instrument | TaggedFlag |