Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Understanding MarketDataEventArgs.Time in RealTime

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Understanding MarketDataEventArgs.Time in RealTime

    Hello!

    What is the MarketDataEventArgs.Time representing for Ask, Bid, and Last MarketDataTypes? Is it when the data was received by the exchange?

    The reason I ask is that upon printing the times of the Ask, Bid, and Last events on live data, I observed that the timestamps are not chronological. Here is an example from today on NQ:
    Ask: 2023-10-05 10:18:40:69
    Bid: 2023-10-05 10:18:40:69
    Ask: 2023-10-05 10:18:40:72
    Bid: 2023-10-05 10:18:40:72
    Ask: 2023-10-05 10:18:40:75
    Bid: 2023-10-05 10:18:40:75
    Ask: 2023-10-05 10:18:40:69
    Bid: 2023-10-05 10:18:40:69
    Last: 2023-10-05 10:18:40:69
    Ask: 2023-10-05 10:18:40:70
    Bid: 2023-10-05 10:18:40:70
    Last: 2023-10-05 10:18:40:70
    Last: 2023-10-05 10:18:40:70
    Ask: 2023-10-05 10:18:40:71​​
    Here is the code used to print these events:
    protected override void OnMarketData(MarketDataEventArgs e)
    {
    if (e.MarketDataType == MarketDataType.Last)
    {
    Print("Last: " + e.Time.ToString("yyyy-MM-dd hh:mm:ss:ff"));
    }
    else if (e.MarketDataType == MarketDataType.Ask)
    {
    Print("Ask: " + e.Time.ToString("yyyy-MM-dd hh:mm:ss:ff"));
    }
    else if (e.MarketDataType == MarketDataType.Bid)
    {
    Print("Bid: " + e.Time.ToString("yyyy-MM-dd hh:mm:ss:ff"));
    }
    else
    {
    return;
    }
    }
    Thank you!

    #2
    Hello youraveragejoe,

    The time that comes with each event is the time that the exchange recorded for that event.

    Comment


      #3
      Hi Jesse! Thanks for the quick response.

      Got it, that makes sense. Is the delay in getting the data (getting the events out of order) expected or is it a problem with my computer? Where is the delay happening?

      Comment


        #4
        Hello youraveragejoe,

        The events that OnMarketData receives are pushed directly from the data provider and the platform displays the events in the sequence that was provided. I am not aware of any resource that says the events have to come in a specific order in regard to the timestamp that was recorded.

        Comment


          #5
          Hello!

          I've got the same issue with MarketDataEventArgs.Time.
          Sometimes the current OnMarketData event has a Time even up to 1-2 minutes(!) less than the time of the previous event.
          Does this mean that the order in which such events are received by NT is broken somewhere along the way?

          Comment


            #6
            Hello curious ,

            The market data event timestamps are recorded by the exchanged, your broker then provides the data with those timestamps. The timestamps on the data you get are based on the events that were observed in the market. You can see the following page to see if your broker uses native timestamps or local timestamps. https://ninjatrader.com/support/help...rical+provider

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            43 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            21 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            30 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            50 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            40 views
            0 likes
            Last Post CarlTrading  
            Working...
            X