bullero


Total Posts: 10 
Joined: Feb 2018 


Hi experts,
I am facing an architectural design problem and I am quite sure someone here has done this before. Therefore, I am making an attemp to summon the knowledge from the heavens to enlighten me in my journey.
Specifically, the end goal is to store the N last states of an arbitrary limit order book in order to compute some function over the current state taking this state information as an input.
As the first order solution one may come to the conclusion that one would probably want to maintain some MxN matrix in memory where M represents the numebr of price levels of the cross sectional book and where N represents the number of cross sections that is kept in memory. Each time new tick arrives one updates the matrix using the following logic:
1. Pop all elements from the first row (that is, the oldest information is popped out) 2. Create a new row (new crosssection) to the matrix 3. Append the new tick information to correct place in the newly created row 4. Copy information from N1 (previous N) to the Nth row (excluding the new tick of course) 5. repeat as ticks arrive
Now, lets imagine that we have some K number of strategies which all want to have access to this same information. One way would be to run this as a separate process and query the state information using, for example ZeroMQ or equivalent TCP approach. In this approach we only have one instance of the LOB information but need to deal with sockets and some overhead. Alternatively one could maintain this information inside each strategy instance in which case we would have multiple instances of the same information, no need to use sockets but this would eat more memory.
How would you solve this problem? Any suggestions?
Thanks



