API Reference

lean research


Run a Jupyter Lab environment locally using Docker.

$ lean research <project> [options]


Runs a local Jupyter Lab environment in a Docker container using the quantconnect/research Docker image. The project directory is mounted in the Docker container and the Jupyter Lab instance is exposed on a local port. After the Jupyter Lab instance has started the browser is automatically opened.

By default, Jupyter Lab is exposed on port 8888. To use a custom port you can use the --port option, which is required to run two Jupyter Lab instances side-by-side.

You can use the --data-provider option to change where data is retrieved from. This option updates the Lean configuration file, so you don't need to use this option multiple times for the same data provider if you are not switching between them. Additionally, you can also use the --download-data flag as an alias for --data-provider QuantConnect, and the --data-purchase-limit option to set the maximum amount of QCC to spend during the research session when using QuantConnect as data provider. The --data-purchase-limit option is not persistent.

If you have previously logged in using lean login the CLI automatically makes your credentials available in the Jupyter Lab instance. If this happens the api variable is automatically assigned an instance of Api in your research notebooks which you can use to make authenticated requests to the QuantConnect API.

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


The lean research command expects the following arguments:

<project>The path to the project directory to run a research environment for.


The lean research command supports the following options:

--port <value>The port to run Jupyter Lab on (defaults to 8888).
--data-provider <value>Update the Lean configuration file to retrieve data from the given provider, which must be Local, QuantConnect, or Terminal Link.
--download-dataUpdate the Lean configuration file to download data from the QuantConnect API, alias for --data-provider QuantConnect.
--data-purchase-limit <value>The maximum amount of QCC to spend on downloading data during the research session when using QuantConnect as data provider.
--detach, -dRun Jupyter Lab 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.
--no-openDon't open the Jupyter Lab environment in the browser after starting it.
--image <value>The LEAN research image to use (defaults to quantconnect/research:latest).
--updatePull the LEAN research image before starting the research environment.
--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 research 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: