This tutorial explains QuoteTrade, and TimeAndSale events.

QUOTES

A quote in dxFeed represents snapshot of the best (top of book) bid and ask prices, and other fields that change with each quote. It is encapsulated in dxFeed API Quote object. Two most important properties of the quote are bid and ask prices that can be retrieved with the corresponding getBidPrice and getAskPrice methods. Quotes are disseminated by exchanges based on the best active orders in their book for a given market symbol. Bid price is the highest price of the order to buy, and ask price is the lowest price of the order to sell. The size of orders to buy at the highest price and the size of orders to sell at the lowest price can be retrieve with getBidSize and getAskSize methods. dxFeed keeps last known bid and ask prices when market for the corresponding instrument closes, but their sizes are set to zero before the new trading day starts to distinguish fresh quotes on the new trading day from the stale ones on the previous trading day.

All tradable instruments typically have quotes, but indices and indicators typically don’t have them. There are exceptions, though. For example, mutual funds can be traded, but are usually not quoted and provide only their net asset value per share — the price they can be traded at. Some CBOE MDI indices like „SPX“ (Standard & Poors 500) cannot be traded directly (only their derivatives can), but do include bid and ask price computed by CBOE. However, the size of those prices is set zero, because they do not represent real buy and sell orders on the exchange.

A common approach to pricing options and other instruments that don’t trade often, but have active market markers who maintain a small spread between bid and ask price, is to take an average between bid and ask price and use it as a proxy for a true market price of an instrument. This is also known as mid price.

TRADES

A trade happens when an order to buy meets an order to sell at the same price. Information about the last trade is encapsulated in dxFeed API Trade object. Its most important property, the price of the last trade, can be retrieved with getPrice method. The last trade price is often cited as the price for the stock and serves as a basis for an official closing price for stocks. You’d see it on sites likeYahoo Finance and Google Finance. Note, that just like a quote, it is a lasting event in dxFeed API and represents a snapshot of the last known information. It is used to display or to process the most recent data like the finance web-sites above. If the task is to process or to display a table of all trades, TimeAndSale event in dxFeed API shall be used. It provides a continuos stream of all trade-like events that exchange reports together with an original exchange-specific conditions.

The difference between Trade and TimeAndSale is highlighted in a case when trade is busted by exchange. In this case, TimeAndSale reports a separate cancel event that refers to the TimeAndSale event that was canceled. At the same time, Trade event is updated. If the canceled trade was the last trade, then the last trade price reverts to the price of the previous trade.

EXCHANGE CODES

In US markets listed stocks and options trade on multiple exchanges. Quotes and trades that dxFeed provides for the corresponding symbols like „YHOO“ and „GOOG“ represent NBBO (national best bid and offer) and consolidated trade feed, correspondingly. Each exchange has a character codes as explained in „dxFeed Symbol Guide„. This code is available for bid, ask, and last trade prices via getBidExchangeCode, getAskExchangeCode and getExchangeCode methods correspondingly.