nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
2.01k stars 459 forks source link

Throttler component Rust port #1202

Open cjdsellers opened 1 year ago

cjdsellers commented 1 year ago

This issue is to discuss the porting of the existing Cython implemented Throttler component to Rust. https://github.com/nautechsystems/nautilus_trader/blob/develop/nautilus_trader/common/throttler.pxd

~~Of note is that internally it is using the Cython implemented Queue: https://github.com/nautechsystems/nautilus_trader/blob/develop/nautilus_trader/common/queue.pxd~~

~~There are actually no other components using this queue at the C level, other than the SimulatedExchange here: https://github.com/nautechsystems/nautilus_trader/blob/develop/nautilus_trader/backtest/exchange.pyx#L213~~

And so we can actually entirely remove this bespoke Queue from the codebase once its refactored away from the above. The only other pieces using it are in the live part of the stack, which can easily use the asyncio.Queue instead.

Assigning myself initially just to get rid of the Queue first of all, for Rust there are far better options available.

cjdsellers commented 1 year ago

The bespoke Queue has now been removed with 20afaa3b97e3fc803f1b51f6f061b8880bca2cc0, replaced by the standard collections.deque (which was being used under the hood anyway).

For the live engines, the queue was replaced with the standard asyncio.Queue, which simplifies the implementations.