create_rolling_chart

qf_lib.plotting.helpers.create_rolling_chart.create_rolling_chart(series: Union[QFSeries, List[QFSeries]], func: Callable[[Union[QFSeries, ndarray]], float], func_name: str, window_size: int = 126, step: int = 20, oos_date: Optional[str] = None) LineChart[source]

Creates a new line chart and adds the rolling window for each of the specified series to it. The func function is fed data for each window and whatever it returns is added to the resulting rolled series.

For example:

Parameters:
  • series (QFSeries, List[QFSeries]) – One or more series to apply the rolling window transformation on add to the resulting chart.

  • func (Callable[[Union[QFSeries, numpy.ndarray]], float]) – Called for each window. Takes one argument which is part of a series corresponding to a window. Returns a float.

  • func_name (str) – Used in the title to specify the function that was called.

  • window_size (int) –

  • step (int) –

  • oos_date (str) – only the OOS date of the first series in the list will be taken into account

Return type:

LineChart