nautechsystems / nautilus_trader

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

Add a full orderbook and trades backtest example #732

Closed Bob-Cantor closed 1 year ago

Bob-Cantor commented 2 years ago

Nautilus is a fast system compared to other trading software. In all the examples within nautilus, this feature is not effectively utilized. The speed can be fully utilized by trading in the lower time frames. To make this accesible for the users, a backtest example where L2 orderbook data and trades should be created. In my opinion, an example with multiple csv's for both the LOB and trades where the backtest is looping over these to prevent the overloading of RAM would be optimal. To make this complete, the notebook should have the full process from having the data as csv to adding it to catalog to running a backtest on the trade and LOB data.

An example of a strategy to use is a model where a feature can be if the insertion rate of the first 5 levels in the LOB bid side is higher than the selling rate in the same lookback period, the next tick will be an uptick done with FTX ETH/USD LOB and trades data in CSV's added to catalog.

Sharma-Rajat commented 1 year ago

ill try to build an example of this using Binance trades + quote (top level), later ill do the order book levels

OdinLin commented 1 year ago

Any update of this? I also looking for a backtest example of using LOB

limx0 commented 1 year ago

There is an example using L2 orderbook + trade betfair data available here: https://github.com/nautechsystems/nautilus_trader/blob/master/examples/backtest/betfair_backtest_orderbook_imbalance.py.