Announcement

Collapse
No announcement yet.

Excel 2007: Time & Sales Event Handler

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

  • Excel 2007: Time & Sales Event Handler

    Trying to setup an event handler in Excel 2007/VBA for streaming Time and Sales, but can't get the handler to fire.

    This is what I've done:

    Under my spreadsheet project, I inserted a new Class1 module and put the following line:

    Public WithEvents eSig As IESignal.Hooks

    On the General drop-down list, I selected eSig.
    On the Declarations drop-down list I selected eSig_OnTimeSalesChanged.
    The following Sub was automatically dropped into the Class1 module:

    Private Sub eSig_OnTimeSalesChanged(ByVal lHandle As Long) '<-- Breakpoint set on this line of code

    End Sub

    I set a breakpoint as indicated, above, to stop execution when/if the handler fires.

    Then, in my ThisWorkbook module, I made the Reference to IESignal (Tools->References), and put the following code in the module:

    Sub Test()
    Dim obj As New Class1
    Set obj.eSig = New IESignal.Hooks

    Dim lHandle As Long

    Dim entitled As Boolean
    obj.eSig.SetApplication ("UserNameHere")
    entitled = obj.eSig.IsEntitled

    Dim tsFilter As IESignal.TimeSalesFilter

    tsFilter.sSymbol = "AA"
    tsFilter.bQuotes = False
    tsFilter.bTrades = True
    tsFilter.lNumDays = 1
    tsFilter.bFilterPrice = False
    tsFilter.bFilterVolume = False
    tsFilter.bFilterQuoteExchanges = False
    tsFilter.bFilterTradeExchanges = False

    lHandle = obj.eSig.RequestTimeSales(tsFilter)
    End Sub

    I stepped all the way through the Test() sub using F8 and didn't get any errors. After the last line of code in Test() sub was executed, lhandle = 1, and entitled = True.

    At that point, I figured the event handler would start firing but the breakpoint I set in Class1 never gets hit. Well, the event handler actually fired one time and my breakpoint was hit, but I've never been able to get it to happen again. And everytime I run Test(), my lHandle increments by one, so doubt that is helping anything. The only way I can get the handle to reset to zero is to shut down and restart eSignal.

    What am I doing wrong?

    Thanks,
    George

  • #2
    After letting my brain chew on this for a few hours, I'm guessing that T&S data is handled much like historical quote data: as I understand it, the event handler does not fire unless you process all the data in the cache first. Then, when the next data item is received, an event is raised and the event handler fires.

    Assuming that is correct, I believe I know where to go with this now.

    Thanks,
    George

    Comment

    Working...
    X