I am trading on crypto exchanges quite actively with quite a few strategies. In my "system" I get the data from exchanges, then I process it, then I create order and I send it to the exchanges. However, I am struggling to find the most efficient (latency wise) method with which I can execute my orders. My problem/question is the following: - What is the quickest way to send the orders created by my strategies to other processes/threads that sends the order to exchanges without stopping the said strategy while we wait for the response coming from the exchange? (The idea is to be able to create other orders if circumstances allow it.)
Currently I am testing many methods, yet I am not sure which one is the one that comes with the lowest latency. I am doing arbitrage, so latency is quite important for the code as well as simultaneous order execution.
I have tested many methods, and basically I am looking for the quickest one with which I still have some control over the queue of my orders. Currently ZMQ REQ-REP protocol gives me the most control (where order execution sends requests when it has capacity to send new orders, so that orders are not piling up at order execution), but this REQ-REP pattern comes with communication overhead. So I am looking for a similar method with lower latency, or any other idea which helps me to keep the control over the queue (I cannot have infinite processes or threads executing orders as I do not have the power for that), and lowers my latency.
I am using python for coding.