Excel based ATS sampling rate question

Discussion in 'Automated Trading' started by Big Game Hunter, Jan 12, 2008.

  1. Ok currently I am in the process of constructing a VB excel based ATS working with IB's TWS. The problem Im having is that it is only sampling the data from IB at 1 time per second. This compares with IB's TWS itself which updates its data at 10 times per second. The result of this disparity is that there are differences between the IB data as it is displayed on the charts and my own data as gathered by my ATS since my ATS will miss data because of its lower sampling rate. The answer to removing this discrepancy is of course to raise the sampling rate and thus increase the data resolution. If for example I could sample the data from TWS 10 times per second instead of the current 1 times per second the data when compared to the charts Ib produces is liable to have far less errors in it. The consequences of less errors is that fewer processing mistakes occur when it comes to generating trades based on the data and this results in less processing mistakes and money lost as a result of bad trades made because of incorrect data.

    So my real question is for anyone who may have experience using excel and VB to construct an ATS. Is it possible to alter the code in such a way as to increase the rate at which it samples data from the current 1 times per second to say for example 2 times per second? Are there any inherent limitations in excel and Visual Basic that prevent me from altering this rate? Is there a maximum rate at which i could hit TWS per second or could I theoretically make it 10 times per second and build an ATS which perfectly replicates the charts of ESignal and IB figure for figure. Anyone who knows the answer to this issue Id really appreciate hearing your thoughts. Ive so far been unable to get any feedabck on any excel programming user boards.
     
  2. Here's the code IB provides in TWSDde.xls:

    Sub setRefreshRate()
    Dim theRate As String
    theRate = Range(refreshRateCell).value
    If theRate = "" Then
    MsgBox ("You must enter a valid refresh rate.")
    Exit Sub
    End If
    Range(refreshRateLink).value = getServerStr(serverCell) & "refreshRate!millisec?" & theRate
    End Sub

    They also have something called a processing rate. Not sure what the difference is, but the code is very similar:
    Sub setProcessingRate()
    Dim theRate As String
    theRate = Range(processingRateCell).value
    If theRate = "" Then
    MsgBox ("You must enter a valid processing rate.")
    Exit Sub
    End If
    Range(processingRateLink).value = getServerStr(serverCell) & "processRate!millisec?" & theRate
    End Sub
     
  3. Thanks a lot for that. That may well be what I was looking for. I guess it depends on whether the issue is internal to the ATS or is in fact an issue that is related to TWS instead. Ill run it by my guy and let you know if we were able to modify the refresh rate with it...