optimizer – Parallel optimizers

class pyalgotrade.optimizer.server.Results(parameters, result)

The results of the strategy executions.

getParameters()

Returns a sequence of parameter values.

getResult()

Returns the result for a given set of parameters.

pyalgotrade.optimizer.server.serve(barFeed, strategyParameters, address, port)

Executes a server that will provide bars and strategy parameters for workers to use.

Parameters:
  • barFeed (pyalgotrade.barfeed.BarFeed.) – The bar feed that each worker will use to backtest the strategy.
  • strategyParameters – The set of parameters to use for backtesting. An iterable object where each element is a tuple that holds parameter values.
  • address (string.) – The address to listen for incoming worker connections.
  • port (int.) – The port to listen for incoming worker connections.
Return type:

A Results instance with the best results found.

pyalgotrade.optimizer.worker.run(strategyClass, address, port, workerCount=None)

Executes one or more worker processes that will run a strategy with the bars and parameters supplied by the server.

Parameters:
  • strategyClass – The strategy class.
  • address (string.) – The address of the server.
  • port (int.) – The port where the server is listening for incoming connections.
  • workerCount (int.) – The number of worker processes to run. If None then as many workers as CPUs are used.
pyalgotrade.optimizer.local.run(strategyClass, barFeed, strategyParameters, workerCount=None)

Executes many instances of a strategy in parallel and finds the parameters that yield the best results.

Parameters:
  • strategyClass – The strategy class.
  • barFeed (pyalgotrade.barfeed.BarFeed.) – The bar feed to use to backtest the strategy.
  • strategyParameters – The set of parameters to use for backtesting. An iterable object where each element is a tuple that holds parameter values.
  • workerCount (int.) – The number of strategies to run in parallel. If None then as many workers as CPUs are used.

Previous topic

plotter – Strategy plotter

Next topic

marketsession – Market sessions

This Page