Point in time
Exabel stores data with point-in-time support, so that you can see what data was available at a specified time. This is especially useful for backtests, as we can then make sure that all the data that is being used as input was actually available at the given time.
Usage
- versioned(date: str, signal)
Evaluate a signal with a specified point in time.
- Parameters
date – the point in time from which we view the data
signal – the signal to be evaluated
For example, to see how a time series has changed over some time period:
versioned('2021-12-01', signal) - versioned('2021-11-01', signal)
- versions(date: str, signal)
Evaluate a signal for the given date for all points in time in the evaluation period.
- Parameters
date – the date to evaluate the signal for
signal – the signal to be evaluated
For example, to see how a time series value for 2021-12-01 has changed over time:
versions('2021-12-01', signal)
- point_in_time(signal: str, relative_days: int = 0)
Evaluates each data point with a point-in-time date equal to the date of the data point, optionally shifted a specified number of days before or after.
Note that currently, the underlying signal needs to be a raw data signal (
graph_signal(...)
) or a KPI prediction (kpi_predictions(...)
). For other signals, including derived signals where some transformation has been applied, the behaviour is undefined (may give an error or may behave in unexpected ways).
- Parameters
signal – the signal to be evaluated (a graph_signal)
relative_days – the number of days to shift the PiT evaluation date by relative to the date of the data point
For example, to retrieve a signal where each data point has the value it had on the day of the data point:
point_in_time(signal)Let’s say there’s a signal with quarterly data, aligned to quarter end, and we want to retrieve the value that this signal had 30 days before the end of the quarter:
point_in_time(signal, relative_days=-30)