Announcement

Collapse
No announcement yet.

Handle Question

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

  • Handle Question

    The following is not correct code - just roughing out the sequence of our problem

    Dim esignal as ieSignal.hooks

    esignal.dosymbollink(GE)

    esignal.requestsymbol(GE)

    set TimeSalesFilter properties(including symbol string example "GE")

    iesignal.RequestTimeSales would then be passed that filter

    That returns a NUMERIC handle...

    1] THE QUESTION - DOES THAT HANDLE FOR A SYMBOL EVER CHANGE OR IS IT ALWAYS THE SAME


    ps:
    [Our whole problem would be easily solved if esignal.GetTimeSalesBar had a symbol property ?]
    **Have Stop - Will Trade**

  • #2
    As a user of this can give you feedback from what i've seen. Someone on the other side of the code (Simon?) can perhaps provide more details.

    1) Handles are numeric and increment over the run of the Data Manager. Handles aren't reused over time,

    2) Handles start at ZERO, not ONE and up. So to init and use a handle use -1 or something. Note some of the demo code assumes zero is ok. This might cause weird bugs... but just once..

    3) I have seen cases where data requested for the same symbol on two different handles might come back on the non-requested handle. So if you are doing a "way back" request as well as a "today" request the data might be meshed together.

    4) Data seems to flow in sometimes from old program runs, i check (bd.dtTime == 0) after getting bar data to eliminate it. (the cause of this might be different, but had to do the check.

    4) TimeSales specific only. The way this adjusts the array of data when it gets new data means you have to fetch data in the message callback. If you try to do this in a timer function or otherwise your array indecies can get all messed up, as the array shifts under you if new data comes in.

    There is also a bug where this array can get date/time misorder which is in another recent thread. Hopefully this will get fixed.

    It would be nice if #4 could be averted with a suspend/resume function for the Tick updates, so one could loop on the existing array w/o being in the message function. Perhaps there's another solution?


    Hope this helps!

    -Jim

    Comment


    • #3
      For getting tick updates, there are a couple of things to do to make it easier.

      GetNumTimeSalesBars will return the total number of bars.
      GetNumTimeSalesRtBars will return the number of bars that have been added to the front of the series.

      So, you can do indexing based on offsets that use the current value of these versus the values when you started.

      Alternatively, you can call SetAbsoluteIndexing(1), which will cause the indexes to start at 0 for the oldest data.

      At that point, data being added to the front of the series will not mess up an iteration. Data being added to the back, however, would. There is an event called OnTimeSalesAbsoluteBaseChanged which returns a handle and delta of the distance the base was just moved being a prepend from backfill data.

      Cheers,

      Simon.
      Simon Thornington
      eSignal Developer

      Comment


      • #4
        Thanks Simon but,

        what has this got to do with the returned Handle value from the eSignal.OnTimeSalesChangedEvent and us determining which STOCK SYMBOL it belongs to
        **Have Stop - Will Trade**

        Comment


        • #5
          Chris - you have to keep track of that yourself. Should be part of whatever data structure you keep to process requests. Just like if you open a file and get a handle ya kinda need to know which file that is later on..

          Simon was mostly answering my question, which was actually quite helpful.

          Comment


          • #6
            Thanks Jim for taking time out of your busy day to reply

            we will post our code so it it easier to see what we are trying to do...

            are you coding in C# or C++ or ?


            cj
            **Have Stop - Will Trade**

            Comment


            • #7
              I code in C++. Have used C# but prefer C++ for my needs.

              To keep track one could just have an array of symbols and a parallel array of handles. Given a handle just find it and then match to the symbol. This is the simplest case.

              I use an array of objects which contain symbol and handle as part of the data, then move data from eSignal format to my object world when it comes in.

              -Jim

              Comment


              • #8
                kinda getting there....

                Well, we switched over to Win XP and we no longer get the HOOKs error that we kept getting on the Win2K OS and...

                we are now getting realtime T&Sales data for one stock just fine

                but when we build array to pull data for T&Sales changes for more than one stock we only seem to be able to get the T&S data back for the stock with the highest array index value...

                we only trying to pull real time TS data too...

                must be something simple were missing / doing ?

                Our Media: WinXp / VB6 / eSig 7.6

                '***************************************

                Option Compare Database
                Option Explicit

                Dim WithEvents eSignal As IESignal.Hooks
                Dim lTsHandle(29) As Long
                Dim lLastTsRtCount As Long
                Dim ltHandle As Long
                Private myExit As Boolean
                Private m_bFormLoading As Boolean
                Public MeDone As Boolean
                Dim sLastSymbol As String
                Dim mySymbol As String
                Dim Symbols(29) As String
                ____________________________________

                Private Sub Form_Load()
                Dim tsFilter As IESignal.TimeSalesFilter, i As Integer

                Symbols(0) = "MSFT"
                Symbols(1) = "GE"
                Symbols(2) = "PG"
                '...
                '...
                ‘Symbols( 29) = “some stock in future”

                m_bFormLoading = True
                MeDone = False
                Me.Visible = True

                lLastTsRtCount = 0

                Set eSignal = New IESignal.Hooks
                eSignal.SetApplication ("txtNameLogin")

                ltHandle = 0

                'BUIILDING / determing handles for the symbols in our ARRAY
                For i = 0 To 29
                If Symbols(i) <> "" And IsNull(Symbols(i)) = False Then
                eSignal.DoSymbolLink Symbols(i)
                eSignal.RequestSymbol Symbols(i), True
                tsFilter.sSymbol = Symbols(i)
                tsFilter.bQuotes = False
                tsFilter.bTrades = True
                tsFilter.lNumDays = 1
                tsFilter.bFilterPrice = False
                tsFilter.bFilterVolume = False
                tsFilter.bFilterQuoteExchanges = False
                tsFilter.bFilterTradeExchanges = False
                lTsHandle(i) = eSignal.RequestTimeSales(tsFilter)
                ltHandle = lTsHandle(i)
                End If
                Next i
                End Sub

                Private Sub esignal_OnTimeSalesChanged(ByVal lHandle As Long)
                FillTS (ltHandle)
                End Sub

                Private Sub FillTS(ByRef lHandle As Long)
                'On Error GoTo Err_Prob

                Dim bsSQL As String, lNumBars, lNumRtBars, lBar, lDiff As Long, sBar As String, i As Integer
                Dim item As IESignal.TimeSalesData, LastSize As Double, caseSize As Double, sSymbol As String
                Dim quote As IESignal.BasicQuote, myBid As Double, myAsk As Double, myPrice As Double

                ' LOOP TO GET STOCK SYMBOL
                For i = 0 To 29
                If lTsHandle(i) = lHandle Then
                sSymbol = Symbols(i)
                Exit For
                End If
                Next i

                'only showing realtime bars.
                lNumRtBars = eSignal.GetNumTimeSalesRtBars(lHandle)
                lNumBars = eSignal.GetNumTimeSalesBars(lHandle)

                ' how many new bars since last time?
                lDiff = (lNumRtBars - lLastTsRtCount) * -1

                For lBar = lDiff + 1 To 0
                On Error Resume Next
                item = eSignal.GetTimeSalesBar(lHandle, lBar)
                Select Case item.DataType
                Case tsdTRADE
                'do Insert Into database stuff here
                Select Case item.lFlags
                Case 1, 4
                Select Case item.lSize
                Case Is < 100
                bsSQL = "Insert Into tbl_Vol100 .... Yada Yada
                CurrentDb.Execute bsSQL, dbFailOnError
                Case Is < 200
                bsSQL = "Insert Into tbl_Vol200 ... Yada Yada
                CurrentDb.Execute bsSQL, dbFailOnError
                Case Is > 300
                bsSQL = "Insert Into tbl_ Vol300 ... Yada Yada
                CurrentDb.Execute bsSQL, dbFailOnError
                Case Else
                End Select
                Case 2, 8
                Select Case item.lSize
                Case Is <100
                bsSQL = "Insert Into tbl_Vol100 ... Yada Yada
                CurrentDb.Execute bsSQL, dbFailOnError
                Case Is < 200
                bsSQL = "Insert Into tbl_Vol200 ... Yada Yada
                CurrentDb.Execute bsSQL, dbFailOnError
                Case Is <300
                bsSQL = "Insert Into tbl_Vol300 ... Yada Yada
                CurrentDb.Execute bsSQL, dbFailOnError
                Case Else
                End Select
                Case tsdBID, tsdASK 'do nothing
                End Select
                Next lBar
                lLastTsRtCount = lNumRtBars
                End Sub

                Private Sub Form_Unload(Cancel As Integer)
                ReleaseTS
                Set eSignal = Nothing
                End Sub

                Private Sub ReleaseTS()
                Dim i As Integer

                For i = 0 To 29
                If lTsHandle(i) <> 0 Then
                eSignal.ReleaseTimeSales lTsHandle(i) 'CHANGE CJ
                End If
                Next i
                ltHandle = 0
                lLastTsRtCount = 0
                End Sub
                **Have Stop - Will Trade**

                Comment


                • #9
                  I think that you never change the lHandle value from 29 during your calls.

                  item = eSignal.GetTimeSalesBar(lHandle, lBar)

                  lHandle looks like it stays at 29.

                  Comment


                  • #10
                    Robi is correct:

                    Private Sub esignal_OnTimeSalesChanged(ByVal lHandle As Long)
                    FillTS (ltHandle)
                    End Sub

                    ltHandle here is set to 29. You should be calling FillTS with the lHandle (not ltHandle).

                    Cheers,

                    Simon.
                    Simon Thornington
                    eSignal Developer

                    Comment


                    • #11
                      Thanks Robbi, Simon...

                      got the correct handle now and it is working....

                      cj
                      **Have Stop - Will Trade**

                      Comment


                      • #12
                        I am glad you finally were able to get your problems worked out. I know that you have been struggling with some things for quite some time.

                        Comment


                        • #13
                          Robbi,

                          do you have MS Access 2000

                          if i send you a sample it would be in that version

                          cj
                          **Have Stop - Will Trade**

                          Comment


                          • #14
                            I am not sure why you would send me a sample. I thought your problems were resolved. If you would like to place a sample for other developers on our File Share, that would be great.

                            Comment


                            • #15
                              Jim Becker,

                              Can you recieve two or more different T&Sales streams for two stocks and if so have you reconciled (matched) them with the eSig Applications time and sales chart to see that they are one to one and that you got all the T&Sales data for both in the correct time sequence...


                              to be clear: have you pulled in two T&Sales stock data streams into a dataBase and checked to see that they match what's in the eSig app for that time peroid for both stocks...


                              cj
                              **Have Stop - Will Trade**

                              Comment

                              Working...
                              X