Announcement

Collapse
No announcement yet.

Simultaneous History Requests

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

  • Simultaneous History Requests

    Hello. I'm working on a program using eSignal that monitors about 500 stocks. I am attempting to retrieve the last ten 1-minute bars for each stock, and need to do that every 30 seconds or so.

    However, even though I send about 500 history requests, I'm only getting about 100 back.

    Here is the request:
    historyHandle = esignal.RequestHistory(symbol, "1", btBARS, 10, -1, -1)
    request = request + 1

    "symbol" cycles through about 500 symbols. "request" increases by 1 for each request. At the end, request = 485.

    When esignal_OnBarsReceived occurs, I increase another counter by 1 and then release the history for the handle. This counter ends up around 100.

    Should this be happening? Is it even possible to get that amount of data from eSignal in such a short time span?

    Thanks.

  • #2
    I am doing something similar, albeit with a 200 stock limit.

    For your code to work, you will need to save historyHandle in an object, list or array of some sort. When your event handler triggers, it provides you with a handle as a parameter. That handle corresponds with the handle you created and saved when you called RequestHistory, enabling you to match the incoming data to the symbol for which price data was requested. This allows you to have multiple outstanding requests.

    If you do not save and use the handle, then you will have a couple of problems: since your incoming data will not necessarily correspond with the last request that you made, use of that data will be problematic, and you likely will release a lot of price history before it is received and recorded.

    Beyond this, you can do the same thing more easily by leaving the symbol active and receiving new 1 minute bars automatically through the OnESignalBarsChanged event handler.

    Comment


    • #3
      Thanks for the response. I've noticed that the incoming data arrives in an unpredicatable order. I have a list of the handles already in the code. When a handle arrives, it searches through the list to find the right one. The problems is that I sometimes never get a reply for some requests.

      I've also checked OnBarsChanged to see if any of the requests come in through there, but that isn't the case.

      Essentially, I am sending out 500 requests and only 100 or so of them are coming back.

      Comment


      • #4
        Try not to fire 500 requests all at the same time. First of all, you can use the IsValidSymbol method to determine the validity of a symbol first. If it is not valid, do not request data for that symbol.

        I would recommend that you requests 10 symbols at a time, wait for the data to come back and then request data for another 10 symbols. Each time when you call RequestHistory, you will get back a unique handle. You need to save this handle and later use it to match with the handle returned from OnBarsReceived event to see for which symbol this data is for. That's essentially how you can determine the symbol for a batch of data.

        Comment


        • #5
          OnBarsChanged will only trigger with new barts. OnBarsReceived receives historical data.

          As to the number of handles returned, you might try slowing down the flow of requests a little, making certain that incoming data can be captured as it is received even while requests are being made.

          Other than that, I would carefully check the logic the code uses in matching handles. It is easy to introduce a bug.

          What language are you using?

          Comment


          • #6
            I'm using Visual Basic. I don't think there are any bugs, because when I spaced out the requests, as AChan suggested, I got all the data back. However, it took longer than I would like.

            Alternatively, would it be possible, after I have sent out the 500 history requests and received them all back, to not release the histories and instead receive continuous updates on the minute bar histories of all 500 stocks?

            I've already tried this, but the updates came so quickly for so many stocks that either esignal or my program could not keep up. There was about one update every second for each stock.

            Is it possible to request continuous updates to the bar history for a stock, but have those updates only occur about once a minute?

            Thanks.

            Comment


            • #7
              "Is it possible to request continuous updates to the bar history for a stock, but have those updates only occur about once a minute?"

              Yes, if you mean have the event handler trigger once per minute. (It triggers with the next transaction after the one minute period ends.)

              However, it appears to me that the information flow from eSignal's servers to your machine does reflect every tick. So, the number of open requests that you can handle depends on the speed of your machine and your tubes, less whatever else you want your machine to be doing.

              Comment


              • #8
                Thanks. Handling the event only once every 15 seconds or so helped my problem.

                Comment

                Working...
                X