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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        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

            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Taddypole, 06-18-2024, 11:58 AM
            4 responses
            93 views
            0 likes
            Last Post music_p13  
            Started by davydhnz, 04-21-2025, 06:39 AM
            2 responses
            31 views
            0 likes
            Last Post davydhnz  
            Started by Mystery, Yesterday, 10:57 PM
            0 responses
            6 views
            0 likes
            Last Post Mystery
            by Mystery
             
            Started by iceman2018, Yesterday, 08:55 PM
            0 responses
            10 views
            0 likes
            Last Post iceman2018  
            Started by mrmccraig, 04-24-2025, 05:13 PM
            4 responses
            38 views
            0 likes
            Last Post mrmccraig  
            Working...
            X