MarketDataEventArgs

View as Markdown

Definition

Represents a change in level one market data and is passed as a parameter in the OnMarketData() method.

Methods and Parameters

ParameterDescription
AskA double value representing the ask price
BidA double value representing the bid price
InstrumentA Instrument object representing the instrument of the market data
IsResetA bool value representing if a UI reset is needed after a manual disconnect. Note: This is only relevant for columns. Whenever this property is true, the UI needs to be reset.
MarketDataTypePossible values are:
• MarketDataType.Ask
• MarketDataType.Bid
• MarketDataType.DailyHigh
• MarketDataType.DailyLow
• MarketDataType.DailyVolume
• MarketDataType.Last
• MarketDataType.LastClose (prior session close)
• MarketDataType.Opening
• MarketDataType.OpenInterest (supported by IQFeed, Kinetick)
• MarketDataType.Settlement
PriceA double value representing the price
TimeA DateTime structure representing the time
ToString()A string representation of the MarketDataEventArgs object
VolumeA long value representing volume

Critical: If used with TickReplay, please keep in mind Tick Replay ONLY replays the Last market data event, and only stores the best inside bid/ask price at the time of the last trade event. You can think of this as the equivalent of the bid/ask price at the time a trade was reported. Please also see Developing for Tick Replay.

Tips

  • Not all connectivity providers support all MarketDataTypes.
  • For an example of how to use IsReset please see MarketAnalyzerColumns\AskPrice.cs.

Examples

1protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
2{
3 // Print some data to the Output window
4 if (marketDataUpdate.MarketDataType == MarketDataType.Last)
5 Print("Last = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);
6 else if (marketDataUpdate.MarketDataType == MarketDataType.Ask)
7 Print("Ask = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);
8 else if (marketDataUpdate.MarketDataType == MarketDataType.Bid)
9 Print("Bid = " + marketDataUpdate.Price + " " + marketDataUpdate.Volume);
10}