create_event_comparison_chart

qf_lib.plotting.helpers.create_event_comparison_chart.create_event_comparison_chart(series: qf_lib.containers.series.qf_series.QFSeries, event_dates_list: Iterable[datetime.datetime], title: str, samples_before: int = 100, samples_after: int = 200, rebase_method: qf_lib.common.enums.rebase_method.RebaseMethod = <RebaseMethod.divide: 1>)qf_lib.plotting.charts.line_chart.LineChart[source]

Creates a new chart based on a line chart. The chart puts all events at date = 0 and than compares the evolution of the series after the event date.

Parameters
  • series (QFSeries) – Series usually with values of an index or level of interest rates

  • event_dates_list (Iterable[datetime]) – A list specifying the dates of the events that we would like to compare. Each date will create a new series in the chart

  • title (str) – The title of the graph, specify None if you don’t want the chart to show a title.

  • samples_before (int) – Number of samples shown on the chart that are before the event date

  • samples_after (int) – Number of samples after the event date that are plotted on the chart

  • rebase_method (RebaseMethod) –

    Specifies the way in which the data is normalised at the date of the event.

    • ’divide’ - will divide all the values by the value at the date of the event

    • ’subtract’ - will subtract the value at the event from the whole sample

    • ’none - will show the value as is (no rebasing).

Returns

The constructed LineChart.

Return type

LineChart