====== Quote Feed ======
The Quote Feed provides real-time market data in two formats: **Market by Price (MBP)** and **Market by Order (MBO)**.
* **Market by Price (MBP)** – Aggregates orders at each price level, showing the **best bid/offer (BBO)** or a **depth of market (DOM)** view, typically up to 10 levels.
* **Market by Order (MBO)** – Provides a full order book, showing each **individual order** at its exact price level.
The available depth and data type depend on the **subscription request** and the **user’s market data setup**.
===== Market by Price (MBP) =====
MBP provides an **aggregated** view of the market. It groups orders at each price level, showing either:
* **Top of Book (BBO)** – The best bid and offer.
* **Depth of Market (DOM)** – Typically the **10 best bid/offer levels**.
==== MBP Subscripotion ====
A MBP subscription is configured with DepthBuffer and DepthLevel options.
=== DepthBuffer ===
^ **Value** ^ **Description** ^
| NoSubscription | Used to unsubscribe the market quote feed. |
| Slow | A buffered feed that provides a reduced rate of updates. |
| SlowTrade | Same as Slow, but will deliver every trade. |
| Smart | A minimally buffered feed that is guaranteed to provide every change to best bid/offer. |
| SmartTrade | Same as Smart, but will deliver every trade. |
***Smart*** is typically what a trading client front end would use.
The "Trade" buffers are needed when displaying a trade ticker or Time and Sales display, or updating a chart.
=== Depth Levels ===
^ **Value** ^ **Description** ^
| Undefined | Used during unsubscription. |
| BestOnly | Only the best bid and offer will be provided. (Also called Top of Book, TOB.) |
| Normal | The full depth (as provided by the exchange) will be provided (typically top 10 bids and offers.) |
==== MBP Subscription Example ====
To receive MBP data, clients send a **MarketDepthSubscribe** message.
MarketDepthSubscribe {
ExchangeId = "CME",
ContractId = "ESM25",
MarketId = "XCME_C ES (M25)",
Buffer = DepthBuffer.Smart,
DepthLevels = DepthLevels.Normal
}
==== Unsubscribing ====
To stop receiving MBP data, clients send a **MarketDepthSubscribe** message.
MarketDepthSubscribe {
ExchangeId = "CME",
ContractId = "ESM25",
MarketId = "XCME_C ES (M25)",
Buffer = DepthBuffer.NoSubscription,
DepthLevels = DepthLevels.Undefined
}
==== MBP Message Handling ====
After subscribing, the following messages are received:
* **MarketDefinition** – Sent once per market, unless already received via another feed.
* **MarketSnapshot** – Provides a full market state on initial subscription.
* **MarketDepth** – Sends incremental changes to depth.
Example MBP message handling:
private void HandleMarketMessage(ServerMessage serverMessage)
{
switch (serverMessage.PayloadCase)
{
case ServerMessage.PayloadOneofCase.MarketDefinition:
ProcessMarketDefinition(serverMessage.MarketDefinition);
break;
case ServerMessage.PayloadOneofCase.MarketSnapshot:
ProcessMarketSnapshot(serverMessage.MarketSnapshot);
break;
case ServerMessage.PayloadOneofCase.MarketDepth:
ProcessMarketDepth(serverMessage.MarketDepth);
break;
default:
_logger.LogWarning("Unhandled Market Message: {PayloadCase}", serverMessage.PayloadCase);
break;
}
}
===== Market by Order (MBO) =====
MBO provides a **detailed view** of the market by reporting **every individual order** in the book. Unlike MBP, which aggregates orders at price levels, MBO allows clients to track order-level movements. MBO also allows clients to determine their **position in queue** in the market.
MBO data includes:
* **MarketByOrderSnapshot** – Full snapshot of the current order book state.
* **MarketByOrderUpdate** – Incremental updates to the order book.
==== MBO Subscription Example ====
To receive MBO data, clients send a **MarketByOrderSubscribe** message.
MarketByOrderSubscribe {
exchange_id = "CME",
contract_id = "ESM25",
market_id = "XCME_C ES (M25)",
subscribe = true
}
==== Unsubscribing ====
To stop receiving MBO data, clients send a **MarketByOrderSubscribe** message.
MarketByOrderSubscribe {
exchange_id = "CME",
contract_id = "ESM25",
market_id = "XCME_C ES (M25)",
subscribe = false
}
==== MBO Message Handling ====
After subscribing, the following messages are received:
* **MarketDefinition** – Sent once per market, unless already received.
* **MarketSnapshot** – A full order book snapshot.
* **MarketOrderUpdate** – Incremental order updates.
Example MBO message handling:
private void HandleMBOMessage(ServerMessage serverMessage)
{
switch (serverMessage.PayloadCase)
{
case ServerMessage.PayloadOneofCase.MarketByOrderSubscribeReject:
ProcessMarketByOrderSubscribeReject(serverMessage.MarketByOrderSubscribeReject);
break;
case ServerMessage.PayloadOneofCase.MarketDefinition:
ProcessMarketDefinition(serverMessage.MarketDefinition);
break;
case ServerMessage.PayloadOneofCase.MarketSnapshot:
ProcessMarketSnapshot(serverMessage.MarketSnapshot);
break;
case ServerMessage.PayloadOneofCase.MarketOrderUpdate:
ProcessMarketOrderUpdate(serverMessage.MarketOrderUpdate);
break;
default:
_logger.LogWarning("Unhandled MBO Message: {PayloadCase}", serverMessage.PayloadCase);
break;
}
}
===== Delayed vs. Non-Delayed Data =====
Clients may receive **delayed market data** if:
* They have an expired simulator account.
* Their market data setup only permits delayed data.
A **flag on the messages** indicates whether the data is delayed. Clients should check this flag before displaying market data.
^ **Field** ^ **Description** ^
| Delayed | `true` if the market data is delayed, `false` if real-time. |
If delayed data is received, clients should notify users that the feed is not real-time.
T4 does not support delayed MBO data at this time.
===== Secondary Market Data =====
In addition to quotes, a market data feed subscription will include secondary market data:
^ **Message** ^ **Description** ^
| MarketDepthTrade | If a `Trade` feed is subscribed, the trade ticker is sent as a feed of MarketDepthTrade messages. |
| MarketHighLow | Publishes updates to the high and low prices reached by the market. |
| MarketPriceLimits | Publishes the price limits (bands or collars) set by the exchange for the market. |
| MarketSettlement | Contains the latest market settlement, held settlment, open interest, cleared volume and VWAP information as published by the exchange. |