Announcement

Collapse
No announcement yet.

Getting historic and realtime time&sales data

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

  • Getting historic and realtime time&sales data

    Hi,

    I wonder if anyone could help me out with this one...

    I trying to obtain the real-time time & sales data for a symbol, but also the historic data in the event that the application is started in the middle of the session.

    The problem I have is this....

    Let say that the historic "GetNumTimeSalesBars" returns 100.

    I believe this means that I need to request bars -99 to 0.
    Ok...I set up a loop to to fetch bars -99 to 0 using "GetTimeSalesBar"

    Ok so far...

    As this is a real time session, the "OnTimeSalesChanged" event fires off in the middle of my loop and "GetNumTimeSalesRtBars" returns 10 real time bars.

    The "GetTimeSalesBar" index is now -110 to 0, having shifted all records to the left to include the new reale time bars

    However my "-99 to 0" loop is somewhere in the middle retrieving records which have now shifted, creating gap and duplications...???

    As all new real time bars are dynamically added to the end, the process of retrieving historic record during a live session appears to be a moving target.

    There appears to be no way to turn-off dynamic updating, as is available in the eSinal application window.

    Any help would be appreciated.

    Rene'.

  • #2
    No, there is no way to turn off dynamic updating through the API. I would get the historical data after the market closes, if I were you or exit out of your loop when the event fires and backfill when a real-time price is not coming in.

    Comment


    • #3
      Originally posted by eSignal Robi
      No, there is no way to turn off dynamic updating through the API. I would get the historical data after the market closes, if I were you or exit out of your loop when the event fires and backfill when a real-time price is not coming in.
      Hi Thanks for your reply, but I have resolved my problem with a dynamic variable, which keeps fetching records until there is none left (including new realtime records) and then uses the event handler for further updates.

      While I am fetching historic records, the event handler only sets the new record count and exits.

      In my Fetch History routine;


      m_BusyFetchingHistory = True
      m_HisBarCount = esignal.GetNumTimeSalesBars(m_tsHandle)
      RecCount=m_HisBarCount

      '// Loop until all records are retrieved and dynamically
      '// inlude new real time records
      '// HisBarCount is updated in the event handler

      DynamicIdx& = -RecCount& + 1

      While DynamicIdx& < 1
      ts = esignal.GetTimeSalesBar(m_tsHandle, DynamicIdx&)
      Call m_RecArray.AddTS(ts)
      ''
      DoEvents
      ''
      DynamicIdx& = DynamicIdx& + RecCount& - m_HisBarCount + 1
      Wend

      This has solved the problem for me.

      Rene'.

      Comment


      • #4
        Very slick. Thanks for posting your logic.

        Comment

        Working...
        X