spencerbug / RLTrader

Trading and Portfolio Management using swarm population based reinforcement learning in an exchabge
4 stars 0 forks source link

Exchange architecture #8

Open spencerbug opened 2 years ago

spencerbug commented 2 years ago

Current thread structure:

Thread 1: Input queue. (Orders like add, modify and cancel) Receives incoming orders via AMQP and puts them on a FIFO buffer for the matching engine to read atomically

Thread 2: Matching Engine Reads from input queue, then performs an order execution, then writes transpired events (add, modify, cancel, and executions) to the output queue. Every so often it will perform a garbage collect to clear memory from the tree/cache

Thread 3: Output queue Takes events written to the output queue and publishes them via UDP broadcasts

We need to have locks and/or atomics on these to make this happen

spencerbug commented 2 years ago

Currently rolling with exchange-core and exchange-gateway-rest which works quite well, once I learn how to use it