nautechsystems / nautilus_trader

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

Latency modeling for sandbox/real-time #1677

Open cjdsellers opened 1 month ago

cjdsellers commented 1 month ago

Feature Request

A use_message_queue config option was added to SimulatedExchange as a temporary work around for processing trading commands in real-time cbfc7035aa62df6cdf6c45cf3621cf3d0eea4faf to accommodate the "sandbox mode" https://github.com/nautechsystems/nautilus_trader/issues/1674.

This means that currently when trading commands are submitted to the sandbox execution client (and onto its internal simulated exchange) there is practically no latency in either direction. The commands will be processed and events generated at local platform latency (microseconds) which is relatively unrealistic for most venue and setups.

A future feature could leverage the LatencyModel to extend to real-time, potentially by using a timer to "delay" command processing and events being generated - to achieve to desired latency model spec.

OdinLin commented 3 weeks ago

Like https://github.com/nkaz001/hftbacktest/blob/master/docs/latency_models.rst