Announcement

Collapse
No announcement yet.

Duplicate T&S Data

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

  • Duplicate T&S Data

    From a user:

    "since each TS data line consists of either Bid/Ask info or Price/Size info on one line but not both... and we need both on each line.

    so let me tell you what we want and maybe you can tell us which is the best way to go...

    What we want is the following info on each data line with NO DUPLICATIONS OF DATA STRUCTURES

    TIME, SYMBOL, PRICE, TRADESIZE, BID, ASK... "


    If you want everything on one line, but don't want duplicate trades, the result is that you only want trades.

    You should be checking DataType in the structure for tsdTrade. It is likely a binary flag, so test it using unary AND. If (DataType & tsdTrade) etc.


    In another problem, COM exception, might be caused because you are not doing:

    Private Sub FillTS()
    Dim lNumBars, lNumRtBars, lBar, lDiff As Long
    Dim item As IESignal.TimeSalesData
    item = new IESignal.TimeSalesData

    Is lLastRtCount initialized properly to 0 somewhere?

  • #2
    Code Breaks Still

    'Still breaks in sub FILLTS on this line... attached doc shows error
    'item = esignal.GetTimeSalesBar(lTsHandle, lBar)

    '****************************
    Dim WithEvents esignal As IESignal.Hooks
    Dim sLastSymbol As String
    Dim lTsHandle As Long
    Dim lLastTsCount As Long
    Dim lLastTsRtCount As Long
    Private Sub ReleaseTS()
    If lTsHandle <> 0 Then
    esignal.ReleaseTimeSales lTsHandle
    lTsHandle = 0
    lLastTsCount = 0
    End If
    End Sub

    Private Sub cmdRelease_Click()
    ReleaseTS
    End Sub

    Private Sub cmdRequest_Click()
    Dim sSymbol As String

    sSymbol = edtSymbol.Text
    Trim (sSymbol)

    If sSymbol = "" Then
    Exit Sub
    End If

    ReleaseTS

    Dim tsFilter As IESignal.TimeSalesFilter
    tsFilter.sSymbol = sSymbol
    tsFilter.bQuotes = True
    tsFilter.bTrades = True
    tsFilter.lNumDays = 1
    tsFilter.bFilterPrice = False
    tsFilter.bFilterVolume = False
    tsFilter.bFilterQuoteExchanges = False
    tsFilter.bFilterTradeExchanges = False

    list.Clear

    lTsHandle = esignal.RequestTimeSales(tsFilter)

    End Sub
    Private Sub Form_Load()
    Set esignal = New IESignal.Hooks
    lTsHandle = 0
    lLastTsCount = 0
    esignal.SetApplication ("chrisjames")
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
    ReleaseTS
    Set esignal = Nothing
    End Sub

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

    Private Function FormatTS(item As TimeSalesData)
    Dim sRet As String

    If item.DataType = tsdNA Then
    sRet = "NA"
    Else
    sRet = Str$(item.dtTime)

    If item.DataType = tsdTRADE Then
    sRet = sRet + ", Trade"
    ElseIf item.DataType = tsdBID Then
    sRet = sRet + ", Bid"
    ElseIf item.DataType = tsdASK Then
    sRet = sRet + ", Ask"
    End If

    sRet = sRet + ", " + Str$(item.dPrice)
    sRet = sRet + ", " + Str$(item.lSize)
    sRet = sRet + ", " + item.sExchange
    End If

    FormatTS = sRet

    End Function

    Private Sub FillTS()
    Dim lNumBars As Long, lNumRtBars As Long, lBar As Long, lDiff As Long
    Dim item As IESignal.TimeSalesData

    lLastTsRtCount = 0

    ' only showing realtime bars.
    lNumRtBars = esignal.GetNumTimeSalesRtBars(lTsHandle)
    lNumBars = esignal.GetNumTimeSalesBars(lTsHandle)

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

    For lBar = lDiff + 1 To 0
    item = esignal.GetTimeSalesBar(lTsHandle, lBar)
    sBar = FormatTS(item)
    list.AddItem sBar, 0
    Next lBar

    lLastTsRtCount = lNumRtBars

    End Sub
    Attached Files
    **Have Stop - Will Trade**

    Comment


    • #3
      Looks like you need to add this line of code:

      item = new IESignal.TimeSalesData

      Comment


      • #4
        You could also try:

        Set item = esignal.GetTimeSalesBar(lTsHandle, lBar)
        Simon Thornington
        eSignal Developer

        Comment


        • #5
          No Joy

          Per Robi...
          If i add item = new IESignal.TimeSalesData...
          I get an error 'invalid use of new keyword'

          Per Simon...
          If add set to "item = esignal.GetTimeSalesBar(lTsHandle, lBar)
          I get error "Object required"

          As a reminder - ALL the code i posted is the sample code supplied from your file share TsSample Project.ZIP...

          cj
          **Have Stop - Will Trade**

          Comment


          • #6
            tsSample still breaking

            After having tried this on a completely separate computer, with identical results, it begins to appear that there may be firewall issues, which allow YOU to run this code properly, but not me.

            REMINDER: We're using VB6. We've tried it on two completely different computers with exactly the same results.

            Just to clarify matters, yes, lLastRtCount is initialized properly to 0 in the form_load event.

            item = new IESignal.TimeSalesData is not a valid use of the "New" keyword. For new IESignal, our only intellisense option is "iHooks".

            Since 'item' is dimmed as IESignal.TimeSalesData, it is not an object, so you can't "Set" it.

            The error code we're getting is "Run-time error '-2147023898 (800703e6)': Method GetTimeSalesBar of object 'iHooks' failed".

            A search on Google reveals that this may be a problem with DHCP
            and DNS settings -- we can't access the data. I have put the recommended link at the bottom of this post.

            Thanks,

            Chris

            http://support.microsoft.com/default.aspx?scid=kb;[LN];320697
            **Have Stop - Will Trade**

            Comment


            • #7
              Ah ha! Now we are getting somewhere. I keep running the sample and not having any problems at all, so it was hard to solve to the problem when I couldn't replicate it.

              Are you getting T&S data in eSignal if you open a T&S window?

              Reference this page to configure your firewall to work with eSignal. In short, you should have ports 2189-2196 open.

              The set and new commands were for VB.NET.

              Let me know if this does the trick.

              Comment


              • #8
                OK

                Yes i have some T&S windows open and running in my eSignal app right now for MSFT and IBM.

                ok... i will make the port changes, re-run the code and report back... thanks...

                cjames
                **Have Stop - Will Trade**

                Comment


                • #9
                  Color Me Frustrated

                  I am a home PC user (with no network and no corporate firewall) but i do have Norton Internet Security which i completely disabled and then tried to run the code again and it broke on the same line...

                  when i use the eSig app i run T&S windows just fine all day...

                  we also have no problem running the GetBasicQuote code just fine but not this T&S code which access a different server - the T&S server right?

                  what now..?

                  cjames...
                  **Have Stop - Will Trade**

                  Comment


                  • #10
                    Hi,

                    Could you please post some debug output with respect to the values of lHandle and lTsHandle inside OnTimeSalesChanged ?

                    Thanks,

                    Simon.
                    Simon Thornington
                    eSignal Developer

                    Comment


                    • #11
                      Debug Output Posted

                      item = esignal.GetTimeSalesBar(lTsHandle, lBar) ** breaks here

                      First Debug...

                      ltsHandle = 17
                      lBar = -913

                      run code again...
                      Second Debug...

                      ltsHandle = 19
                      lBar = -14995


                      *********************
                      Dim WithEvents esignal As IESignal.Hooks
                      Dim sLastSymbol As String
                      Dim lTsHandle As Long
                      Dim lLastTsCount As Long
                      Dim lLastTsRtCount As Long


                      Private Sub ReleaseTS()
                      If lTsHandle <> 0 Then
                      esignal.ReleaseTimeSales lTsHandle
                      lTsHandle = 0
                      lLastTsCount = 0
                      End If
                      End Sub

                      Private Sub cmdRelease_Click()
                      ReleaseTS
                      End Sub

                      Private Sub cmdRequest_Click()
                      Dim sSymbol As String
                      sSymbol = edtSymbol.Text
                      Trim (sSymbol)

                      If sSymbol = "" Then
                      Exit Sub
                      End If

                      ReleaseTS

                      Dim tsFilter As IESignal.TimeSalesFilter
                      tsFilter.sSymbol = sSymbol
                      tsFilter.bQuotes = True
                      tsFilter.bTrades = True
                      tsFilter.lNumDays = 1
                      tsFilter.bFilterPrice = False
                      tsFilter.bFilterVolume = False
                      tsFilter.bFilterQuoteExchanges = False
                      tsFilter.bFilterTradeExchanges = False

                      list.Clear

                      lTsHandle = esignal.RequestTimeSales(tsFilter)

                      End Sub

                      Private Sub Form_Load()
                      Set esignal = New IESignal.Hooks
                      lTsHandle = 0
                      esignal.SetApplication ("username")

                      End Sub


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

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

                      Private Function FormatTS(item As TimeSalesData)
                      Dim sRet As String

                      If item.DataType = tsdNA Then
                      sRet = "NA"
                      Else
                      sRet = Str$(item.dtTime)


                      If item.DataType = tsdTRADE Then
                      sRet = sRet + ", Trade"
                      ElseIf item.DataType = tsdBID Then
                      sRet = sRet + ", Bid"
                      ElseIf item.DataType = tsdASK Then
                      sRet = sRet + ", Ask"
                      End If

                      sRet = sRet + ", " + Str$(item.dPrice)
                      sRet = sRet + ", " + Str$(item.lSize)
                      sRet = sRet + ", " + item.sExchange
                      End If

                      FormatTS = sRet
                      End Function

                      Private Sub FillTS()

                      Dim lNumBars, lNumRtBars, lBar, lDiff As Long
                      Dim item As IESignal.TimeSalesData

                      lLastTsRtCount = 0

                      ' only showing realtime bars.
                      lNumRtBars = esignal.GetNumTimeSalesRtBars(lTsHandle)
                      lNumBars = esignal.GetNumTimeSalesBars(lTsHandle)

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

                      For lBar = lDiff + 1 To 0
                      item = esignal.GetTimeSalesBar(lTsHandle, lBar)
                      sBar = FormatTS(item)
                      list.AddItem sBar, 0
                      Next lBar

                      lLastTsRtCount = lNumRtBars


                      End Sub
                      **Have Stop - Will Trade**

                      Comment


                      • #12
                        Latest...

                        Tried the same code on one of my programmers machines in Okalahoma and it did not work then we tried it on another of my programmers machines in Missouri and it DID work !! but he was using XP. So after it worked on his windows XP he then put the same code on a Laptop that has windows 2000 pro and it FAILED WITH the same error...

                        So all the machines this code failed on(3 for us) were Windows 2000 pro. My windows 2000 pro is as up to date with all service paks(4) and updates possible as of 25th of July... and it still breaks on same line of code...

                        any thoughts...

                        cj
                        **Have Stop - Will Trade**

                        Comment


                        • #13
                          Well, at least we know what's going wrong.

                          Make sure that your IDE is on the most recent service pack because I have a hunch that this is related to an outdated Microsoft .dll, in particular "mfc42.dll" and "mfc71.dll". If you are using MS Visual Studio 6.0, you should be on SP6.

                          Our developer's are aware of the problem and will look into another solution.

                          Comment


                          • #14
                            For VB6 of Visual Studio 6.0 the latest Service Pack is 5.0 and we put that on and every other update in the windows world too for Win2k in mid july and only then ran the sample code which failed on every machine but the WINXP OS...

                            cj
                            **Have Stop - Will Trade**

                            Comment


                            • #15
                              Also on our Win2K PC's your GetBasicQuote and OnChangedQuote runs fine... but we have never been able to run your T&S code on them...

                              cj
                              **Have Stop - Will Trade**

                              Comment

                              Working...
                              X