Skip to main content
Version: Python

TableReplayer

TableReplayer is used to replay historical data with timestamps in a new, in-memory table.

Syntax

TableReplayer(startTime, endTime)

Parameters

ParameterTypeDescription
startTimeDateTime

Historical data start time

endTimeDateTime

Historical data end time.

Returns

A Replayer object that can be used to replay historical data.

Methods

TableReplayer supports the following methods:

  • add_table() - Registers a table for replaying and returns the associated replay table.
  • replay() - Prepares a historical table for replaying.
  • start() - Starts replaying data.
  • shutdown() - Shuts the replayer down.

Example

The following example creates some fake historical data with timestamps and then replays it.

from deephaven import new_table
from deephaven.column import datetime_col, int_col
from deephaven.replay import TableReplayer
from deephaven.time import to_datetime

import jpy

result = new_table([
datetime_col("DateTime", [to_datetime("2000-01-01T00:00:01 NY"), to_datetime("2000-01-01T00:00:03 NY"), to_datetime("2000-01-01T00:00:06 NY")]),
int_col("Number", [1, 3, 6])
])

start_time = to_datetime("2000-01-01T00:00:00 NY")
end_time = to_datetime("2000-01-01T00:00:07 NY")

result_replayer = TableReplayer(start_time, end_time)

replayed_result = result_replayer.add_table(result, "DateTime")

result_replayer.start()