hftbacktest.data.utils.snapshot module

create_last_snapshot(data, tick_size, lot_size, initial_snapshot=None, output_snapshot_filename=None)[source]

Creates a snapshot of the last market depth for the specified data, which can be used as the initial snapshot data for subsequent data.

Parameters:
  • data (List[str]) – Data to be processed to obtain the last market depth snapshot.

  • tick_size (float) – Minimum price increment for the given asset.

  • lot_size (float) – Minimum order quantity for the given asset.

  • initial_snapshot (str | None) – The initial market depth snapshot.

  • output_snapshot_filename (str | None) – If provided, the snapshot data will be saved to the specified filename in npz format.

Returns:

Snapshot of the last market depth compatible with HftBacktest.

Return type:

ndarray[Any, dtype[_ScalarType_co]]