How to speed up IB's DDE Excel file

open VBA by pressing ALT + F11
go to Modules, uti
then find this Function:

Function rangeNameExists(ByVal rangeName As String) As Boolean
Dim existingName As name
rangeNameExists = False
For Each existingName In ActiveWorkbook.Names
If existingName.name = rangeName Then
rangeNameExists = True
Exit Function
End If
Next existingName
End Function


and replace by this:

Function rangeNameExists(ByVal rangeName As String) As Boolean
Dim existingName As name
rangeNameExists = False
Application.Calculation = xlCalculationManual 'added
Application.ScreenUpdating = False 'added
For Each existingName In ActiveWorkbook.Names
If existingName.name = rangeName Then
rangeNameExists = True
Application.Calculation = xlCalculationAutomatic 'added
Exit Function
End If
Next existingName
End Function


By adding these lines, the updating for most tabs like Accounts, Portfolio and Executions (!) will go a lot faster. Don't know why IB does it like this... It really speeds it up by 5-10 times
 
The only problem is that you would have to turn on the calculation to Automatic yourself. I cannot figure out where to place this code yet:
Application.Calculation = xlCalculationAutomatic

(at the above example it does not turn it on by itself)
 
Back
Top