API Reference

lean report


Generate a report of a backtest.

$ lean report [options]


Runs the LEAN Report Creator in a Docker container using the quantconnect/lean Docker image. By default, this command generates a report of the most recent backtest. This behavior can be overridden by using --backtest-results <path> and providing the path to the backtest results JSON file. If --live-results <path> is also given the generated report will contain both the backtest and the live results.

The --strategy-name, --strategy-version, and --strategy-description options can be used to set the name, version, and description that are shown in the report. The name and version are shown in the top-right corner of each page, while the description is shown on the top of the first page. These fields are blank by default.

When the given backtest results is stored in a project directory or one of its subdirectories, the default name is the name of the project directory and the default description is the description in the project's config.json file.

By default, the official LEAN engine image is used. You can override this using the --image <value> option. Alternatively, you can set the default engine image for all commands using lean config set engine-image <value>. The image is pulled before running the report creator if it doesn't exist locally yet or if you pass the --update flag.


The lean report command supports the following options:

--backtest-results <path>The path to the JSON file containing the backtest results. Defaults to the most recent backtest results file in the current working directory or one of its subdirectories.
--live-results <path>The path to the JSON file containing the live trading results.
--report-destination <path>The path where the generated report is stored as HTML (defaults to ./report.html).
--detach, -dRun the report creator in a detached Docker container and return immediately. The name of the Docker container is shown before the command ends. You can use Docker's own commands to manage the detached container.
--strategy-name <value>The name of the strategy, will appear at the top-right corner of each page.
--strategy-version <value>The version of the strategy, will appear next to the project name.
--strategy-description <value>The description of the strategy, will appear under the "Strategy Description" section on the first page of the report.
--overwriteOverwrite the given --report-destination if it already contains a file.
--image <value>The LEAN engine image to use (defaults to quantconnect/lean:latest).
--updatePull the LEAN engine image before running the report creator.
--lean-config <path>The Lean configuration file that should be used (defaults to the nearest lean.json file).
--verboseEnable debug logging.
--helpDisplay the help text of the lean report command and exit.

You can also see our Videos. You can also get in touch with us via Chat.

Did you find this page helpful?

Contribute to the documentation: