NinjaScript > Language Reference > Data >

MarketDataEventArgs

Print this Topic Previous pageReturn to chapter overviewNext page

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

Methods and Parameters

MarketDataType

Possible values are:

MarketDataType.Ask

MarketDataType.Bid

MarketDataType.DailyHigh

MarketDataType.DailyLow

MarketDataType.DailyVolume

MarketDataType.Last

MarketDataType.LastClose (prior session close)

MarketDataType.Opening

Price

A double value representing the price

Time

A DateTime structure representing the time

ToString()

A string representation of the MarketDataEventArgs object

Volume

A long value representing volume

 

 
Examples

protected override void OnMarketData(MarketDataEventArgs e)
{
    // Print some data to the Output window
    if (e.MarketDataType == MarketDataType.Last)
         Print("Last = " + e.Price + " " + e.Volume);
    else if (e.MarketDataType == MarketDataType.Ask)
         Print("Ask = " + e.Price + " " + e.Volume);
    else if (e.MarketDataType == MarketDataType.Bid)
         Print("Bid = " + e.Price + " " + e.Volume);
}

 
Tips

1.Not all connectivity providers support all MarketDataTypes.