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 NullPointStrategies, Today, 05:17 AM
            0 responses
            44 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            124 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            65 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            42 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            46 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X