Nowadays, algorithmic trading or robot trading is a trend and “Fast” is the keyword. After a user completes the algorithm that is fast, reliable and applicable to various products in the market. Now, It is time to talk about theory to upgrade hardware in order to benefit the most.
Theory of TCP
TCP has a handshake process to confirm when a client connects or disconnects to the server. The handshake process when connecting client to server is shown in the picture below.
Client sends the package with flag syn to the server. Then, the server sends the tcp package with syn and ack flag to the client. After That, the client sends the tcp package with the ack flag to the server. The handshake process for connecting is done. Now, the client and server can send or receive data to each other. The next step is the Disconnect process. The handshake process when disconnecting client from server is illustrated in the picture below.
The client sends the tcp package with the fin flag to the server. Next, the server sends a tcp package with fin and ack flag to the client. Then, the client sends the tcp package with ack flag. The Disconnect handshake is completed.
Multiple sessions is the concept of using one ip address connecting to multiple computers. This can be achieved by using multiple port sections on the tcp header. The benefit of this concept in the first place is to send/receive information to/from multiple computers on the internet. This concept can adapt to the trading world by using the same algorithm but sending orders to different brokers. Otherwise, users need to open and close the port when connecting to the server of each broker. The amount of time for opening and closing connections could cost users a lot when relative to the price of stock.
Multiple sessions is the key to reduce overhead timing when data needs to be sent/received to/from many end-points. Due to the fact that there is no need to re-establish the connection between client and server, robot trading uses this advantage to arbitrage the market even trading the same product but different brokers.