API Reference

lean cloud live deploy

Introduction

Start live trading for a project in the cloud.

$ lean cloud live deploy <project> [options]

Description

Starts live trading for a cloud project. Before starting live trading, the CLI shows an interactive wizard letting you configure the brokerage, data provider, live node, and notifications. After starting live trading, the CLI displays a URL to the live results. You can use the --open flag to automatically open this URL in the browser once the deployment starts.

If you specify the --brokerage and --data-provider-live options, the interactive wizard is skipped and the command runs in non-interactive mode. In this mode, the command doesn't prompt for input or confirmation and reads all configuration from the provided command-line options. In non-interactive mode, all options specific to the selected brokerage become required, as well as --node, --auto-restart, --notify-order-events, and --notify-insights. In case a required option has not been provided, the command falls back to the property with the same name in your Lean configuration file. The command aborts if this property also hasn't been set.

The following options are required for each brokerage in non-interactive mode:

--brokerageRequired Options
"Paper Trading"N/A
Binance--binance-exchange-name
--binance-api-key or --binanceus-api-key
--binance-api-secret or --binanceus-api-secret
--binance-use-testnet
Bitfinex--bitfinex-api-key
--bitfinex-api-secret
Bybit--bybit-api-key
--bybit-api-secret
--bybit-vip-level
"Coinbase Advanced Trade"--coinbase-api-key
--coinbase-api-secret
"Interactive Brokers"--ib-user-name
--ib-account
--ib-password
Kraken--kraken-api-key
--kraken-api-secret
--kraken-verification-tier
Oanda--oanda-account-id
--oanda-access-token
--oanda-environment
Samco--samco-client-id
--samco-client-password
--samco-year-of-birth
--samco-product-type
--samco-trading-segment
TDAmeritrade--tdameritrade-api-key
--tdameritrade-access-token
--tdameritrade-account-number
"Terminal Link"--terminal-link-server-auth-id
--terminal-link-environment
--terminal-link-server-host
--terminal-link-server-port
--terminal-link-emsx-account
--terminal-link-emsx-broker
--terminal-link-openfigi-api-key
Tradier--tradier-account-id
--tradier-access-token
--tradier-environment
"Trading Technologies"--tt-user-name
--tt-session-password
--tt-account-name
--tt-rest-app-key
--tt-rest-app-secret
--tt-rest-environment
--tt-order-routing-sender-comp-id
Zerodha--zerodha-api-key
--zerodha-access-token
--zerodha-product-type
--zerodha-trading-segment
--zerodha-history-subscription

The --data-provider-live option is required. The following table shows the available live data providers and their required options in non-interactive mode. To select multiple data providers, seperate them with a comma. The order you select them in defines the order of precedence.

--data-provider-liveRequired Options
Binance--binance-exchange-name
--binance-api-key or --binanceus-api-key
--binance-api-secret or --binanceus-api-secret
BitfinexAll options required by --brokerage Bitfinex.
BybitAll options required by --brokerage Bybit.
"Coinbase Advanced Trade"--coinbase-api-key
--coinbase-api-secret
IEX--iex-cloud-api-key
--iex-price-plan
"Interactive Brokers"All options required by --brokerage "Interactive Brokers".
KrakenAll options required by --brokerage Kraken.
Oanda--oanda-account-id
--oanda-access-token
Polygon--polygon-api-key
QuantConnectN/A
SamcoAll options required by --brokerage Samco.
TDAmeritradeAll options required by --brokerage TDAmeritrade.
"Terminal Link"All options required by --brokerage "Terminal Link".
Tradier--tradier-account-id
--tradier-access-token
"Trading Technologies"--tt-user-name
--tt-session-password
--tt-account-name
--tt-rest-app-key
--tt-rest-app-secret
--tt-rest-environment
--tt-order-routing-sender-comp-id
ZerodhaAll options required by --brokerage Zerodha.
--zerodha-history-subscription

The --data-provider-historical option specifies the source of historical data. The following table shows the available historical data providers and their required options in non-interactive mode. If the live data provider you set also provides historical data and you omit the --data-provider-historical option, it defaults to the same value as the --data-provider-live option. If the live data provider you set doesn't provide historical data and you omit the --data-provider-historical option, it defaults to the Local data provider.

--data-provider-historicalRequired Options
AlphaVantage--alpha-vantage-api-key
--alpha-vantage-price-plan
IEX--iex-cloud-api-key
--iex-price-plan
Polygon--polygon-api-key
QuantConnectN/A

If you omit some of the required options when running in non-interactive mode, the CLI uses the option values in your LEAN configuration file.

Example non-interactive usage:

$ lean cloud live deploy "My Project" \
    --brokerage "Paper Trading" \
    --data-provider-live QuantConnect \
    --node "My Node" \
    --auto-restart yes
    --notify-order-events no \
    --notify-insights no \
    --push \
    --open

If you have a local copy of the cloud project, you can use the --push option to push local modifications to the cloud before starting live trading.

Arguments

The lean cloud live deploy command expects the following arguments:

ArgumentDescription
<project>The name or Id of the project to start live trading.

Options

The lean cloud live deploy command supports the following options:

OptionDescription
--brokerage <value>The brokerage to use when running in non-interactive mode.
--data-provider-live <value>The live data source.
--data-provider-historical <value>The historical data source.
--ib-user-name <value>Your Interactive Brokers username (example: trader777).
--ib-account <value>Your Interactive Brokers account Id (example: DU1234567).
--ib-password <value>Your Interactive Brokers password.
--ib-weekly-restart-utc-time
--tradier-account-id <value>Your Tradier account id, which you can find on your Settings > API Access page on the Tradier website.
--tradier-access-token <value>Your Tradier access token.
--tradier-environment <value>live to use the live environment or paper to use the developer sandbox.
--oanda-account-id <value>Your OANDA account id, which you can find on your Account Statement page on the OANDA website.
--oanda-access-token <value>Your OANDA API token, which you can generate on the Manage API Access page on the OANDA website.
--oanda-environment <value>Practice to trade on fxTrade Practice or Trade to trade on fxTrade.
--bitfinex-api-key <value>Your Bitfinex API key, which you can generate on the API Management page on the Bitfinex website.
--bitfinex-api-secret <value>Your Bitfinex API secret.
--coinbase-api-key <value>Your Coinbase API key, which you can generate on the API settings page on the Coinbase website.
--coinbase-api-secret <value>Your Coinbase API secret.
--binance-exchange-name <value>Binance, BinanceUS, Binance-USDM-Futures, or Binance-COIN-Futures
--binance-api-key <value>Your Binance API key, which you can generate on the API Management page on the Binance website.
--binanceus-api-key <value>Your Binance US API key, which you can generate on the API Management page on the Binance US website.
--binance-api-secret <value>Your Binance API secret.
--binanceus-api-secret <value>Your Binance US API secret.
--binance-use-testnet <value>live to use the production environment or paper to use the testnet.
--zerodha-api-key <value>Your Kite Connect API key.
--zerodha-access-token <value>Your Zerodha access token.
--zerodha-product-type <value>The product type, which must be mis if you are targeting intraday products, cnc if you are targeting delivery products, or nrml if you are targeting carry forward products.
--zerodha-trading-segment <value>The trading segment, which must be equity if you are trading equities on NSE or BSE, or commodity if you are trading commodities on MCX.
--zerodha-history-subscription <boolean>Whether you have a history API subscription for Zerodha.
--samco-client-id <value>Your Samco account Client ID.
--samco-client-password <value>Your Samco account password.
--samco-year-of-birth <value>Your year of birth (YYYY) registered with Samco.
--samco-product-type <value>The product type, which must be mis if you are targeting intraday products, cnc if you are targeting delivery products, or nrml if you are targeting carry forward products.
--samco-trading-segment <value>The trading segment, which must be equity if you are trading equities on NSE or BSE, or commodity if you are trading commodities on MCX.
--terminal-link-server-auth-id <value>Your unique user identifier (UUID). The UUID is a unique integer identifier that's assigned to each Bloomberg Anywhere user. If you don't know your UUID, contact Bloomberg.
--terminal-link-environment <value>The environment to run in. Production or Beta.
--terminal-link-server-host <value>The public IP address of the SAPI AWS server.
--terminal-link-server-port <value>The port where SAPI is listening. The default port is 8194.
--terminal-link-emsx-broker <value>The EMSX broker to use.
--terminal-link-emsx-account <value>The EMSX account to use.
--terminal-link-openfigi-api-key <value>The OpenFIGI API key to use for mapping options.
--tt-user-name <value>Your Trading Technologies username.
--tt-session-password <value>Your Trading Technologies session password.
--tt-account-name <value>Your Trading Technologies account name.
--tt-rest-app-key <value>Your Trading Technologies REST app key.
--tt-rest-app-secret <value>Your Trading Technologies REST app secret.
--tt-rest-environment <value>The REST environment in which to run.
--tt-order-routing-sender-comp-id <value>The order routing sender comp Id to use.
--kraken-api-key <value>Your Kraken API key, which you can find on the API Management Settings page on the Kraken website.
--kraken-api-secret <value>Your Kraken API secret.
--kraken-verification-tier <value>Your Kraken verification tier (Starter, Intermediate, or Pro). For more information about verification tiers, see Verification levels explained on the Kraken website.
--tdameritrade-api-key <value>Your TDAmeritrade API key.
--tdameritrade-access-token <value>Your TDAmeritrade OAuth Access Token.
--tdameritrade-account-number <value>Your TDAmeritrade account number.
--bybit-api-key <value>Your Bybit API key, which you can generate by following the How to Create Your API Key page on the Bybit website.
--bybit-api-secret <value>Your Bybit API secret.
--bybit-vip-level <value>Your Bybit VIP level (VIP0, VIP1, VIP2, VIP3, VIP4, VIP5, SupremeVIP, Pro1, Pro2, Pro3, Pro4, or Pro5). For more information about the levels, see FAQ — Bybit VIP Program on the Bybit website.
--polygon-api-key <value>Your Polygon API Key.
--iex-cloud-api-keyYour IEX Cloud API Key.
--iex-price-planYour IEX Cloud price plan. Launch, Grow, or Enterprise.
--coinapi-api-key
--coinapi-product
--node <value>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 <email> <subject>A comma-separated list of "email:subject" pairs configuring email-notifications.
--notify-webhooks <url> <headers>A comma-separated list of "url:HEADER_1=VALUE_1:HEADER_2=VALUE_2:etc" pairs configuring webhook-notifications.
--notify-sms <value>A comma-separated list of phone numbers configuring SMS notifications.
--notify-telegram <value>A comma-separated list of "user/group Id:token(optional)" pairs configuring telegram notifications.
--live-cash-balance <value>A comma-separated list of "currency:amount" pairs that define the initial cash balance.
--live-holdings <value>A comma-separated list of "symbol:symbolId:quantity:averagePrice" pairs that define the initial portfolio holdings. For example, "GOOG:GOOCV VP83T1ZUHROL:10:50.0".
--pushPush local modifications to the cloud before starting live trading.
--openAutomatically open the live results in the browser once the deployment starts.
--show-secrets
--verboseEnable debug logging.
--helpDisplay the help text of the lean cloud live deploy 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: