hftbacktest.data.utils.tardis module
- convert(input_files, output_filename=None, buffer_size=100000000, ss_buffer_size=10000, base_latency=0, method='separate', snapshot_mode='process')[source]
Converts Tardis.dev data files into a format compatible with HftBacktest.
- Parameters:
input_files (List[str]) – Input filenames for both incremental book and trades files, e.g. [‘incremental_book.csv’, ‘trades.csv’].
output_filename (str | None) – If provided, the converted data will be saved to the specified filename in
npzformat.buffer_size (int) – Sets a preallocated row size for the buffer.
base_latency (float) – The value to be added to the feed latency. See
correct_local_timestamp().method (Literal['separate', 'adjust']) – The method to correct reversed exchange timestamp events. See
validation.correct().snapshot_mode (Literal['process', 'ignore_sod', 'ignore']) –
If this is set to ‘ignore’, all snapshots are ignored. The order book will converge to a complete order book over time.
If this is set to ‘ignore_sod’, the SOD (Start of Day) snapshot is ignored. Since Tardis intentionally adds the SOD snapshot, not due to a message ID gap or disconnection, there might not be a need to process SOD snapshot to build a complete order book. Please see https://docs.tardis.dev/historical-data-details#collected-order-book-data-details for more details.
Otherwise, all snapshot events will be processed.
ss_buffer_size (int) –
- Returns:
Converted data compatible with HftBacktest.
- Return type: