4 ms·
I think this is a situation where a message-passing Actor-based model would do well. Maybe pass variable updates to a single writer process/thread through chann
by shepardrtc 3y ago
I think this is a situation where a message-passing Actor-based model would do well. Maybe pass variable updates to a single writer process/thread through channels or a queue.
Years ago I wrote an algorithmic trader in Python (and Cython for the hotspots) using Multiprocessing and I was able to get away with a lot using that approach. I had one process receiving websocket updates from the exchange, another process writing them to an order book that used a custom data structure, and multiple other processes reading from that data structure. Ran well enough that trade decisions could be made in a few thousand nanoseconds on an average EC2 instance. Not sure what their latency requirements are, though I imagine they may need to be faster.
Obviously mutexes are the bottleneck for them at this point, and while my idea might be a bit slower than a low-load situation, perhaps it would be faster when you start getting to higher load.
- hamandcheese 3y agoI think the Actor model is fine if you start there, but I can't imagine incrementally adopting it in a large, preexisting code base.
- ilyt 3y agoThat would most likely be several times slower than current model