Skip to main content

plot_allocation

plot_allocation(
    data: vectorbtpro.data.base.Data,
    signals: ~Signals,
    fig: vectorbtpro.utils.figure.FigureWidget = None,
)
Plot asset allocation based on trading signals. Parameters:
NameTypeDefaultDescription
datavbt.Data--Data object containing asset prices.
signalsSignalsT--Object containing trading signals.
figvbt.FigureWidgetNoneExisting figure to update. Defaults to None.
Returns:
TypeDescription
vbt.FigureWidgetFigure containing the allocation plot.

plot_signal_crossover

plot_signal_crossover(
    model_output: pandas.core.series.Series,
    upper_crossed: pandas.core.series.Series,
    lower_crossed: pandas.core.series.Series,
    upper: float,
    lower: float,
) ‑> vectorbtpro.utils.figure.FigureWidget
Plot signal crossover points with upper and lower bounds. Parameters:
NameTypeDefaultDescription
model_outputpd.Series--Model output series.
upper_crossedpd.Series--Series indicating upper boundary crossovers.
lower_crossedpd.Series--Series indicating lower boundary crossovers.
upperfloat--Upper threshold value.
lowerfloat--Lower threshold value.
Returns:
TypeDescription
vbt.FigureWidgetFigure containing the crossover plot.

plot_signal_vlines

plot_signal_vlines(
    df: pandas.core.frame.DataFrame,
    symbol: str,
    signals: ~Signals,
    **plot_kwargs,
) ‑> vectorbtpro.utils.figure.FigureWidget
Plot long and short entry signals as vertical lines. Parameters:
NameTypeDefaultDescription
dfpd.DataFrame--Dataframe containing price data.
symbolstr--Symbol for which to plot signals.
signalsSignals--Signal object containing entry points.
plot_kwargstp.Kwargs--Additional keyword arguments for plotting.
Returns:
TypeDescription
vbt.FigureWidgetA figure with entry signals plotted as vertical lines.

plot_performance_matrix

plot_performance_matrix(
    pf: Any,
    **plot_kwargs,
) ‑> vectorbtpro.utils.figure.FigureWidget
Create a performance matrix heatmap. This function generates a heatmap of performance metrics for the given portfolio by resampling returns data to a monthly frequency. The matrix displays monthly returns by year, with an additional column for the total annual return. Parameters:
NameTypeDefaultDescription
pftp.Any--The portfolio object containing return data.
plot_kwargstp.Kwargs--Additional keyword arguments passed to the heatmap function.
Returns:
TypeDescription
vbt.FigureWidgetA Plotly FigureWidget containing the performance matrix heatmap.
Examples:
>>> pf = ...  # Initialize your portfolio object
>>> fig = plot_performance_matrix(pf)
>>> fig.show()

plot_smas

plot_smas(
    close: pandas.core.frame.DataFrame,
    timeperiods: list = None,
    length: int = None,
    **plot_kwargs,
) ‑> vectorbtpro.utils.figure.FigureWidget
Plot Simple Moving Averages (SMAs). This function calculates and plots SMAs for the specified time periods. Parameters:
NameTypeDefaultDescription
closepd.DataFrame--DataFrame containing closing prices.
timeperiodslist, optional--List of time periods for SMAs. Defaults to [20, 50, 100, 200].
lengthint, optional--Number of data points to include in the plot. Defaults to None (all data).
plot_kwargstp.Kwargs--Additional keyword arguments for customizing the plot.
Returns:
TypeDescription
vbt.FigureWidgetA Plotly FigureWidget containing the SMA plots.

plot_bbands

plot_bbands(
    close: pandas.core.frame.DataFrame,
    length: int = None,
    **plot_kwargs,
) ‑> vectorbtpro.utils.figure.FigureWidget
Plot Bollinger Bands. This function calculates and plots Bollinger Bands for the given data. Parameters:
NameTypeDefaultDescription
closepd.DataFrame--DataFrame containing closing prices.
lengthintNoneNumber of data points to include in the plot. Defaults to None (all data).
plot_kwargstp.Kwargs--Additional keyword arguments for customizing the plot.
Returns:
TypeDescription
vbt.FigureWidgetA Plotly FigureWidget containing the Bollinger Bands plot.

plot_slope_range

plot_slope_range(
    close: pandas.core.frame.DataFrame,
    window: int = 50,
    length: int = None,
    **plot_kwargs,
) ‑> vectorbtpro.utils.figure.FigureWidget
Plot slope ranges for a moving average. This function identifies and visualizes steep slopes in a moving average. Parameters:
NameTypeDefaultDescription
closepd.DataFrame--DataFrame containing closing prices.
windowint50Window size for the moving average. Defaults to 50.
lengthintNoneNumber of data points to include in the plot. Defaults to None (all data).
plot_kwargstp.Kwargs--Additional keyword arguments for customizing the plot.
Returns:
TypeDescription
vbt.FigureWidgetA Plotly FigureWidget containing the slope range plot.

plot_pattern

plot_pattern(
    close: pandas.core.frame.DataFrame,
    pattern: Union(annotations=(<class 'vectorbtpro.utils.params.Param'><class 'list'>), resolved=True= None,
    window: int = 50,
    max_window: int = 120,
    min_similarity: float = 0.8,
    length: int = None,
    **plot_kwargs,
) ‑> vectorbtpro.utils.figure.FigureWidget
Plot pattern matches in price data. This function identifies and visualizes occurrences of a specified pattern in the price data. Parameters:
NameTypeDefaultDescription
closepd.DataFrame--DataFrame containing closing prices.
patternlist--or vbt.Param, default None Pattern to search for. Defaults None.
windowint50Minimum window size for pattern matching. Defaults to 50.
max_windowint120Maximum window size for pattern matching. Defaults to 120.
min_similarityfloat0.8Minimum similarity threshold for pattern matching. Defaults to 0.8.
lengthintNoneNumber of data points to include in the plot. Defaults to None (all data).
plot_kwargstp.Kwargs--Additional keyword arguments for customizing the plot.
Returns:
TypeDescription
vbt.FigureWidgetA Plotly FigureWidget containing the pattern match plot.

RegressionLine

RegressionLine(
    data: pandas.core.frame.DataFrame | numpy.ndarray = None,
    x_labels: Sequence[Hashable] = None,
    trace_names: str | Sequence[str | None| None = None,
    trace_kwargs: Dict[str, Any] | Sequence[Dict[str, Any] | None| None = None,
    add_trace_kwargs: Dict[str, Any] | None = None,
    make_figure_kwargs: Dict[str, Any] | None = None,
    fig: plotly.basedatatypes.BaseFigure = None,
    use_gl: bool = None,
    **layout_kwargs,
)
Create a regression line plot. Inherites from vbt.Scatter. Parameters:
NameTypeDefaultDescription
datapd.DataFrame--Data in any format that can be converted to NumPy. Must be of shape (x_labels, trace_names).
x_labelstp.LabelsNoneLabels for the x-axis. Must be of shape (data.shape[0],).
trace_namestp.TraceNamesNoneTrace names, corresponding to columns in pandas. Must be of shape (data.shape[1],).
trace_kwargstp.KwargsLikeSequenceNoneKeyword arguments passed to plotly.graph_objects.Scatter. Can be specified per trace as a sequence of dicts.
add_trace_kwargstp.KwargsLikeNoneKeyword arguments passed to add_trace.
make_figure_kwargstp.KwargsLikeNoneKeyword arguments passed to vectorbtpro.utils.figure.make_figure.
figtp.BaseFigureNoneFigure to add traces to.
use_glboolNoneWhether to use WebGL for rendering. If None, it will be set to True if the data is large enough, otherwise False.
layout_kwargstp.Kwargs--Keyword arguments for layout.

Ancestors

  • vectorbtpro.generic.plotting.Scatter
  • vectorbtpro.generic.plotting.TraceType
  • vectorbtpro.utils.config.Configured
  • vectorbtpro.utils.config.HasSettings
  • vectorbtpro.utils.caching.Cacheable
  • vectorbtpro.utils.checks.Comparable
  • vectorbtpro.utils.pickling.Pickleable
  • vectorbtpro.utils.formatting.Prettified
  • vectorbtpro.utils.chaining.Chainable
  • vectorbtpro.generic.plotting.TraceUpdater
  • vectorbtpro.utils.base.Base

TargetPortfolio

TargetPortfolio(
    data: pandas.core.series.Series = None,
    trace_names: str | Sequence[str | None| None = None,
    trace_kwargs: Dict[str, Any] | Sequence[Dict[str, Any] | None| None = None,
    add_trace_kwargs: Dict[str, Any] | None = None,
    make_figure_kwargs: Dict[str, Any] | None = None,
    fig: plotly.basedatatypes.BaseFigure = None,
    use_gl: bool = None,
    **layout_kwargs,
)
Create a target portfolio plot. Inherites from vbt.Scatter. Parameters:
NameTypeDefaultDescription
datapd.SeriesNoneData in any format that can be converted to pandas Series. Must be of shape (trace_names,).
trace_namestp.TraceNamesNoneTrace names, corresponding to columns in pandas. Must be of shape (data.shape[0],).
trace_kwargstp.KwargsLikeSequenceNoneKeyword arguments passed to plotly.graph_objects.Scatter. Can be specified per trace as a sequence of dicts.
add_trace_kwargstp.KwargsLikeNoneKeyword arguments passed to add_trace.
make_figure_kwargstp.KwargsLikeNoneKeyword arguments passed to vectorbtpro.utils.figure.make_figure.
figtp.BaseFigureNoneFigure to add traces to.
use_glboolNoneWhether to use WebGL for rendering. If None, it will be set to True if the data is large enough, otherwise False.
layout_kwargstp.Kwargs--Keyword arguments for layout.

Ancestors

  • vectorbtpro.generic.plotting.Scatter
  • vectorbtpro.generic.plotting.TraceType
  • vectorbtpro.utils.config.Configured
  • vectorbtpro.utils.config.HasSettings
  • vectorbtpro.utils.caching.Cacheable
  • vectorbtpro.utils.checks.Comparable
  • vectorbtpro.utils.pickling.Pickleable
  • vectorbtpro.utils.formatting.Prettified
  • vectorbtpro.utils.chaining.Chainable
  • vectorbtpro.generic.plotting.TraceUpdater
  • vectorbtpro.utils.base.Base

Frontier

Frontier(
    data: pandas.core.series.Series = None,
    trace_names: str | Sequence[str | None| None = None,
    trace_kwargs: Dict[str, Any] | Sequence[Dict[str, Any] | None| None = None,
    add_trace_kwargs: Dict[str, Any] | None = None,
    make_figure_kwargs: Dict[str, Any] | None = None,
    fig: plotly.basedatatypes.BaseFigure = None,
    use_gl: bool = None,
    **layout_kwargs,
)
Create a frontier plot. Inherits from vbt.Scatter. Parameters:
NameTypeDefaultDescription
datapd.SeriesNoneData in any format that can be converted to pandas Series. Must be of shape (trace_names,).
trace_namestp.TraceNamesNoneTrace names, corresponding to columns in pandas. Must be of shape (data.shape[0],).
trace_kwargstp.KwargsLikeSequenceNoneKeyword arguments passed to plotly.graph_objects.Scatter. Can be specified per trace as a sequence of dicts.
add_trace_kwargstp.KwargsLikeNoneKeyword arguments passed to add_trace.
make_figure_kwargstp.KwargsLikeNoneKeyword arguments passed to vectorbtpro.utils.figure.make_figure.
figtp.BaseFigureNoneFigure to add traces to.
use_glboolNoneWhether to use WebGL for rendering. If None, it will be set to True if the data is large enough, otherwise False.
layout_kwargstp.Kwargs--Keyword arguments for layout.

Ancestors

  • vectorbtpro.generic.plotting.Scatter
  • vectorbtpro.generic.plotting.TraceType
  • vectorbtpro.utils.config.Configured
  • vectorbtpro.utils.config.HasSettings
  • vectorbtpro.utils.caching.Cacheable
  • vectorbtpro.utils.checks.Comparable
  • vectorbtpro.utils.pickling.Pickleable
  • vectorbtpro.utils.formatting.Prettified
  • vectorbtpro.utils.chaining.Chainable
  • vectorbtpro.generic.plotting.TraceUpdater
  • vectorbtpro.utils.base.Base

Pie

Pie(
    data: pandas.core.frame.DataFrame | numpy.ndarray = None,
    rp_kwargs: Dict[str, Any] = None,
    trace_names: str | Sequence[str | None| None = None,
    trace_kwargs: Dict[str, Any] | Sequence[Dict[str, Any] | None| None = None,
    add_trace_kwargs: Dict[str, Any] | None = None,
    make_figure_kwargs: Dict[str, Any] | None = None,
    fig: plotly.basedatatypes.BaseFigure = None,
    **layout_kwargs,
)
Create a bar plot. Inherits from vbt.Configured and vbt.TraceUpdater. Parameters:
NameTypeDefaultDescription
datatp.ArrayNoneData in any format that can be converted to NumPy. Must be of shape (trace_names).
rp_kwargstp.KwargsNoneKeyword arguments for vectorbtpro.portfolio.utils.rp. If data is not None, it will be used to compute the portfolio. If data is None, it will be used to compute the portfolio from trace_names.
trace_namestp.TraceNamesNoneTrace names, corresponding to columns in pandas. Must be of shape (data.shape[0],) if data is not None. If data is None, it must be of shape (trace_names,). If trace_names is a string, it will be used as the name for all traces.
trace_kwargstp.KwargsLikeSequenceNoneKeyword arguments passed to plotly.graph_objects.Pie. Can be specified per trace as a sequence of dicts. If data is not None, it will be used to compute the portfolio. If data is None, it will be used to compute the portfolio from trace_names.
add_trace_kwargstp.KwargsLikeNoneKeyword arguments passed to add_trace. If data is not None, it will be used to compute the portfolio. If data is None, it will be used to compute the portfolio from trace_names.
make_figure_kwargstp.KwargsLikeNoneKeyword arguments passed to vectorbtpro.utils.figure.make_figure. If data is not None, it will be used to compute the portfolio. If data is None, it will be used to compute the portfolio from trace_names.
figtp.BaseFigureNoneFigure to add traces to. If None, a new figure will be created. If data is not None, it will be used to compute the portfolio. If data is None, it will be used to compute the portfolio from trace_names.
layout_kwargstp.KwargsNoneKeyword arguments for layout. If data is not None, it will be used to compute the portfolio. If data is None, it will be used to compute the portfolio from trace_names.
Examples:
>>> import numpy as np
>>> import systematica as sma
>>> pie = sma.Pie(
...     data=np.array([0.06, 0.02, 0.05, 0.09]),
...     trace_names=['SPY', 'TLT', 'XLF', 'XLE'],
... )
>>> pie.fig.show()

Ancestors

  • vectorbtpro.utils.config.Configured
  • vectorbtpro.utils.config.HasSettings
  • vectorbtpro.utils.caching.Cacheable
  • vectorbtpro.utils.checks.Comparable
  • vectorbtpro.utils.pickling.Pickleable
  • vectorbtpro.utils.formatting.Prettified
  • vectorbtpro.utils.chaining.Chainable
  • vectorbtpro.generic.plotting.TraceUpdater
  • vectorbtpro.utils.base.Base

Static methods

update_trace

update_trace(
    trace: plotly.basedatatypes.BaseTraceType,
    data: numpy.ndarray,
)
Update the trace with new data. Parameters:
NameTypeDefaultDescription
traceBaseTraceType--Trace to update.
datatp.Array1d--Data in any format that can be converted to NumPy. Must be of shape (trace_names,).

Methods

update

update(
    self,
    data: numpy.ndarray,
)
Update the plot with new data. Parameters:
NameTypeDefaultDescription
datatp.ArrayLike--Data in any format that can be converted to NumPy. Must be of shape (trace_names,).