ConeChart

class qf_lib.plotting.charts.cone_chart.ConeChart(data: qf_lib.containers.series.qf_series.QFSeries, nr_of_data_points: int, is_end_date: datetime.datetime, cone_opacity: float = 0.3, cone_stds: Sequence[float] = 1.0, 2.0)[source]

Bases: qf_lib.plotting.charts.chart.Chart

Plots a cone chart.

While using a simple cone (e.g. LineChart with Cone decorator) the results of the evaluation may be very different depending on the live_start_date. To be immune to this, ConeChart plots only the ends of simple cones which start at 1 periods, 2 periods, …, n periods before the end of the backtested series. The period length depends on the frequency of the data provided for the chart. If it has daily frequency, then the length of one period will be 1 day.

Parameters
  • data (QFSeries) – data to be plotted using ConeChart

  • nr_of_data_points (int) – number of data points for which the cone is evaluated

  • is_end_date (datetime) – date fixing the end of the In-Sample period

  • cone_opacity (float) – opacity of the cone

  • cone_stds (Sequence[float]) – list/tuple of different standard deviations for which cones should be drawn

Methods

apply_data_element_decorators(…)

Plots all DataElementDecorators added to a chart.

plot(figsize, float] = None)

Plots the chart.

apply_data_element_decorators(data_element_decorators: List[DataElementDecorator])[source]

Plots all DataElementDecorators added to a chart. This function should set legend_artist field in each plotted DataElementDecorator (if applicable).

Parameters

data_element_decorators (List[DataElementDecorator]) – non-empty list of DataElementDecorators that should be plotted on the chart

plot(figsize: Tuple[float, float] = None)[source]

Plots the chart. The underlying figure stays hidden until the show() method is called.

Parameters

figsize (Tuple[float, float]) – The figure size to draw the chart at in inches. This is a tuple of (width, height) passed directly to matplotlib’s plot function. The values are expressed in inches.