Interesting....broker is IB then ? It's gotta be their API or connection to the exchanges then....on these latest machines, VBA is plenty fast enough and would likely not be the delay.
Yep... IB. btw Im from Singapore so US is a little bit far, and I've set the twsdde to update at 1000ms refresh and processing. Or perhaps the orders routing or running 5-6 open Excel Windows might hurt hehe.
One thing to consider: instead of a single instance of Excel with multiple workbooks open, have separate instances instead. This provides a crude method of threading and helps to overcome the single threaded architecture of Excel and it's VBA interpreter.
syswizard, thanks for suggesting and helping out, appreciate it. In fact I had this problem few days back and I solved, budden I am stlll not utlizing my quad core CPU chip though. I am running multiple workbook of my code, linked to 1 instance of twsdde.xls. All of them fall under 1 excel.exe instance which is fine. My qns is how can I run multiple twsdde.xls, paired to my algo workbook ? The IB tws program, if im not mistaken, is unable to run multiple instances. Once I have 2 instances of twsdde, only 1 instance is able to receive live quotes, the moment i click and focus on it. Piss me off ! Any ideas ? Other than running 1 IB tws tag to 1 twsdde per computer (VM images, multiple computers etc). Thanks in advance !
You should be able to run multiple TWSDDE as long as they are in separate Excel instances. You'll have to rewrite everything of course to accomodate this change in architecture. Keep in mind, with multiple instances, you can run each Excel instance in a separate core. You can set-up a Start.exe command procedure that actually fires-off Excel into the separate cores using the Affinity setting. That way, you don't have to change in manually each day.
Ahh... it seems im running on WIndows XP damn ! No start.exe. Like I said once I start twsdde on 2 separate excel.exe, only 1 instance can receive quotes. Maybe an upgrade would help me now heh.
What on earth are you talking about ...re: no start on XP. Here is the HELP from the command line on START from XP: Starts a separate window to run a specified program or command. START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [/B] [command/program] [parameters] "title" Title to display in window title bar. path Starting directory B Start application without creating a new window. The application has ^C handling ignored. Unless the application enables ^C processing, ^Break is the only way to interrupt the application I The new environment will be the original environment passed to the cmd.exe and not the current environment. MIN Start window minimized MAX Start window maximized SEPARATE Start 16-bit Windows program in separate memory space SHARED Start 16-bit Windows program in shared memory space LOW Start application in the IDLE priority class NORMAL Start application in the NORMAL priority class HIGH Start application in the HIGH priority class REALTIME Start application in the REALTIME priority class ABOVENORMAL Start application in the ABOVENORMAL priority class BELOWNORMAL Start application in the BELOWNORMAL priority class WAIT Start application and wait for it to terminate command/program If it is an internal cmd command or a batch file then the command processor is run with the /K switch to cmd.exe. This means that the window will remain after the command has been run. If it is not an internal cmd command or batch file then it is a program and will run as either a windowed application or a console application. parameters These are the parameters passed to the command/program If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows: non-executable files may be invoked through their file association just by typing the name of the file as a command. (e.g. WORD.DOC would launch the application associated with the .DOC file extension). See the ASSOC and FTYPE commands for how to create these associations from within a command script. When executing an application that is a 32-bit GUI application, CMD.EXE does not wait for the application to terminate before returning to the command prompt. This new behavior does NOT occur if executing within a command script. When executing a command line whose first token is the string "CMD " without an extension or path qualifier, then "CMD" is replaced with the value of the COMSPEC variable. This prevents picking up CMD.EXE from the current directory. When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD Notice the syntax is the same as the PATH variable, with semicolons separating the different elements. When searching for an executable, if there is no match on any extension, then looks to see if the name matches a directory name. If it does, the START command launches the Explorer on that path. If done from the command line, it is the equivalent to doing a CD /D to that path.
Sample set-up for Affinity (place this in a CMD or BAT file): "C:\Windows\System32\cmd.exe" /c start /realtime /affinity 1 "C:\Program Files\Microsoft Office\OFFICE12\Excel.exe" The above starts Excel in realtime priority using CPU Core #2. Here are the various core assignments via the affinity parameter: 1 does processor 0 2 does processor 1 3 does processors 0 and 1 4 does processor 2 5 does processors 0 and 2 6 does processors 1 and 2 7 does processors 0, 1, and 2 8 does processor 3 9 does processor 0 and 3 D does processor 0, 2, and 3 F does processors 0, 1, 2, and 3
syswizard I've learn something new today Thanks for pointing out... theres not start.exe (maybe in >Win Vista only), but just "Start /help" and ok I can RTFM myself from there. Was running 10 workbook in 1 excel.exe and my PC starts to drag...
Oh ya, the options can be set at taskmanager for real time priority and CPUs usage 0-4. btw why would I run it only on CPU 2 and 4, when I can use all 4 CPUs that I have. Wouldnt it be better ? btw im using psexec to run affinity because there isnt the affinity option for "Start" in Winxp. PsExec.exe -a 2,4 -realtime "C:\windows\system32\notepad.exe" Will need to stress it hmm.