Package: lean
QuantConnect Lean CLIThe Lean CLI is a cross-platform CLI aimed at making it easier to develop with the LEAN engine locally and in the cloud.Visit thedocumentation websitefor comprehensive and up-to-date documentation.HighlightsProject scaffoldingLocal autocompleteLocal data downloadingLocal backtestingLocal debuggingLocal research environmentLocal optimizationLocal live tradingLocal backtest report creationCloud synchronizationCloud backtestingCloud optimizationCloud live tradingInstallationThe CLI can be installed and updated by runningpip install --upgrade lean.Note that many commands in the CLI require Docker to run. SeeGet Dockerfor instructions on how to install Docker for your operating system.Note:Some Linux users may need to installtkinterusing the following commands:For Python 3

sudo apt-get install python3-tk

For Python 2.7

sudo apt-get install python-tkAfter installing the CLI, open a terminal in an empty directory and runlean init. This command downloads the latest configuration file and sample data from theQuantConnect/Leanrepository. We recommend running all Lean CLI commands in the same directorylean initwas ran in.UsageThe Lean CLI supports multiple workflows. The examples below serve as a starting point, you're free to mix local and cloud features in any way you'd like.A cloud-focused workflow (local development, cloud execution) with the CLI may look like this:Open a terminal in the directory you ranlean initin.Runlean cloud pullto pull remotely changed files.Start programming locally and run backtests in the cloud withlean cloud backtest "Project Name" --open --pushwhenever there is something to backtest. The--openflag means that the backtest results will be opened in the browser when done, while the--pushflag means that local changes are pushed to the cloud before running the backtest.Whenever you want to create a new project, runlean create-project "Project Name"andlean cloud push --project "Project Name"to create a new project containing some basic code and to push it to the cloud.When you're finished for the moment, runlean cloud pushto push all locally changed files to the cloud.A locally-focused workflow (local development, local execution) with the CLI may look like this:Open a terminal in the directory you ranlean initin.Runlean create-project "Project Name"to create a new project with some basic code to get you started.Work on your strategy in./Project Name.Runlean research "Project Name"to start a Jupyter Lab session to perform research in.Runlean backtest "Project Name"to run a backtest whenever there's something to test. This runs your strategy in a Docker container containing the same packages as the ones used on QuantConnect.com, but with your own data.CommandsNote: the readme only contains the--helptext of all commands. Visit thedocumentation websitefor more comprehensive documentation.lean backtestlean buildlean cloud backtestlean cloud livelean cloud live deploylean cloud live liquidatelean cloud live stoplean cloud object-store deletelean cloud object-store getlean cloud object-store listlean cloud object-store lslean cloud object-store setlean cloud optimizelean cloud pulllean cloud pushlean cloud statuslean config getlean config listlean config setlean config unsetlean create-projectlean data downloadlean data generatelean decryptlean delete-projectlean encryptlean initlean library addlean library removelean livelean live add-securitylean live cancel-orderlean live deploylean live liquidatelean live stoplean live submit-orderlean live update-orderlean loginlean logoutlean logslean object-store deletelean object-store getlean object-store listlean object-store lslean object-store setlean optimizelean project-createlean project-deletelean reportlean researchlean whoamilean backtestBacktest a project locally using Docker.Usage: lean backtest [OPTIONS] PROJECT

  Backtest a project locally using Docker.

  If PROJECT is a directory, the algorithm in the main.py or Main.cs file inside it will be executed.
  If PROJECT is a file, the algorithm in the specified file will be executed.

  Go to the following url to learn how to debug backtests locally using the Lean CLI:
  https://www.lean.io/docs/v2/lean-cli/backtesting/debugging

  By default the official LEAN engine image is used. You can override this using the --image option. Alternatively you
  can set the default engine image for all commands using `lean config set engine-image <image>`.

Options:
  --output DIRECTORY              Directory to store results in (defaults to PROJECT/backtests/TIMESTAMP)
  -d, --detach                    Run the backtest in a detached Docker container and return immediately
  --debug [pycharm|ptvsd|vsdbg|rider|local-platform]
                                  Enable a certain debugging method (see --help for more information)
  --data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|CoinApi|QuantConnect|Local|Terminal Link]
                                  Update the Lean configuration file to retrieve data from the given historical provider
  --iqfeed-iqconnect TEXT         The path to the IQConnect binary
  --iqfeed-username TEXT          Your IQFeed username
  --iqfeed-password TEXT          Your IQFeed password
  --iqfeed-version TEXT           The product version of your IQFeed developer account
  --iqfeed-host TEXT              The IQFeed host address
  --polygon-api-key TEXT          Your Polygon.io API Key
  --iex-cloud-api-key TEXT        Your iexcloud.io API token publishable key
  --iex-price-plan [Launch|Grow|Enterprise]
                                  Your IEX Cloud Price plan
  --alpha-vantage-api-key TEXT    Your Alpha Vantage Api Key
  --alpha-vantage-price-plan [Free|Plan30|Plan75|Plan150|Plan300|Plan600|Plan1200]
                                  Your Alpha Vantage Premium API Key plan
  --coinapi-api-key TEXT          Your coinapi.io Api Key
  --coinapi-product [Free|Startup|Streamer|Professional|Enterprise]
                                  CoinApi pricing plan (https://www.coinapi.io/market-data-api/pricing)
  --terminal-link-connection-type [DAPI|SAPI]
                                  Terminal Link Connection Type [DAPI, SAPI]
  --terminal-link-server-auth-id TEXT
                                  The Auth ID of the TerminalLink server
  --terminal-link-environment [Production|Beta]
                                  The environment to run in
  --terminal-link-server-host TEXT
                                  The host of the TerminalLink server
  --terminal-link-server-port INTEGER
                                  The port of the TerminalLink server
  --terminal-link-openfigi-api-key TEXT
                                  The Open FIGI API key to use for mapping options
  --download-data                 Update the Lean configuration file to download data from the QuantConnect API, alias
                                  for --data-provider-historical QuantConnect
  --data-purchase-limit INTEGER   The maximum amount of QCC to spend on downloading data during the backtest when using
                                  QuantConnect as historical data provider
  --release                       Compile C# projects in release configuration instead of debug
  --image TEXT                    The LEAN engine image to use (defaults to quantconnect/lean:latest)
  --python-venv TEXT              The path of the python virtual environment to be used
  --update                        Pull the LEAN engine image before running the backtest
  --backtest-name TEXT            Backtest name
  --extra-docker-config TEXT      Extra docker configuration as a JSON string. For more information https://docker-
                                  py.readthedocs.io/en/stable/containers.html
  --no-update                     Use the local LEAN engine image instead of pulling the latest version
  --lean-config FILE              The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/backtest.pylean buildBuild Docker images of your own version of LEAN.Usage: lean build [OPTIONS] [ROOT]

  Build Docker images of your own version of LEAN.

  ROOT must point to a directory containing the LEAN repository:
  https://github.com/QuantConnect/Lean

  When ROOT is not given, the current directory is used as root directory.

  This command performs the following actions:
  1. The lean-cli/foundation:latest image is built from Lean/DockerfileLeanFoundation(ARM).
  2. LEAN is compiled in a Docker container using the lean-cli/foundation:latest image.
  3. The lean-cli/engine:latest image is built from Lean/Dockerfile using lean-cli/foundation:latest as base image.
  4. The lean-cli/research:latest image is built from Lean/DockerfileJupyter using lean-cli/engine:latest as base image.
  5. The default engine image is set to lean-cli/engine:latest.
  6. The default research image is set to lean-cli/research:latest.

  When the foundation Dockerfile is the same as the official foundation Dockerfile, quantconnect/lean:foundation is used
  instead of building a custom foundation image.

Options:
  --tag TEXT  The tag to apply to custom images (defaults to latest)
  --verbose   Enable debug logging
  --help      Show this message and exit.See code:lean/commands/build.pylean cloud backtestBacktest a project in the cloud.Usage: lean cloud backtest [OPTIONS] PROJECT

  Backtest a project in the cloud.

  PROJECT must be the name or id of the project to run a backtest for.

  If the project that has to be backtested has been pulled to the local drive with `lean cloud pull` it is possible to
  use the --push option to push local modifications to the cloud before running the backtest.

Options:
  --name TEXT  The name of the backtest (a random one is generated if not specified)
  --push       Push local modifications to the cloud before running the backtest
  --open       Automatically open the results in the browser when the backtest is finished
  --verbose    Enable debug logging
  --help       Show this message and exit.See code:lean/commands/cloud/backtest.pylean cloud liveInteract with the QuantConnect cloud live deployments.Usage: lean cloud live [OPTIONS] COMMAND [ARGS]...

  Interact with the QuantConnect cloud live deployments.

Options:
  --help  Show this message and exit.

Commands:
  deploy     Start live trading for a project in the cloud.
  liquidate  Stops live trading and liquidates existing positions for a certain project.
  stop       Stops live trading for a certain project without liquidating existing positions.lean cloud live deployStart live trading for a project in the cloud.Usage: lean cloud live deploy [OPTIONS] PROJECT

  Start live trading for a project in the cloud.

  PROJECT must be the name or the id of the project to start live trading for.

  By default an interactive wizard is shown letting you configure the deployment. If --brokerage is given the command
  runs in non-interactive mode. In this mode the CLI does not prompt for input or confirmation. In non-interactive mode
  the options specific to the given brokerage are required, as well as --node, --auto-restart, --notify-order-events and
  --notify-insights.

Options:
  --brokerage [Paper Trading|Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Trading Technologies|Kraken|TDAmeritrade|Bybit]
                                  The brokerage to use
  --data-provider-live [QuantConnect|Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Trading Technologies|Kraken|TDAmeritrade|Polygon|IEX|CoinApi|Bybit]
                                  The live data provider to use
  --ib-user-name TEXT             Your Interactive Brokers username
  --ib-account TEXT               Your Interactive Brokers account id
  --ib-password TEXT              Your Interactive Brokers password
  --ib-weekly-restart-utc-time TEXT
                                  Weekly restart UTC time (hh:mm:ss). Each week on Sunday your algorithm is restarted at
                                  this time, and will require 2FA verification. This is required by Interactive Brokers.
                                  Use this option explicitly to override the default value.
  --tradier-account-id TEXT       Your Tradier account id
  --tradier-access-token TEXT     Your Tradier access token
  --tradier-environment [live|paper]
                                  Whether the developer sandbox should be used
  --oanda-account-id TEXT         Your OANDA account id
  --oanda-access-token TEXT       Your OANDA API token
  --oanda-environment [Practice|Trade]
                                  The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
  --bitfinex-api-key TEXT         Your Bitfinex API key
  --bitfinex-api-secret TEXT      Your Bitfinex API secret
  --coinbase-api-key TEXT         Your Coinbase Advanced Trade API key
  --coinbase-api-secret TEXT      Your Coinbase Advanced Trade API secret
  --binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
                                  Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
  --binance-api-key TEXT          Your Binance API key
  --binanceus-api-key TEXT        Your Binance API key
  --binance-api-secret TEXT       Your Binance API secret
  --binanceus-api-secret TEXT     Your Binance API secret
  --binance-use-testnet [live|paper]
                                  Whether the testnet should be used
  --zerodha-api-key TEXT          Your Kite Connect API key
  --zerodha-access-token TEXT     Your Kite Connect access token
  --zerodha-product-type [mis|cnc|nrml]
                                  MIS if you are targeting intraday products, CNC if you are targeting delivery
                                  products, NRML if you are targeting carry forward products
  --zerodha-trading-segment [equity|commodity]
                                  EQUITY if you are trading equities on NSE or BSE, COMMODITY if you are trading
                                  commodities on MCX
  --zerodha-history-subscription [true|false]
                                  Whether you have a history API subscription for Zerodha
  --samco-client-id TEXT          Your Samco account Client ID
  --samco-client-password TEXT    Your Samco account password
  --samco-year-of-birth TEXT      Your year of birth (YYYY) registered with Samco
  --samco-product-type [mis|cnc|nrml]
                                  MIS if you are targeting intraday products, CNC if you are targeting delivery
                                  products, NRML if you are targeting carry forward products
  --samco-trading-segment [equity|commodity]
                                  EQUITY if you are trading equities on NSE or BSE, COMMODITY if you are trading
                                  commodities on MCX
  --terminal-link-server-auth-id TEXT
                                  The Auth ID of the TerminalLink server
  --terminal-link-environment [Production|Beta]
                                  The environment to run in
  --terminal-link-server-host TEXT
                                  The host of the SAPI server
  --terminal-link-server-port INTEGER
                                  The port of the SAPI server
  --terminal-link-emsx-broker TEXT
                                  The EMSX broker to use
  --terminal-link-emsx-account TEXT
                                  The EMSX account to use
  --terminal-link-openfigi-api-key TEXT
                                  The Open FIGI API key to use for mapping options
  --tt-user-name TEXT             Your Trading Technologies username
  --tt-session-password TEXT      Your Trading Technologies session password
  --tt-account-name TEXT          Your Trading Technologies account name
  --tt-rest-app-key TEXT          Your Trading Technologies REST app key
  --tt-rest-app-secret TEXT       Your Trading Technologies REST app secret
  --tt-rest-environment TEXT      The REST environment to run in
  --tt-order-routing-sender-comp-id TEXT
                                  The order routing sender comp id to use
  --kraken-api-key TEXT           Your Kraken API key
  --kraken-api-secret TEXT        Your Kraken API secret
  --kraken-verification-tier [Starter|Intermediate|Pro]
                                  Your Kraken Verification Tier
  --tdameritrade-api-key TEXT     Your TDAmeritrade API key
  --tdameritrade-access-token TEXT
                                  Your TDAmeritrade OAuth Access Token
  --tdameritrade-account-number TEXT
                                  Your TDAmeritrade account number
  --bybit-api-key TEXT            Your Bybit API key
  --bybit-api-secret TEXT         Your Bybit API secret
  --bybit-vip-level [VIP0|VIP1|VIP2|VIP3|VIP4|VIP5|SupremeVIP|Pro1|Pro2|Pro3|Pro4|Pro5]
                                  Your Bybit VIP Level
  --polygon-api-key TEXT          Your Polygon.io API Key
  --iex-cloud-api-key TEXT        Your iexcloud.io API token publishable key
  --iex-price-plan [Launch|Grow|Enterprise]
                                  Your IEX Cloud Price plan
  --coinapi-api-key TEXT          Your coinapi.io Api Key
  --coinapi-product [Free|Startup|Streamer|Professional|Enterprise]
                                  CoinApi pricing plan (https://www.coinapi.io/market-data-api/pricing)
  --node TEXT                     The name or id of the live node to run on
  --auto-restart BOOLEAN          Whether automatic algorithm restarting must be enabled
  --notify-order-events BOOLEAN   Whether notifications must be sent for order events
  --notify-insights BOOLEAN       Whether notifications must be sent for emitted insights
  --notify-emails TEXT            A comma-separated list of 'email:subject' pairs configuring email-notifications
  --notify-webhooks TEXT          A comma-separated list of 'url:HEADER_1=VALUE_1:HEADER_2=VALUE_2:etc' pairs
                                  configuring webhook-notifications
  --notify-sms TEXT               A comma-separated list of phone numbers configuring SMS-notifications
  --notify-telegram TEXT          A comma-separated list of 'user/group Id:token(optional)' pairs configuring telegram-
                                  notifications
  --live-cash-balance TEXT        A comma-separated list of currency:amount pairs of initial cash balance
  --live-holdings TEXT            A comma-separated list of symbol:symbolId:quantity:averagePrice of initial portfolio
                                  holdings
  --push                          Push local modifications to the cloud before starting live trading
  --open                          Automatically open the live results in the browser once the deployment starts
  --show-secrets                  Show secrets as they are input
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/cloud/live/deploy.pylean cloud live liquidateStops live trading and liquidates existing positions for a certain project.Usage: lean cloud live liquidate [OPTIONS] PROJECT

  Stops live trading and liquidates existing positions for a certain project.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/live/liquidate.pylean cloud live stopStops live trading for a certain project without liquidating existing positions.Usage: lean cloud live stop [OPTIONS] PROJECT

  Stops live trading for a certain project without liquidating existing positions.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/live/stop.pylean cloud object-store deleteDelete a value from the organization's cloud object store.Usage: lean cloud object-store delete [OPTIONS] KEY

  Delete a value from the organization's cloud object store.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/object_store/delete.pylean cloud object-store getGet a value from the organization's cloud object store.Usage: lean cloud object-store get [OPTIONS] KEY

  Get a value from the organization's cloud object store.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/object_store/get.pylean cloud object-store listList all values for the given root key in the organization's cloud object store.Usage: lean cloud object-store list [OPTIONS] [KEY]

  List all values for the given root key in the organization's cloud object store.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/object_store/list.pylean cloud object-store lsAlias for 'list'Usage: lean cloud object-store ls [OPTIONS] [KEY]

  List all values for the given root key in the organization's cloud object store.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/object_store/ls.pylean cloud object-store setSets the data to the given key in the organization's cloud object store.Usage: lean cloud object-store set [OPTIONS] KEY PATH

  Sets the data to the given key in the organization's cloud object store.

  :param key: The key to set the data to. :param path: Path to the file containing the object data.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/object_store/set.pylean cloud optimizeOptimize a project in the cloud.Usage: lean cloud optimize [OPTIONS] PROJECT

  Optimize a project in the cloud.

  PROJECT must be the name or id of the project to optimize.

  An interactive prompt will be shown to configure the optimizer. If --target is given the command runs in non-
  interactive mode. In this mode the CLI does not prompt for input and the following options become required: --target,
  --target-direction, --parameter, --node and --parallel-nodes.

  In non-interactive mode the --parameter option can be provided multiple times to configure multiple parameters:
  - --parameter <name> <min value> <max value> <step size>
  - --parameter my-first-parameter 1 10 0.5 --parameter my-second-parameter 20 30 5

  In non-interactive mode the --constraint option can be provided multiple times to configure multiple constraints:
  - --constraint "<statistic> <operator> <value>"
  - --constraint "Sharpe Ratio >= 0.5" --constraint "Drawdown < 0.25"

  If the project that has to be optimized has been pulled to the local drive with `lean cloud pull` it is possible to
  use the --push option to push local modifications to the cloud before running the optimization.

Options:
  --target TEXT                   The target statistic of the optimization
  --target-direction [min|max]    Whether the target must be minimized or maximized
  --parameter <TEXT FLOAT FLOAT FLOAT>...
                                  The 'parameter min max step' pairs configuring the parameters to optimize
  --constraint TEXT               The 'statistic operator value' pairs configuring the constraints of the optimization
  --node [O2-8|O4-12|O8-16]       The node type to run the optimization on
  --parallel-nodes INTEGER        The number of nodes that may be run in parallel
  --name TEXT                     The name of the optimization (a random one is generated if not specified)
  --push                          Push local modifications to the cloud before starting the optimization
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/cloud/optimize.pylean cloud pullPull projects from QuantConnect to the local drive.Usage: lean cloud pull [OPTIONS]

  Pull projects from QuantConnect to the local drive.

  This command overrides the content of local files with the content of their respective counterparts in the cloud.

  This command will not delete local files for which there is no counterpart in the cloud.

Options:
  --project TEXT   Name or id of the project to pull (all cloud projects if not specified)
  --pull-bootcamp  Pull Boot Camp projects (disabled by default)
  --encrypt        Pull your cloud files and encrypt them before saving on your local drive
  --decrypt        Pull your cloud files and decrypt them before saving on your local drive
  --key FILE       Path to the encryption key to use
  --verbose        Enable debug logging
  --help           Show this message and exit.See code:lean/commands/cloud/pull.pylean cloud pushPush local projects to QuantConnect.Usage: lean cloud push [OPTIONS]

  Push local projects to QuantConnect.

  This command overrides the content of cloud files with the content of their respective local counterparts.

  This command will delete cloud files which don't have a local counterpart.

Options:
  --project DIRECTORY  Path to the local project to push (all local projects if not specified)
  --encrypt            Push your local files and encrypt them before saving on the cloud
  --decrypt            Push your local files and decrypt them before saving on the cloud
  --key FILE           Path to the encryption key to use
  --verbose            Enable debug logging
  --help               Show this message and exit.See code:lean/commands/cloud/push.pylean cloud statusShow the live trading status of a project in the cloud.Usage: lean cloud status [OPTIONS] PROJECT

  Show the live trading status of a project in the cloud.

  PROJECT must be the name or the id of the project to show the status for.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/cloud/status.pylean config getGet the current value of a configurable option.Usage: lean config get [OPTIONS] KEY

  Get the current value of a configurable option.

  Sensitive options like credentials cannot be retrieved this way for security reasons. Please open ~/.lean/credentials
  if you want to see your currently stored credentials.

  Run `lean config list` to show all available options.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/config/get.pylean config listList the configurable options and their current values.Usage: lean config list [OPTIONS]

  List the configurable options and their current values.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/config/list.pylean config setSet a configurable option.Usage: lean config set [OPTIONS] KEY VALUE

  Set a configurable option.

  Run `lean config list` to show all available options.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/config/set.pylean config unsetUnset a configurable option.Usage: lean config unset [OPTIONS] KEY

  Unset a configurable option.

  Run `lean config list` to show all available options.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/config/unset.pylean create-projectAlias for 'project-create'Usage: lean create-project [OPTIONS] NAME

  Create a new project containing starter code.

  If NAME is a path containing subdirectories those will be created automatically.

  The default language can be set using `lean config set default-language python/csharp`.

Options:
  -l, --language [python|csharp]  The language of the project to create
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/create_project.pylean data downloadPurchase and download data from QuantConnect Datasets.Usage: lean data download [OPTIONS]

  Purchase and download data from QuantConnect Datasets.

  An interactive wizard will show to walk you through the process of selecting data, accepting the CLI API Access and
  Data Agreement and payment. After this wizard the selected data will be downloaded automatically.

  If --dataset is given the command runs in non-interactive mode. In this mode the CLI does not prompt for input or
  confirmation but only halts when the agreement must be accepted. In non-interactive mode all options specific to the
  selected dataset are required.

  See the following url for the data that can be purchased and downloaded with this command:
  https://www.quantconnect.com/datasets

Options:
  --dataset TEXT      The name of the dataset to download non-interactively
  --overwrite         Overwrite existing local data
  -y, --yes           Automatically confirm payment confirmation prompts
  --lean-config FILE  The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose           Enable debug logging
  --help              Show this message and exit.See code:lean/commands/data/download.pylean data generateGenerate random market data.Usage: lean data generate [OPTIONS]

  Generate random market data.

  This uses the random data generator in LEAN to generate realistic market data using a Brownian motion model.
  This generator supports the following security types, tick types and resolutions:
  | Security type | Generated tick types | Supported resolutions                |
  | ------------- | -------------------- | ------------------------------------ |
  | Equity        | Trade                | Tick, Second, Minute, Hour and Daily |
  | Forex         | Quote                | Tick, Second, Minute, Hour and Daily |
  | CFD           | Quote                | Tick, Second, Minute, Hour and Daily |
  | Future        | Trade and Quote      | Tick, Second, Minute, Hour and Daily |
  | Crypto        | Trade and Quote      | Tick, Second, Minute, Hour and Daily |
  | Option        | Trade and Quote      | Minute                               |

  The following data densities are available:
  - Dense: at least one data point per resolution step.
  - Sparse: at least one data point per 5 resolution steps.
  - VerySparse: at least one data point per 50 resolution steps.

  Example which generates minute data for 100 equity symbols since 2015-01-01:
  $ lean data generate --start=20150101 --symbol-count=100

  Example which generates daily data for 100 crypto symbols since 2015-01-01:
  $ lean data generate --start=20150101 --symbol-count=100 --security-type=Crypto --resolution=Daily

  By default the official LEAN engine image is used. You can override this using the --image option. Alternatively you
  can set the default engine image for all commands using `lean config set engine-image <image>`.

Options:
  --start [yyyyMMdd]              Start date for the data to generate in yyyyMMdd format  [required]
  --end [yyyyMMdd]                End date for the data to generate in yyyyMMdd format (defaults to today)
  --symbol-count INTEGER RANGE    The number of symbols to generate data for  [x>=0]
  --tickers TEXT                  Comma separated list of tickers to use for generated data
  --security-type [Equity|Forex|Cfd|Future|Crypto|Option]
                                  The security type to generate data for (defaults to Equity)
  --resolution [Tick|Second|Minute|Hour|Daily]
                                  The resolution of the generated data (defaults to Minute)
  --data-density [Dense|Sparse|VerySparse]
                                  The density of the generated data (defaults to Dense)
  --include-coarse BOOLEAN        Whether coarse universe data should be generated for Equity data (defaults to True)
  --market TEXT                   The market to generate data for (defaults to standard market for the security type)
  --quote-trade-ratio FLOAT       The ratio of generated quotes to generated trades. Values larger than 1 mean more
                                  quotes than trades. Only used for Option, Future and Crypto (defaults to 1)
  --random-seed INTEGER RANGE     The random number generator seed. Defaults to None, which means no seed will be used
                                  [x>=0]
  --ipo-percentage FLOAT          The probability each equity generated will have an IPO event. Note that this is not
                                  the total probability for all symbols generated. Only used for Equity (defaults to
                                  5.0)
  --rename-percentage FLOAT       The probability each equity generated will have a rename event. Note that this is not
                                  the total probability for all symbols generated. Only used for Equity (defaults to
                                  30.0)
  --splits-percentage FLOAT       The probability each equity generated will have a stock split event. Note that this is
                                  not the total probability for all symbols generated. Only used for Equity (defaults to
                                  15.0)
  --dividends-percentage FLOAT    The probability each equity generated will have dividends. Note that this is not the
                                  probability for all symbols genearted. Only used for Equity (defaults to 60.0)
  --dividend-every-quarter-percentage FLOAT
                                  The probability each equity generated will have a dividend event every quarter. Note
                                  that this is not the total probability for all symbols generated. Only used for Equity
                                  (defaults to 30.0)
  --option-price-engine TEXT      The stochastic process, and returns new pricing engine to run calculations for that
                                  option (defaults to BaroneAdesiWhaleyApproximationEngine)
  --volatility-model-resolution [Tick|Second|Minute|Hour|Daily]
                                  The volatility model period span (defaults to Daily)
  --chain-symbol-count INTEGER RANGE
                                  The size of the option chain (defaults to 10)  [x>=0]
  --image TEXT                    The LEAN engine image to use (defaults to quantconnect/lean:latest)
  --update                        Pull the LEAN engine image before running the generator
  --lean-config FILE              The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/data/generate.pylean decryptDecrypt your local project using the specified decryption key.Usage: lean decrypt [OPTIONS] PROJECT

  Decrypt your local project using the specified decryption key.

Options:
  --key FILE  Path to the decryption key to use
  --verbose   Enable debug logging
  --help      Show this message and exit.See code:lean/commands/decrypt.pylean delete-projectAlias for 'project-delete'Usage: lean delete-project [OPTIONS] PROJECT

  Delete a project locally and in the cloud if it exists.

  The project is selected by name or cloud id.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/delete_project.pylean encryptEncrypt your local project using the specified encryption key.Usage: lean encrypt [OPTIONS] PROJECT

  Encrypt your local project using the specified encryption key.

Options:
  --key FILE  Path to the encryption key to use
  --verbose   Enable debug logging
  --help      Show this message and exit.See code:lean/commands/encrypt.pylean initScaffold a Lean configuration file and data directory.Usage: lean init [OPTIONS]

  Scaffold a Lean configuration file and data directory.

Options:
  --organization TEXT             The name or id of the organization the Lean CLI will be scaffolded for
  -l, --language [python|csharp]  The default language to use for new projects
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/init.pylean library addAdd a custom library to a project.Usage: lean library add [OPTIONS] PROJECT NAME

  Add a custom library to a project.

  PROJECT must be the path to the project.

  NAME must be either the name of a NuGet package (for C# projects), a PyPI package (for Python projects), or a path to
  a Lean CLI library.

  If --version is not given, and the library is a NuGet or PyPI package the package, it is pinned to the latest
  compatible version. For C# projects, this is the latest available version. For Python projects, this is the latest
  version compatible with Python 3.8 (which is what the Docker images use). For Lean CLI library projects, this is
  ignored.

  Custom C# libraries are added to your project's .csproj file, which is then restored if dotnet is on your PATH and the
  --no-local flag has not been given.

  Custom Python libraries are added to your project's requirements.txt file and are installed in your local Python
  environment so you get local autocomplete for the library. The last step can be skipped with the --no-local flag.

  C# example usage:
  $ lean library add "My CSharp Project" Microsoft.ML
  $ lean library add "My CSharp Project" Microsoft.ML --version 1.5.5
  $ lean library add "My CSharp Project" "Library/My CSharp Library"

  Python example usage:
  $ lean library add "My Python Project" tensorflow
  $ lean library add "My Python Project" tensorflow --version 2.5.0
  $ lean library add "My Python Project" "Library/My Python Library"

Options:
  --version TEXT  The version of the library to add (defaults to latest compatible version)
  --no-local      Skip making changes to your local environment
  --verbose       Enable debug logging
  --help          Show this message and exit.See code:lean/commands/library/add.pylean library removeRemove a custom library from a project.Usage: lean library remove [OPTIONS] PROJECT NAME

  Remove a custom library from a project.

  PROJECT must be the path to the project directory.

  NAME must be either the name of the NuGet package (for C# projects), the PyPI package (for Python projects), or the
  path to the Lean CLI library to remove.

  Custom C# libraries are removed from the project's .csproj file, which is then restored if dotnet is on your PATH and
  the --no-local flag has not been given.

  Custom Python libraries are removed from the project's requirements.txt file.

  C# example usage:
  $ lean library remove "My CSharp Project" Microsoft.ML

  Python example usage:
  $ lean library remove "My Python Project" tensorflow

Options:
  --no-local  Skip making changes to your local environment
  --verbose   Enable debug logging
  --help      Show this message and exit.See code:lean/commands/library/remove.pylean liveInteract with the local machine.Usage: lean live [OPTIONS] COMMAND [ARGS]...

  Interact with the local machine.

Options:
  --help  Show this message and exit.

Commands:
  add-security  Represents a command to add a security to the algorithm.
  cancel-order  Represents a command to cancel a specific order by id.
  deploy        Start live trading a project locally using Docker.
  liquidate     Liquidate the given symbol from the latest deployment of the given project.
  stop          Stop an already running local live trading project.
  submit-order  Represents a command to submit an order to the algorithm.
  update-order  Represents a command to update a specific order by id.lean live add-securityRepresents a command to add a security to the algorithm.Usage: lean live add-security [OPTIONS] PROJECT

  Represents a command to add a security to the algorithm.

Options:
  --ticker TEXT            The ticker of the symbol to add  [required]
  --market TEXT            The market of the symbol to add  [required]
  --security-type TEXT     The security type of the symbol to add  [required]
  --resolution TEXT        The resolution of the symbol to add
  --fill-data-forward      The fill forward behavior, true to fill forward, false otherwise - defaults to true
  --leverage DECIMAL       The leverage for the security, defaults to 2 for equity, 50 for forex, and 1 for everything
                           else
  --extended-market-hours  The extended market hours flag, true to allow pre/post market data, false for only in market
                           data
  --lean-config FILE       The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose                Enable debug logging
  --help                   Show this message and exit.See code:lean/commands/live/add_security.pylean live cancel-orderRepresents a command to cancel a specific order by id.Usage: lean live cancel-order [OPTIONS] PROJECT

  Represents a command to cancel a specific order by id.

Options:
  --order-id INTEGER  The order id to be cancelled  [required]
  --lean-config FILE  The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose           Enable debug logging
  --help              Show this message and exit.See code:lean/commands/live/cancel_order.pylean live deployStart live trading a project locally using Docker.Usage: lean live deploy [OPTIONS] PROJECT

  Start live trading a project locally using Docker.

  If PROJECT is a directory, the algorithm in the main.py or Main.cs file inside it will be executed.
  If PROJECT is a file, the algorithm in the specified file will be executed.

  By default an interactive wizard is shown letting you configure the brokerage and live data provider to use. If
  --environment, --brokerage or --data-provider-live are given the command runs in non-interactive mode. In this mode
  the CLI does not prompt for input.

  If --environment is given it must be the name of a live environment in the Lean configuration.

  If --brokerage and --data-provider-live are given, the options specific to the given brokerage/live data provider must
  also be given. The Lean config is used as fallback when a brokerage/live data provider-specific option hasn't been
  passed in. If a required option is not given and cannot be found in the Lean config the command aborts.

  By default the official LEAN engine image is used. You can override this using the --image option. Alternatively you
  can set the default engine image for all commands using `lean config set engine-image <image>`.

Options:
  --environment TEXT              The environment to use
  --output DIRECTORY              Directory to store results in (defaults to PROJECT/live/TIMESTAMP)
  -d, --detach                    Run the live deployment in a detached Docker container and return immediately
  --brokerage [Paper Trading|Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Trading Technologies|Kraken|TDAmeritrade|Bybit]
                                  The brokerage to use
  --data-provider-live [Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Trading Technologies|Kraken|TDAmeritrade|IQFeed|Polygon|IEX|CoinApi|Custom data only|Bybit]
                                  The live data provider to use
  --data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|CoinApi|QuantConnect|Local]
                                  Update the Lean configuration file to retrieve data from the given historical provider
  --ib-user-name TEXT             Your Interactive Brokers username
  --ib-account TEXT               Your Interactive Brokers account id
  --ib-password TEXT              Your Interactive Brokers password
  --ib-weekly-restart-utc-time TEXT
                                  Weekly restart UTC time (hh:mm:ss). Each week on Sunday your algorithm is restarted at
                                  this time, and will require 2FA verification. This is required by Interactive Brokers.
                                  Use this option explicitly to override the default value.
  --tradier-account-id TEXT       Your Tradier account id
  --tradier-access-token TEXT     Your Tradier access token
  --tradier-environment [live|paper]
                                  Whether the developer sandbox should be used
  --oanda-account-id TEXT         Your OANDA account id
  --oanda-access-token TEXT       Your OANDA API token
  --oanda-environment [Practice|Trade]
                                  The environment to run in, Practice for fxTrade Practice, Trade for fxTrade
  --bitfinex-api-key TEXT         Your Bitfinex API key
  --bitfinex-api-secret TEXT      Your Bitfinex API secret
  --coinbase-api-key TEXT         Your Coinbase Advanced Trade API key
  --coinbase-api-secret TEXT      Your Coinbase Advanced Trade API secret
  --binance-exchange-name [Binance|BinanceUS|Binance-USDM-Futures|Binance-COIN-Futures]
                                  Binance exchange name [Binance, BinanceUS, Binance-USDM-Futures, Binance-COIN-Futures]
  --binance-api-key TEXT          Your Binance API key
  --binanceus-api-key TEXT        Your Binance API key
  --binance-api-secret TEXT       Your Binance API secret
  --binanceus-api-secret TEXT     Your Binance API secret
  --binance-use-testnet [live|paper]
                                  Whether the testnet should be used
  --zerodha-api-key TEXT          Your Kite Connect API key
  --zerodha-access-token TEXT     Your Kite Connect access token
  --zerodha-product-type [mis|cnc|nrml]
                                  MIS if you are targeting intraday products, CNC if you are targeting delivery
                                  products, NRML if you are targeting carry forward products
  --zerodha-trading-segment [equity|commodity]
                                  EQUITY if you are trading equities on NSE or BSE, COMMODITY if you are trading
                                  commodities on MCX
  --zerodha-history-subscription [true|false]
                                  Whether you have a history API subscription for Zerodha
  --samco-client-id TEXT          Your Samco account Client ID
  --samco-client-password TEXT    Your Samco account password
  --samco-year-of-birth TEXT      Your year of birth (YYYY) registered with Samco
  --samco-product-type [mis|cnc|nrml]
                                  MIS if you are targeting intraday products, CNC if you are targeting delivery
                                  products, NRML if you are targeting carry forward products
  --samco-trading-segment [equity|commodity]
                                  EQUITY if you are trading equities on NSE or BSE, COMMODITY if you are trading
                                  commodities on MCX
  --terminal-link-connection-type [DAPI|SAPI]
                                  Terminal Link Connection Type [DAPI, SAPI]
  --terminal-link-server-auth-id TEXT
                                  The Auth ID of the TerminalLink server
  --terminal-link-environment [Production|Beta]
                                  The environment to run in
  --terminal-link-server-host TEXT
                                  The host of the TerminalLink server
  --terminal-link-server-port INTEGER
                                  The port of the TerminalLink server
  --terminal-link-emsx-broker TEXT
                                  The EMSX broker to use
  --terminal-link-emsx-account TEXT
                                  The EMSX account to use
  --terminal-link-openfigi-api-key TEXT
                                  The Open FIGI API key to use for mapping options
  --tt-user-name TEXT             Your Trading Technologies username
  --tt-session-password TEXT      Your Trading Technologies session password
  --tt-account-name TEXT          Your Trading Technologies account name
  --tt-rest-app-key TEXT          Your Trading Technologies REST app key
  --tt-rest-app-secret TEXT       Your Trading Technologies REST app secret
  --tt-rest-environment TEXT      The REST environment to run in
  --tt-market-data-sender-comp-id TEXT
                                  The market data sender comp id to use
  --tt-market-data-target-comp-id TEXT
                                  The market data target comp id to use
  --tt-market-data-host TEXT      The host of the market data server
  --tt-market-data-port TEXT      The port of the market data server
  --tt-order-routing-sender-comp-id TEXT
                                  The order routing sender comp id to use
  --tt-order-routing-target-comp-id TEXT
                                  The order routing target comp id to use
  --tt-order-routing-host TEXT    The host of the order routing server
  --tt-order-routing-port TEXT    The port of the order routing server
  --tt-log-fix-messages BOOLEAN   Whether FIX messages should be logged
  --kraken-api-key TEXT           Your Kraken API key
  --kraken-api-secret TEXT        Your Kraken API secret
  --kraken-verification-tier [Starter|Intermediate|Pro]
                                  Your Kraken Verification Tier
  --tdameritrade-api-key TEXT     Your TDAmeritrade API key
  --tdameritrade-access-token TEXT
                                  Your TDAmeritrade OAuth Access Token
  --tdameritrade-account-number TEXT
                                  Your TDAmeritrade account number
  --bybit-api-key TEXT            Your Bybit API key
  --bybit-api-secret TEXT         Your Bybit API secret
  --bybit-vip-level [VIP0|VIP1|VIP2|VIP3|VIP4|VIP5|SupremeVIP|Pro1|Pro2|Pro3|Pro4|Pro5]
                                  Your Bybit VIP Level
  --bybit-use-testnet [live|paper]
                                  Whether the testnet should be used
  --ib-enable-delayed-streaming-data BOOLEAN
                                  Whether delayed data may be used when your algorithm subscribes to a security you
                                  don't have a market data subscription for
  --iqfeed-iqconnect TEXT         The path to the IQConnect binary
  --iqfeed-username TEXT          Your IQFeed username
  --iqfeed-password TEXT          Your IQFeed password
  --iqfeed-version TEXT           The product version of your IQFeed developer account
  --iqfeed-host TEXT              The IQFeed host address
  --polygon-api-key TEXT          Your Polygon.io API Key
  --iex-cloud-api-key TEXT        Your iexcloud.io API token publishable key
  --iex-price-plan [Launch|Grow|Enterprise]
                                  Your IEX Cloud Price plan
  --coinapi-api-key TEXT          Your coinapi.io Api Key
  --coinapi-product [Free|Startup|Streamer|Professional|Enterprise]
                                  CoinApi pricing plan (https://www.coinapi.io/market-data-api/pricing)
  --alpha-vantage-api-key TEXT    Your Alpha Vantage Api Key
  --alpha-vantage-price-plan [Free|Plan30|Plan75|Plan150|Plan300|Plan600|Plan1200]
                                  Your Alpha Vantage Premium API Key plan
  --release                       Compile C# projects in release configuration instead of debug
  --image TEXT                    The LEAN engine image to use (defaults to quantconnect/lean:latest)
  --python-venv TEXT              The path of the python virtual environment to be used
  --live-cash-balance TEXT        A comma-separated list of currency:amount pairs of initial cash balance
  --live-holdings TEXT            A comma-separated list of symbol:symbolId:quantity:averagePrice of initial portfolio
                                  holdings
  --update                        Pull the LEAN engine image before starting live trading
  --show-secrets                  Show secrets as they are input
  --extra-docker-config TEXT      Extra docker configuration as a JSON string. For more information https://docker-
                                  py.readthedocs.io/en/stable/containers.html
  --no-update                     Use the local LEAN engine image instead of pulling the latest version
  --lean-config FILE              The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/live/deploy.pylean live liquidateLiquidate the given symbol from the latest deployment of the given project.Usage: lean live liquidate [OPTIONS] PROJECT

  Liquidate the given symbol from the latest deployment of the given project.

Options:
  --ticker TEXT         The ticker of the symbol to liquidate
  --market TEXT         The market of the symbol to liquidate
  --security-type TEXT  The security type of the symbol to liquidate
  --lean-config FILE    The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose             Enable debug logging
  --help                Show this message and exit.See code:lean/commands/live/liquidate.pylean live stopStop an already running local live trading project.Usage: lean live stop [OPTIONS] PROJECT

  Stop an already running local live trading project.

Options:
  --lean-config FILE  The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose           Enable debug logging
  --help              Show this message and exit.See code:lean/commands/live/stop.pylean live submit-orderRepresents a command to submit an order to the algorithm.Usage: lean live submit-order [OPTIONS] PROJECT

  Represents a command to submit an order to the algorithm.

Options:
  --ticker TEXT          The ticker of the symbol to be submitted  [required]
  --market TEXT          The market of the symbol to be submitted  [required]
  --security-type TEXT   The security type of the symbol to be submitted  [required]
  --order-type TEXT      The order type to be submitted  [required]
  --quantity DECIMAL     The number of units to be ordered (directional)  [required]
  --limit-price DECIMAL  The limit price of the order be submitted
  --stop-price DECIMAL   The stop price of the order to be submitted
  --tag TEXT             The tag to be attached to the order
  --lean-config FILE     The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose              Enable debug logging
  --help                 Show this message and exit.See code:lean/commands/live/submit_order.pylean live update-orderRepresents a command to update a specific order by id.Usage: lean live update-order [OPTIONS] PROJECT

  Represents a command to update a specific order by id.

Options:
  --order-id INTEGER     The order id to be updated  [required]
  --quantity DECIMAL     The number of units to be updated (directional)
  --limit-price DECIMAL  The limit price of the order to be updated
  --stop-price DECIMAL   The stop price of the order to be updated
  --tag TEXT             The tag to be attached to the order
  --lean-config FILE     The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose              Enable debug logging
  --help                 Show this message and exit.See code:lean/commands/live/update_order.pylean loginLog in with a QuantConnect account.Usage: lean login [OPTIONS]

  Log in with a QuantConnect account.

  If user id or API token is not provided an interactive prompt will show.

  Credentials are stored in ~/.lean/credentials and are removed upon running `lean logout`.

Options:
  -u, --user-id TEXT    QuantConnect user id
  -t, --api-token TEXT  QuantConnect API token
  --show-secrets        Show secrets as they are input
  --verbose             Enable debug logging
  --help                Show this message and exit.See code:lean/commands/login.pylean logoutLog out and remove stored credentials.Usage: lean logout [OPTIONS]

  Log out and remove stored credentials.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/logout.pylean logsDisplay the most recent backtest/live/optimization logs.Usage: lean logs [OPTIONS]

  Display the most recent backtest/live/optimization logs.

Options:
  --backtest           Display the most recent backtest logs (default)
  --live               Display the most recent live logs
  --optimization       Display the most recent optimization logs
  --project DIRECTORY  The project to get the most recent logs from
  --lean-config FILE   The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose            Enable debug logging
  --help               Show this message and exit.See code:lean/commands/logs.pylean object-store deleteOpens the local storage directory in the file explorer.Usage: lean object-store delete [OPTIONS]

  Opens the local storage directory in the file explorer.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/object_store/delete.pylean object-store getOpens the local storage directory in the file explorer.Usage: lean object-store get [OPTIONS]

  Opens the local storage directory in the file explorer.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/object_store/get.pylean object-store listOpens the local storage directory in the file explorer.Usage: lean object-store list [OPTIONS]

  Opens the local storage directory in the file explorer.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/object_store/list.pylean object-store lsAlias for 'list'Usage: lean object-store ls [OPTIONS]

  Opens the local storage directory in the file explorer.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/object_store/ls.pylean object-store setOpens the local storage directory in the file explorer.Usage: lean object-store set [OPTIONS]

  Opens the local storage directory in the file explorer.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/object_store/set.pylean optimizeOptimize a project's parameters locally using Docker.Usage: lean optimize [OPTIONS] PROJECT

  Optimize a project's parameters locally using Docker.

  If PROJECT is a directory, the algorithm in the main.py or Main.cs file inside it will be executed.
  If PROJECT is a file, the algorithm in the specified file will be executed.

  By default an interactive wizard is shown letting you configure the optimizer. If --optimizer-config or --strategy is
  given the command runs in non-interactive mode. In this mode the CLI does not prompt for input.

  The --optimizer-config option can be used to specify the configuration to run the optimizer with.
  When using the option it should point to a file like this (the algorithm-* properties should be omitted):
  https://github.com/QuantConnect/Lean/blob/master/Optimizer.Launcher/config.json

  If --strategy is given the optimizer configuration is read from the given options. In this case --strategy, --target,
  --target-direction and --parameter become required.

  In non-interactive mode the --parameter option can be provided multiple times to configure multiple parameters:
  - --parameter <name> <min value> <max value> <step size>
  - --parameter my-first-parameter 1 10 0.5 --parameter my-second-parameter 20 30 5

  In non-interactive mode the --constraint option can be provided multiple times to configure multiple constraints:
  - --constraint "<statistic> <operator> <value>"
  - --constraint "Sharpe Ratio >= 0.5" --constraint "Drawdown < 0.25"

  If --estimate is given, the optimization will not be executed.
  The runtime estimate for the optimization will be calculated and outputted.

  By default the official LEAN engine image is used. You can override this using the --image option. Alternatively you
  can set the default engine image for all commands using `lean config set engine-image <image>`.

Options:
  --output DIRECTORY              Directory to store results in (defaults to PROJECT/optimizations/TIMESTAMP)
  -d, --detach                    Run the optimization in a detached Docker container and return immediately
  --optimizer-config FILE         The optimizer configuration file that should be used
  --strategy [Grid Search|Euler Search]
                                  The optimization strategy to use
  --target TEXT                   The target statistic of the optimization
  --target-direction [min|max]    Whether the target must be minimized or maximized
  --parameter <TEXT FLOAT FLOAT FLOAT>...
                                  The 'parameter min max step' pairs configuring the parameters to optimize
  --constraint TEXT               The 'statistic operator value' pairs configuring the constraints of the optimization
  --data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|CoinApi|QuantConnect|Local|Terminal Link]
                                  Update the Lean configuration file to retrieve data from the given historical provider
  --download-data                 Update the Lean configuration file to download data from the QuantConnect API, alias
                                  for --data-provider-historical QuantConnect
  --release                       Compile C# projects in release configuration instead of debug
  --image TEXT                    The LEAN engine image to use (defaults to quantconnect/lean:latest)
  --update                        Pull the LEAN engine image before running the optimizer
  --estimate                      Estimate optimization runtime without running it
  --max-concurrent-backtests INTEGER RANGE
                                  Maximum number of concurrent backtests to run  [x>=1]
  --extra-docker-config TEXT      Extra docker configuration as a JSON string. For more information https://docker-
                                  py.readthedocs.io/en/stable/containers.html
  --no-update                     Use the local LEAN engine image instead of pulling the latest version
  --iqfeed-iqconnect TEXT         The path to the IQConnect binary
  --iqfeed-username TEXT          Your IQFeed username
  --iqfeed-password TEXT          Your IQFeed password
  --iqfeed-version TEXT           The product version of your IQFeed developer account
  --iqfeed-host TEXT              The IQFeed host address
  --polygon-api-key TEXT          Your Polygon.io API Key
  --iex-cloud-api-key TEXT        Your iexcloud.io API token publishable key
  --iex-price-plan [Launch|Grow|Enterprise]
                                  Your IEX Cloud Price plan
  --alpha-vantage-api-key TEXT    Your Alpha Vantage Api Key
  --alpha-vantage-price-plan [Free|Plan30|Plan75|Plan150|Plan300|Plan600|Plan1200]
                                  Your Alpha Vantage Premium API Key plan
  --coinapi-api-key TEXT          Your coinapi.io Api Key
  --coinapi-product [Free|Startup|Streamer|Professional|Enterprise]
                                  CoinApi pricing plan (https://www.coinapi.io/market-data-api/pricing)
  --terminal-link-connection-type [DAPI|SAPI]
                                  Terminal Link Connection Type [DAPI, SAPI]
  --terminal-link-server-auth-id TEXT
                                  The Auth ID of the TerminalLink server
  --terminal-link-environment [Production|Beta]
                                  The environment to run in
  --terminal-link-server-host TEXT
                                  The host of the TerminalLink server
  --terminal-link-server-port INTEGER
                                  The port of the TerminalLink server
  --terminal-link-openfigi-api-key TEXT
                                  The Open FIGI API key to use for mapping options
  --lean-config FILE              The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/optimize.pylean project-createCreate a new project containing starter code.Usage: lean project-create [OPTIONS] NAME

  Create a new project containing starter code.

  If NAME is a path containing subdirectories those will be created automatically.

  The default language can be set using `lean config set default-language python/csharp`.

Options:
  -l, --language [python|csharp]  The language of the project to create
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/project_create.pylean project-deleteDelete a project locally and in the cloud if it exists.Usage: lean project-delete [OPTIONS] PROJECT

  Delete a project locally and in the cloud if it exists.

  The project is selected by name or cloud id.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/project_delete.pylean reportGenerate a report of a backtest.Usage: lean report [OPTIONS]

  Generate a report of a backtest.

  This runs the LEAN Report Creator in Docker to generate a polished, professional-grade report of a backtest.

  If --backtest-results is not given, a report is generated for the most recent local backtest.

  The name, description, and version are optional and will be blank if not given.

  If the given backtest data source file is stored in a project directory (or one of its subdirectories, like the
  default <project>/backtests/<timestamp>), the default name is the name of the project directory and the default
  description is the description stored in the project's config.json file.

  By default the official LEAN engine image is used. You can override this using the --image option. Alternatively you
  can set the default engine image for all commands using `lean config set engine-image <image>`.

Options:
  --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, --detach                 Run the report creator in a detached Docker container and return immediately
  --strategy-name TEXT         Name of the strategy, will appear at the top-right corner of each page
  --strategy-version TEXT      Version number of the strategy, will appear next to the project name
  --strategy-description TEXT  Description of the strategy, will appear under the 'Strategy Description' section
  --overwrite                  Overwrite --report-destination if it already contains a file
  --image TEXT                 The LEAN engine image to use (defaults to quantconnect/lean:latest)
  --update                     Pull the LEAN engine image before running the report creator
  --pdf                        Create 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)
  --verbose                    Enable debug logging
  --help                       Show this message and exit.See code:lean/commands/report.pylean researchRun a Jupyter Lab environment locally using Docker.Usage: lean research [OPTIONS] PROJECT

  Run a Jupyter Lab environment locally using Docker.

  By default the official LEAN research image is used. You can override this using the --image option. Alternatively you
  can set the default research image using `lean config set research-image <image>`.

Options:
  --port INTEGER                  The port to run Jupyter Lab on (defaults to 8888)
  --data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|CoinApi|QuantConnect|Local|Terminal Link]
                                  Update the Lean configuration file to retrieve data from the given historical provider
  --iqfeed-iqconnect TEXT         The path to the IQConnect binary
  --iqfeed-username TEXT          Your IQFeed username
  --iqfeed-password TEXT          Your IQFeed password
  --iqfeed-version TEXT           The product version of your IQFeed developer account
  --iqfeed-host TEXT              The IQFeed host address
  --polygon-api-key TEXT          Your Polygon.io API Key
  --iex-cloud-api-key TEXT        Your iexcloud.io API token publishable key
  --iex-price-plan [Launch|Grow|Enterprise]
                                  Your IEX Cloud Price plan
  --alpha-vantage-api-key TEXT    Your Alpha Vantage Api Key
  --alpha-vantage-price-plan [Free|Plan30|Plan75|Plan150|Plan300|Plan600|Plan1200]
                                  Your Alpha Vantage Premium API Key plan
  --coinapi-api-key TEXT          Your coinapi.io Api Key
  --coinapi-product [Free|Startup|Streamer|Professional|Enterprise]
                                  CoinApi pricing plan (https://www.coinapi.io/market-data-api/pricing)
  --terminal-link-connection-type [DAPI|SAPI]
                                  Terminal Link Connection Type [DAPI, SAPI]
  --terminal-link-server-auth-id TEXT
                                  The Auth ID of the TerminalLink server
  --terminal-link-environment [Production|Beta]
                                  The environment to run in
  --terminal-link-server-host TEXT
                                  The host of the TerminalLink server
  --terminal-link-server-port INTEGER
                                  The port of the TerminalLink server
  --terminal-link-openfigi-api-key TEXT
                                  The Open FIGI API key to use for mapping options
  --download-data                 Update the Lean configuration file to download data from the QuantConnect API, alias
                                  for --data-provider-historical QuantConnect
  --data-purchase-limit INTEGER   The maximum amount of QCC to spend on downloading data during the research session
                                  when using QuantConnect as historical data provider
  -d, --detach                    Run Jupyter Lab in a detached Docker container and return immediately
  --no-open                       Don't open the Jupyter Lab environment in the browser after starting it
  --image TEXT                    The LEAN research image to use (defaults to quantconnect/research:latest)
  --update                        Pull the LEAN research image before starting the research environment
  --extra-docker-config TEXT      Extra docker configuration as a JSON string. For more information https://docker-
                                  py.readthedocs.io/en/stable/containers.html
  --no-update                     Use the local LEAN research image instead of pulling the latest version
  --lean-config FILE              The Lean configuration file that should be used (defaults to the nearest lean.json)
  --verbose                       Enable debug logging
  --help                          Show this message and exit.See code:lean/commands/research.pylean whoamiDisplay who is logged in.Usage: lean whoami [OPTIONS]

  Display who is logged in.

Options:
  --verbose  Enable debug logging
  --help     Show this message and exit.See code:lean/commands/whoami.pyDevelopmentTo work on the Lean CLI, clone the repository, enter an environment containing Python 3.7+ and runpip install -r requirements.txt. This command will install the required dependencies and installs the CLI in editable mode. This means you'll be able to edit the code and immediately see the results the next time you runlean.If you need to add dependencies, first updatesetup.py(if it is a production dependency) orrequirements.txt(if it is a development dependency) and then re-runpip install -r requirements.txt.The automated tests can be ran by runningpytest. The filesystem and HTTP requests are mocked when running tests to make sure they run in an isolated environment.Can build the lean CLI by runningpython setup.py sdist bdist_wheelfrom the root of the project and to install itpip install --force-reinstall dist/lean-dev-py3-none-any.whl. To update the commands reference part of the readme runpython scripts/readme.pyfrom the root of the project, after installing the new version.Maintainers can publish new releases by pushing a Git tag containing the new version to GitHub. This will trigger a GitHub Actions workflow which releases the currentmasterbranch to PyPI with the value of the tag as version. Make sure the version is not prefixed with "v".