So what you want to do is to have a threadpool so that when you get ticks from the TCP socket, you can launch a task on that threadpool (the size of the pool should be the core count - 1 for the TCP socket's thread).? This is quite easy in the JVM languages, but you are out in Python land.? So you want to do something where you generate a Task on each tick and that task contains the ticker and tick pricing information.? The threadpool schedules that task, it is executed and in a synchronized way would do whatever action is necessary (make an order, etc).? Make sure to synchronize your access to IB and the TCP socket to take those actions to avoid synch bugs.
As a side note, I doubt this scheme is worthwhile.? The overhead of making the tasks is likely more than the CPU usage by your task.? Unless you are doing something very computational intensive in your tasks, the CPU would likely completely the work before a task could be created and executed.? IB is very slow, CPUs are very fast.
Hunter
On Wednesday, May 5, 2021, 11:02:06 AM PDT, Patrick C <zenfiretrading@...> wrote:
I'm not picking this method for any reason other then my mind cant figure out any other way to do it. LOL?
I'm trying to request tickTypes from multiple stocks that will change amount every day. Otherwise the easy way to do what I am doing is just this. Or the only way I know how to do what I am trying to do.?
Ya know? Just copy and paste as neccessary, but I'm trying to make this program a little more elegant then that LOL. I was hoping I can just update my tickers list each morning and the program does the rest. Only change one line of a code if I have too, instead of having to copy/paste and change 10+ lines of code every morning. I've never built a program to handle multiple stocks at the same time. I only have experience with Futures.. and I have a individual program for each individual futures contract.