plotter – Strategy plotter

class pyalgotrade.plotter.Subplot
addDataSeries(label, dataSeries)

Adds a DataSeries to the subplot.

Parameters:
class pyalgotrade.plotter.InstrumentSubplot(instrument, plotBuySell)

A Subplot responsible for plotting an instrument.

class pyalgotrade.plotter.StrategyPlotter(strat, plotAllInstruments=True, plotBuySell=True, plotPortfolio=True)

Class responsible for plotting a strategy execution.

Parameters:
  • strat (pyalgotrade.strategy.Strategy.) – The strategy to plot.
  • plotAllInstruments (boolean.) – Set to True to get a subplot for each instrument available.
  • plotBuySell (boolean.) – Set to True to get the buy/sell events plotted for each instrument available.
  • plotPortfolio (boolean.) – Set to True to get the portfolio value (shares + cash) plotted.
getInstrumentSubplot(instrument)

Returns the InstrumentSubplot for a given instrument

Return type:InstrumentSubplot.
getOrCreateSubplot(name)

Returns a Subplot by name. If the subplot doesn’t exist, it gets created.

Parameters:name (string.) – The name of the Subplot to get or create.
Return type:Subplot.
getPortfolioSubplot()

Returns the subplot where the portfolio values get plotted.

Return type:Subplot.
plot(fromDateTime=None, toDateTime=None)

Plots the strategy execution. Must be called after running the strategy.

Parameters:
  • fromDateTime (datetime.datetime) – An optional starting datetime.datetime. Everything before it won’t get plotted.
  • toDateTime (datetime.datetime) – An optional ending datetime.datetime. Everything after it won’t get plotted.

Previous topic

stratanalyzer – Strategy analyzers

Next topic

optimizer – Parallel optimizers

This Page