CurvePlotWrapper#

class sigtech.framework.strategies.components.curve_plot_wrapper.CurvePlotWrapper

Interface for plotting curves for FuturesContractGroup.

plot_curve_on_dates(dates: list[datetime.date], figsize: Optional[tuple[int, int]] = None, ax: matplotlib.axes._axes.Axes = None, cmap: str = 'Reds', contract_price: bool = False) matplotlib.axes._axes.Axes

Plot prices of all available contracts on each of the provided dates.

Parameters
  • dates – List of dtm.dates to plot prices on.

  • figsize – Optional matplotlib figure size.

  • ax – Optional matplotlib axis if re-using an existing one.

  • cmap – Optional matplotlib cmap or cmap name to use for multiple contracts.

  • contract_price – Plot the price of a contract rather than the quote unit (default).

Returns

The matplotlib axis used for plotting to allow users to alter if required.

plot_end_on_curve_on_dates(dates: list[datetime.date], contract_num: Optional[int] = None, figsize: Optional[tuple[int, int]] = None, ax: Optional[matplotlib.axes._axes.Axes] = None, cmap: Union[str, matplotlib.colors.Colormap] = 'Reds', contract_price: bool = False, **plotting_kwargs) matplotlib.axes._axes.Axes

Plot contract prices on specified dates with dates along the x-axis and prices up the y-axis.

If contract_num is None (default) all available contracts will be plotted for each date (at the same x- value) to visualize the futures curve at that point in time. Otherwise, if contract_num is an int, this method will only plot the price of the specified contract on each date. If contract_num is 0 the nearest contract is plotted, if 1 then the 2nd contract is used etc.

Parameters
  • dates – List of dtm.dates to plot prices on.

  • contract_num – Optional, if specified as an int, only plot the prices for this contract. Used as a zero-based offset from the near contract (0 returns the near contract). If contract_num is negative it is used as the maximum contract number to plot, e.g. if -10 only plot the first ten contracts.

  • figsize – Optional matplotlib figure size.

  • ax – Optional matplotlib axis if re-using an existing one.

  • cmap – Optional matplotlib cmap or cmap name to use for multiple contracts.

  • contract_price – Plot the price of a contract rather than the quote unit (default).

Returns

The matplotlib axis used for plotting to allow users to alter if required.