Announcement

Collapse
No announcement yet.

Requesting History

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

  • Requesting History

    In my application, I have a requirement for getting yesterday's close and today's open for a given symbol.

    I have looked at several of the examples in the file share as well as some posted here and I am requesting history as

    esignal.get_RequestHistory("MSFT", "D", IESignal.barType.btDAYS, 2 , -1, -1);

    My goal here being to ask for 2 days of data and knowing what today is, I could then get yesterday's close and todays open by using the dates that the bars are stamped with when the events fire.

    However, when I use this, I only receive hits on 14-Oct-2004 (i.e. today).
    I never seem to get a 'hit' for 13-Oct-2004 (yesterday), although I have asked for 2 days of historical data.

    Any help would be appreciated

    -Kevin Anstey
    Kevin Anstey
    Paamco LLC

  • #2
    I'd change the request to IESignal.barType.btBARS. That should ensure you get the two bars you need.

    Cheers... George

    Comment


    • #3
      George,

      My bad. I was requesting the bars and checking that GetNumBars was > 0, but then only performing a GetBar on index 0.

      Duh!

      However, now that my brain is (hopefully) again operational, I have changed my code and I get some strange results.

      When I call the RequestHistory function as I described previously, namely

      esignal.get_RequestHistory("MSFT", "D", IESignal.barType.btDAYS, 2 , -1, -1);

      I receive a NumBars value of 3 (rather than the expected 2), and when I iterate through the Bars, I find that the Bar at index 0 contains data for today (14-Oct-2004) which is good, however, the bars at indexes 1 and 2 contain 0 data and a dtTime value of 30-Dec-1899 (i.e. these appear to be empty bars)

      I assume that the bar data indexes are 0 based and go sequentially by 1.

      I can send code if you want, but it is essentially the Multiple History Sample from the eSignal site, with only a single symbol being requsted as a test.

      Any help will be appreciated.


      -Kevin
      Kevin Anstey
      Paamco LLC

      Comment


      • #4
        The standard indexing mode in the API uses negative numbers. Try getting the bars at index -1 and -2 instead of 1 and 2. Negative is implying "past" or "historical".

        Cheers... George

        Comment


        • #5
          George,

          That works, Thanks.

          One other thing. When I get the event(s), my number of bars is always 3, and the data at offset 0 and -1 are identical. (i.e. Today's data). The data at -2 contains the previous day's data.

          Is it true, then, that today's data is always at position 0, or is there another reason that I get 3 bars.

          In addition, is there any other way to ask for 'summary' information (once) on a given symbol for a given date?

          For my purposes, it would be easier to just ask for 'summary' information synchronously for each symbol that I'm interested in.


          Please advise.

          Thanks again.
          You guys provide fantastic support.
          Kevin Anstey
          Paamco LLC

          Comment


          • #6
            Hmmm... That is strange that the -1 bar is identical to the 0 bar. The date stamps are the same?

            It is true (unless you change the index mode) that the 0 bar is always the most current. So for daily bars, 0 will be today.

            There is currently no way to ask for one specific bar from the past.

            I'm not sure what you mean by summary, but maybe you just want GetSymbol with OnQuoteReceived?

            Cheers... George

            Comment

            Working...
            X