Announcement

Collapse
No announcement yet.

Returning the Symbol with the History Handle in VB

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

  • Returning the Symbol with the History Handle in VB

    Can someone please tell me how I return the Symbol using the History Handle.

    When I issue the command:

    lHistoryHandle = esignal.RequestHistory("MSFT", “D”, btDAYS, 1, -1, -1)

    I now have the History Handle but I do not know what Symbol it is associated with.

    The Event:

    Private Sub esignal_OnBarsChanged(ByVal lHandle As Long)

    Is constantly returning history data but I can not relate the symbol because “Symbol” is not a member of the datatype “BarData”.

    I have looked for other properties in the eSignal object but can not return the symbol with the history handle.

    Please help.. Thanks JB
    BucksAx

  • #2
    You do know what symbol is associated with a given handle, because you told it what symbol to use in RequestHistory. You could use a hash table, an array-based stucture, etc. to store the mappings so you can look it up when needed.

    Cheers... George

    Comment


    • #3
      Symbol Via History handle

      That is true, I had thought of that. But this method is not very efficient from a coding standpoint.

      Plus, if your application is linked to a watch list in eSignal (which my app is) the OnBarsChanged will fire when data changes in eSignal.

      In that case I don’t have a clue what symbol the History Handle belongs to.

      In other words the OnBarsChanged returns dozens of different history handles, that I didn’t make the request for, in my application.

      Thanks JB..
      BucksAx

      Comment


      • #4
        GenSpoo has it right on. OnBarsChanged informs you of which handle (or index) the response is for. If it is an array, you are able to determine which symbol the event is for very easily.

        OnBarsChanged is a response event for a RequestHistory request and you must have made the request at some time.

        Comment


        • #5
          history handles

          I see what you are saying and I am sure you are right, but if you look at the Debug.print list at the very bottom you will see the different Handle values. What am I missing guys???


          here is the code (Mostly from the VBSamples.zip)

          debug listing listing at very bottom.

          Thanks Much.... JB..

          ===========================================

          Private Sub Main()

          '(connection & setup, Then...)

          sInterval = "D"
          bt = btDAYS
          nNumBars = 1

          lHistoryHandle = esignal.RequestHistory("CSCO", sInterval, bt, nNumBars, -1, -1)
          lHistoryHandle = esignal.RequestHistory("MSFT", sInterval, bt, nNumBars, -1, -1)


          End Sub

          ===========================================

          Private Sub esignal_OnBarsChanged(ByVal lHandle As Long)

          Debug.Print "OBC " & lHandle

          Call FillHistory(lHandle)
          End Sub

          ==========================================

          Private Sub FillHistory(lHistoryHandle2 As Long)


          lHistoryHandle = lHistoryHandle2



          ' this function handles all bars received and bar updates
          Dim lNumBars As Long
          Dim baritem As IESignal.BarData
          Dim lBar As Long
          Dim sBar As String

          edtHistorySymbol.Text = PassSymbol
          DoEvents

          lNumBars = esignal.GetNumBars(lHistoryHandle)
          If lNumBars = 0 Then
          Exit Sub
          End If

          If lstHistory.ListCount > 0 And lNumBars = lLastHistoryCount Then
          ' update the top bar
          baritem = esignal.GetBar(lHistoryHandle, 0)
          sBar = FormatBarData(0, baritem)

          lstHistory.List(0) = sBar

          Debug.Print sBar

          ElseIf lstHistory.ListCount > 0 And lNumBars = lLastHistoryCount + 1 Then
          ' add a new bar
          baritem = esignal.GetBar(lHistoryHandle, 0)
          sBar = FormatBarData(0, baritem)
          lstHistory.AddItem sBar, 0

          Debug.Print sBar

          ElseIf lstHistory.ListCount = 0 Or lNumBars <> lLastHistoryCount + 1 Then
          ' refresh entire list box.
          For lBar = -(lNumBars - 1) To 0
          baritem = esignal.GetBar(lHistoryHandle, lBar)
          sBar = FormatBarData(lBar, baritem)
          lstHistory.AddItem sBar, 0

          Debug.Print sBar

          Next lBar
          End If
          lLastHistoryCount = lNumBars
          End Sub

          ‘-----------------------------------------------------------


          Below is a sample Debug.Print listing.


          Notice the different Handle values in the OnBarChanged event.



          OBC 57
          2/16/2005 4:26:00 PM: 14.5, 14.5, 14.5, 14.5, 100
          100
          OBC 56
          2/16/2005 4:26:00 PM: 14.5, 14.5, 14.5, 14.5, 100
          100
          OBC 55
          2/16/2005 4:26:00 PM: 14.5, 14.5, 14.5, 14.5, 100
          100
          OBC 229
          2/16/2005: 14.6, 14.68, 14.22, 14.47, 2923858
          2/16/2005: 14.6, 14.68, 14.22, 14.49, 2926058
          2/16/2005: 14.6, 14.68, 14.22, 14.49, 2927258
          2/16/2005: 14.6, 14.68, 14.22, 14.52, 2933124
          2/16/2005: 14.6, 14.68, 14.22, 14.51, 3109011
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3548501
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3548501
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          25465923
          OBC 228
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 226
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 224
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 222
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 220
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 218
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 212
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 210
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 209
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 208
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 207
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 206
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 205
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 204
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 203
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 202
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 201
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 200
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 184
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 73
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 72
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 71
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 70
          2/16/2005: 14.6, 14.68, 14.22, 14.48, 3549612
          3549612
          OBC 256
          2/16/2005: 25.87, 25.93, 25.67, 25.78, 40430410
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 40434110
          2/16/2005: 25.87, 25.93, 25.67, 25.78, 40440220
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 40447560
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 40660830
          2/16/2005: 25.87, 25.93, 25.67, 25.77, 40826290
          2/16/2005: 25.87, 25.93, 25.67, 25.84, 45143880
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56594790
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56594790
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56594790
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56594790
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          571360750
          OBC 254
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 252
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 250
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 248
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 246
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 244
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 242
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 240
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 238
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 236
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 234
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 232
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 230
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 227
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 225
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 223
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 221
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 219
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 217
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 215
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 213
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          OBC 211
          2/16/2005: 25.87, 25.93, 25.67, 25.79, 56598290
          56598290
          BucksAx

          Comment

          Working...
          X