API Reference

lean report

Introduction

Generate a report of a backtest.

$ lean report [OPTIONS]

Description

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 are 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.

To view the content of the default reports, see Reports. To create custom reports, see Generate Reports.

Options

The lean report command supports the following options:

OptionDescription
--backtest-results <file>Path to the JSON file containing the backtest results
--live-results <file>Path to the JSON file containing the live trading results
--report-destination <file>Path where the generated report is stored as HTML (defaults to ./report.html)
--css <file>Path where the CSS override file is stored
--html <file>Path where the custom HTML template file is stored
-d, --detachRun the report creator in a detached Docker container and return immediately
--strategy-name <string>Name of the strategy, will appear at the top-right corner of each page
--strategy-version <string>Version number of the strategy, will appear next to the project name
--strategy-description <string>Description of the strategy, will appear under the 'Strategy Description' section
--overwriteOverwrite --report-destination if it already contains a file
--image <string>The LEAN engine image to use (defaults to quantconnect/lean:latest)
--updatePull the LEAN engine image before running the report creator
--pdfCreate a PDF version along with the HTML version of the report
--lean-config <file>The Lean configuration file that should be used (defaults to the nearest lean.json)
--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 Discord.

Did you find this page helpful?

Contribute to the documentation: