quantlib.plot package
Submodules
quantlib.plot.bar module
- class quantlib.plot.bar.BarPlot(history: BarHistory, plot_index: bool, start_idx: int = None, end_idx: int = None)
Bases:
objectA Plot utility for plotting bars and lines on a candlestick chart Method chaining pattern is used to allow chaining of plot methods
>>> plot = BarPlot(history, plot_index,self.start_plot_idx, self.end_plot_idx) >>> plot.plot_bars().plot_line( >>> line=resistance, name="Resistance" >>> ).plot_line( >>> line=support, name="Support" >>> ).plot_vertical( >>> history.bars[first_considered_bar_idx], line_color='lime' >>> ).plot_vertical( >>> history.bars[current_bar_idx], line_color='red' >>> )
- plot_bars() BarPlot
Generate a candlestick plot of the bars in the history
- Returns:
self
- Return type:
- plot_line(line: Line | None, name: str | None = None) BarPlot
Plot a single extended line on the current plot
- plot_scatter(xs: Iterable[float | datetime], ys: ndarray | Iterable[float], name: str | None = None) BarPlot
Used to plot lines on the candlestick chart
- Parameters:
xs (Iterable[float | datetime]) – x coordinates of the points
ys (np.ndarray | Iterable[float]) – y coordinates of the points (price)
name (str | None, optional) – line label, defaults to None
- Returns:
self
- Return type:
- plot_vertical(bar: Bar, line_color: str = 'black', line_style: str = 'solid') BarPlot
Plot vertical line on the current plot, we use these vertical lines to mark range of bars considered
- show()