Traders

Trader

class lumibot.traders.trader.Trader(logfile='', backtest=False, debug=False, strategies=None, quiet_logs=False)

Bases: object

add_strategy(strategy)

Adds a strategy to the trader

property is_backtest_broker
run_all(async_=False, show_plot=True, show_tearsheet=True, save_tearsheet=True, show_indicators=True, plot_file_html=None, trades_file=None, trade_events_file=None, settings_file=None, indicators_file=None, tearsheet_csv_file=None, tearsheet_file=None, tearsheet_metrics_file=None, base_filename=None)

run all strategies

Parameters:
  • async (bool) – Whether to run the strategies asynchronously or not. This is not implemented yet.

  • show_plot (bool) – Whether to disply the plot in the user’s web browser. This is only used for backtesting.

  • show_tearsheet (bool) – Whether to display the tearsheet in user’s web browser. This is only used for backtesting.

  • save_tearsheet (bool) – Whether to save the tearsheet or not. This is only used for backtesting.

  • show_indicators (bool) – Whether to display the indicators (markers and lines) in the user’s web browser. This is only used for backtesting.

  • plot_file_html (str) – The path to save the trades plot HTML. This is only used for backtesting.

  • trades_file (str) – The path to save the simplified trades CSV/parquet artifact. This is only used for backtesting.

  • trade_events_file (str) – The path to save the full trade-events CSV/parquet artifact. This is only used for backtesting.

  • settings_file (str) – The path to save backtest settings JSON. This is only used for backtesting.

  • indicators_file (str) – The path to save indicators HTML. This is only used for backtesting.

  • tearsheet_csv_file (str) – The path to save tearsheet CSV. This is only used for backtesting.

  • tearsheet_file (str) – The path to save the tearsheet. This is only used for backtesting.

  • tearsheet_metrics_file (str) – The path to save machine-readable tearsheet summary metrics JSON. This is only used for backtesting.

  • base_filename (str) – The base filename to save the tearsheet, plot, indicators, etc. This is only used for backtesting.

Returns:

A dictionary with the keys being the strategy names and the values being the strategy analysis.

Return type:

dict

run_all_async()

run all strategies

stop_all()