Announcement

Collapse
No announcement yet.

RequestHistory returns empty bars

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

  • RequestHistory returns empty bars

    My sample here explains my problem, but essentially I'm calling requesthistory for the past 14 days and only the most recent bar gets returned.

    I'm stuck, any help is appreciated.

    Do I need to call a release method or something?

    I've written the appversion just to give a little info.
    Attached Files
    Last edited by dirt; 07-14-2008, 04:29 PM.

  • #2
    You can take a look at frmHistory.frm of our Desktop API sample in VB.



    To correctly process the returned historical bars, you need to
    start from -x and increment to 0 where x is the number of historical bars returned.

    Code Snippet in VB:

    Public Sub ProcessHistory(historyHandle As Long)

    Dim lNumBars As Long
    Dim j As Integer
    Dim baritem As IESignal.BarData

    'Find out how many bars were returned
    lNumBars = esignal.GetNumBars(historyHandle)

    'Set the above number to its inverse for a decremented loop
    lNumBars = lNumBars * -1

    For j = lNumBars + 1 To 0

    'Retrieve the BarData data structure
    baritem = esignal.GetBar(historyHandle, j)

    'Parse through the structure and assign its values to variables
    vOpen = baritem.dOpen
    vHigh = baritem.dHigh
    vLow = baritem.dLow
    vClose = baritem.dClose
    dDate = Format(baritem.dtTime, "general date")

    'Build string and display it
    sBar = Format$(dDate) & vbTab & "Open=" & Format$(vOpen) & vbTab & "High=" & Format$(vHigh) & vbTab & "Low=" & Format$(vLow) & vbTab & "Close=" & Format$(vClose)
    List1.AddItem (sBar)

    Next j

    'The history handle must be released after use. Note that
    'in some cases, ReleaseAllHistory may also be used.
    esignal.ReleaseHistory (historyHandle)

    End Sub

    Comment


    • #3
      Ah...negative to zero

      I shoulda figured that one on my own.

      Thank you.

      Comment


      • #4
        My code is pretty much exactly like your sample code Achan and I still have problems with my history calls. Sometimes it works sometimes it doesn't. One symbol will work another symbol won't. The history calls will work for two weeks then won't pull back data all of a sudden. Frustrating as hell to get it solid

        Comment


        • #5
          Are you requesting historical bars for one symbol at a time? Try to fire another request only after all data has been collected for the first symbol.

          What are the exact arguments you are passing to RequestHistory method?

          Comment


          • #6
            Yes I loop through the symbols so it only makes one call at a time. It's just strange because it works for the Natural Gas Strips (ex. NGSA A0 - 3 month strip) but not for Crude Oil (ex. CLSA A0). Both on Nymex. Same Code different symbols

            Attached is the source

            thanks for the reply
            Attached Files

            Comment


            • #7
              I was able to download daily bars for the two symbols you listed below. From your code, I don't see that you implemented the event handler for historical bars. Can you confirm that you have implemented
              eSignal_OnBarsReceived?

              You can try to run our VB Sample (DESKTOP_VB_SAMPLE.zip) at

              Comment

              Working...
              X