SignalsPlotter

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

Bases: 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.

For signal_frequency == Frequency.DAILY, Signals will be calculated every day at midnight. For signal_frequency higher than Frequency.DAILY, Signals will be calculated every day between market open and market close time. In both cases it is required to define trigger time of market open and close before using the SignalsPlotter.

MarketOpenEvent.set_trigger_time({“hour”: XX, “minute”: XX, “second”: 0, “microsecond”: 0}) MarketCloseEvent.set_trigger_time({“hour”: XX, “minute”: XX, “second”: 0, “microsecond”: 0})

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

  • title (str) – title of the document

  • signal_frequency (Frequency) – frequency of exposure generation

  • data_frequency (Frequency) – frequency of data (price bars) delivered by data provider