SignalsPlotter

class qf_lib.analysis.signals_analysis.signals_plotter.SignalsPlotter(**kwargs)[source]

Bases: qf_lib.analysis.common.abstract_document.AbstractDocument

Generates a document with candlestick charts for each given ticker and highlights the background to indicate at which time a position has been opened. LONG positions are highlighted green, SHORT positions are highlighted red.

The plots can be generated either: - to show exact dates when LONG / SHORT entry signals were generated (only_entry_signals = True) - to show when LONG / SHORT position should be opened and closed, based on the signals generated by alpha models (only_entry_signals = False).

Parameters
  • tickers (Ticker, Sequence[Ticker]) – tickers for which the prices will be plotted. The list can also contain FutureTickers - in this case the prices presented in the form of the candlestick chart, will be built using the FuturesChain object (without any backward adjustment).

  • start_date (datetime) – starting date of the prices data frame

  • end_date (datetime) – last date of the prices data frame

  • data_handler (DataHandler) – data handler used to download prices

  • alpha_models (AlphaModel, Sequence[AlphaModel]) – instances of alpha models which signals will be evaluated. Each plot in the document is described using the alpha_models __str__ function.

  • settings (Settings) – settings used to connect to db

  • pdf_exporter (PDFExporter) – pdf exporter

  • only_entry_signals (bool) – if set to True only the entry signals are highlighted, if set to False - all the hold timeperiod is highlighted

  • title (str) – title of the document