SpanDecorator

class qf_lib.plotting.decorators.span_decorator.SpanDecorator(shadowed_periods: Sequence[Tuple[datetime.datetime, datetime.datetime]], key: str = None, **plot_settings: Any)[source]

Bases: qf_lib.plotting.decorators.chart_decorator.ChartDecorator, qf_lib.plotting.decorators.simple_legend_item.SimpleLegendItem

Uses a series of periods (tuples containing start date and end date of each period) to draw vertical spans (rectangles).

Parameters
  • shadowed_periods (Sequence[Tuple[datetime, datetime]]) – sequence of tuples, where each tuple indicates a period that should be shadowed Example: [(“2017-01-01”, “2017-02-03”), (“2017-03-05”, “2017-03-10”)]

  • key (str) – see ChartDecorator.key.__init__#key

  • plot_settings – additional plot settings for matplotlib

Methods

decorate(chart)

Modifies the axes object taken from the chart (e.g.

decorate(chart: Chart) → None[source]

Modifies the axes object taken from the chart (e.g. adds legend, draws cone, etc.).