credmark.cmf.model.utils.historical_util.HistoricalUtil
- class HistoricalUtil[source]
Bases:
object
Methods
parse_timerangestr
range_timestamp
Run a model over a series of historical blocks.
Run a model over a series of historical blocks.
to_seconds
to_seconds_unit
Attributes
time_unit_seconds
time_units
- run_model_historical(model_slug, window, model_input=None, interval=None, end_timestamp=None, snap_clock='interval', model_return_type=<class 'dict'>, model_version=None)[source]
Run a model over a series of historical blocks.
- Parameters
model_slug (str) – the slug of the model to run
window (Union[str, List[str]]) – a string defining a time window, ex. “30 day”
interval (Optional[str]) – a string defining a time interval, ex. “1 day”, or list of time intervals to be summed.
model_input (Optional[Union[dict, BaseModel, IntDTO, StrDTO, FloatDTO]]) – input passed to the model being run
model_return_type (Type[DTOCLS]) – the DTO class or dict for the output of the model being run. This will be the type of the BlockSeriesRow.output
- Return type
BlockSeries[TypeVar]
- run_model_historical_blocks(model_slug, window, interval, model_input=None, end_block=None, snap_block=None, model_return_type=<class 'dict'>, model_version=None)[source]
Run a model over a series of historical blocks.
- Parameters
model_slug (str) – the slug of the model to run
window (int) – number of blocks
interval (int) – number of blocks for each interval
model_input (Optional[Union[dict, BaseModel, IntDTO, StrDTO, FloatDTO]]) – input passed to the model being run
model_return_type (Type[DTOCLS]) – the DTO class or dict for the output of the model being run. This will be the type of the BlockSeriesRow.output
- Return type
BlockSeries[TypeVar]