DynaPlotBackTest

Defined in fynance.backtest

class DynaPlotBackTest(fig=None, ax=None, size=(9, 6), **kwargs)[source]

Bases: PlotBackTest

Dynamic plot backtest object.

Subclass of PlotBackTest configured for interactive updates: plt.ion() is enabled so that the figure refreshes on every call to plot. Includes default styling for train / eval / test curves and a compact legend, suitable for monitoring walk-forward training in real time alongside fynance.models.rolling._RollingBasis.

Attributes:
figmatplotlib.figure.Figure

Figure to display backtest.

axmatplotlib.axes

Axe(s) to display a part of backtest.

Methods

plot(y, x=None, label=None, color=’Blues’, lw=1., **kwargs)

Plot performances.

See also

PlotBackTest, display_perf, set_text_stats
clear()[source]

Clear axes.

plot(y, x=None, names=None, col='Blues', lw=1., unit='raw', **kwargs)

Plot performances.

Parameters:
ynp.ndarray[np.float64, ndim=2], with shape (T, N)

Returns or indexes.

xnp.ndarray[ndim=2], with shape (T, 1), optional

x-axis, can be series of int or dates or string.

namesstr, optional

Names y lines for legend.

colstr, optional

Color of palette, cf seaborn documentation [2]. Default is ‘Blues’.

lwfloat, optional

Line width of lines.

kwargsdict, optional

Parameters for ax.legend method, cf matplotlib documentation [3].

Returns:
pbtPlotBackTest

Self object.

References

set_axes(**kwargs)[source]

Set axes with initial parameters.

Parameters:
**kwargskeyword arguments, optioanl

Axes configuration, cf matplotlib documentation [1]. By default, parameters specified in __init__ method are used.

References