API Reference
lean research
Description
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 automatically opens.
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.
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. If you use the Terminal Link data provider, you must also provide the following options:
--terminal-link-environment
--terminal-link-server-host
--terminal-link-server-port
--terminal-link-openfigi-api-key
You can use the --download-data
flag as an alias for --data-provider QuantConnect
and the --data-purchase-limit
option to set the maximum amount of QuantConnect Credit (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.
The default Research Environment configuration is the latest master branch of LEAN. If you set a different research image, the image you set is your current configuration. To start the Research Environment with a different configuration than your current configuration, use the --image <value>
option. If the image doesn't exist on your local machine or you pass the --update
flag, the image is pulled before starting the Research Environment. To avoid updating the image, pass the --no-update
flag.
Options
The lean research
command supports the following options:
Option | Description |
---|---|
--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-data | Update 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. |
--terminal-link-environment <value> | The environment to run in, which must be Production or Beta . |
--terminal-link-server-host <value> | The host on which the Terminal Link server is running. |
--terminal-link-server-port <value> | The port on which the Terminal Link server is running. |
--terminal-link-openfigi-api-key <value> | The Open FIGI API key to use for mapping Options. |
--detach , -d | Run 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-open | Don'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 ). |
--update | Pull the LEAN research image before starting the research environment. |
--no-update | Use the current LEAN research image. |
--lean-config <path> | The Lean configuration file that should be used (defaults to the nearest lean.json file). |
--verbose | Enable debug logging. |
--help | Display the help text of the lean research command and exit. |