ConeChartOOS

class qf_lib.plotting.charts.cone_chart_oos.ConeChartOOS(oos_series: QFSeries, is_mean_return: float, is_sigma: float, cone_opacity: float = 0.3, cone_stds: Sequence[float] = (1.0, 2.0), title: str = 'Performance vs. Expectation')[source]

Bases: 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:
  • oos_series (QFSeries) – data to be plotted using ConeChartOOS - only the Out of sample data

  • is_mean_return (float) – mean daily log return of the strategy In Sample

  • is_sigma (float) – std of daily log returns of the strategy In Sample

  • cone_opacity (float) – opacity of the cone

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

  • title (Optional[str]) – title of the plot, by default it is ‘Performance vs. Expectation’

Methods:

apply_data_element_decorators(...)

Plots all DataElementDecorators added to a chart.

plot([figsize])

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: Optional[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.