Skip to content

Support tick by tick #6

Description

@defnlnotme

The backtest uses a Context struct for the backtest time range, which uses a DateRange.
DateRange is a fixed timeframe iterator. To support tick by tick another custom iterator must be provided (either a vector of dates with nanosecond precision or an implementation of the iterator interface).

The trades execution still relies on OHLCV data for fills and slippage logic. So even when backtesting tick by tick OHLCV data with a proper timeframe (depending on the order time in force) would still be required. Alternatively a tick by tick backtesting could branch into different trade execution logic that would take into account future trades for slippage and fills and slippage.

If someone wants to currently backtest with tick by tick data it has to:

  • resample the trades into OHLCV (up to Millisecond candles if trades are in nanoseconds)
  • set this ohlcv data in each asset instance
  • run the backtest with a strategy with main timeframe of 1ms (or a Context with a DateRange of 1ms resolution)

In paper/live mode the polling frequency respects the strategy main timeframe.
You don't need to construct OHLCV data during paper/live (unless your strategy depends on them)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions