API Reference

lean cloud live

Introduction

Start live trading for a project in the cloud.

$ lean cloud live <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, the live node, and the 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 option the interactive wizard is skipped and the command runs in non-interactive mode. In this mode the command does not 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.

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

  • --brokerage "Paper Trading"
    • No required options.
  • --brokerage "Interactive Brokers"
    • --ib-user-name: must be set to your Interactive Brokers username (example: trader777).
    • --ib-account: must be set to your Interactive Brokers account id (example: DU1234567).
    • --ib-password: must be set to your Interactive Brokers account password.
    • --ib-data-feed: must be set to yes or no depending on whether you want to use the Interactive Brokers price data feed instead of the one from QuantConnect.
  • --brokerage "Tradier"
    • --tradier-account-id: must be set to your Tradier account id, which you can find on your Settings/API Access page.
    • --tradier-access-token: must be set to your Tradier access token.
    • --tradier-environment: must be set to demo to use the developer sandbox, or live to use the live trading environment.
  • --brokerage "OANDA"
    • --oanda-account-id: must be set to your OANDA account id, which you can find on your Account Statement page.
    • --oanda-access-token: must be set to your OANDA API token, which you can generate on the Manage API Access page.
    • --oanda-environment: must be set to demo for fxTrade Practice or real for fxTrade.
  • --brokerage "Bitfinex"
    • --bitfinex-api-key: must be set to your Bitfinex API key, which you can generate on the API Management page.
    • --bitfinex-api-secret: must be set to your Bitfinex API secret.
  • --brokerage "Coinbase Pro"
    • --gdax-api-key: must be set to your Coinbase Pro API key, which you can generate on the API settings page.
    • --gdax-api-secret: must be set to your Coinbase Pro API secret.
    • --gdax-passphrase: must be set to your Coinbase Pro API passphrase.
    • --gdax-environment: must be set to paper to use the sandbox or live for the production environment.
  • --brokerage "Binance"
    • --binance-api-key: must be set to your Binance API key, which you can generate on your API Settings Management page if you want to use the production environment, or on Binance Testnet if you want to use the demo environment.
    • --binance-api-secret: must be set to your Binance API secret.
    • --binance-environment: must be set to demo to use the testnet or real for the production environment.

Example non-interactive usage:

$ lean cloud live "My Project" \
    --brokerage "Paper Trading" \
    --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 command expects the following arguments:

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

Options

The lean cloud live command supports the following options:

OptionDescription
--brokerage <value>The brokerage to use when running in non-interactive mode.
--ib-user-name <value>Your Interactive Brokers username.
--ib-account <value>Your Interactive Brokers account id.
--ib-password <value>Your Interactive Brokers password.
--ib-data-feed <boolean>Whether the Interactive Brokers price data feed must be used instead of the one from QuantConnect.
--tradier-account-id <value>Your Tradier account id.
--tradier-access-token <value>Your Tradier access token.
--tradier-environment <value>demo if you want to use the developer sandbox, or real if you want to use the live trading environment.
--oanda-account-id <value>Your OANDA account id.
--oanda-access-token <value>Your OANDA API token.
--oanda-environment <value>demo if you want to trade on fxTrade Practice, or real if you want to trade on fxTrade.
--bitfinex-api-key <value>Your Bitfinex API key.
--bitfinex-api-secret <value>Your Bitfinex API secret.
--gdax-api-key <value>Your Coinbase Pro API key.
--gdax-api-secret <value>Your Coinbase Pro API secret.
--gdax-passphrase <value>Your Coinbase Pro API passphrase.
--gdax-environment <value>paper if you want to use the sandbox, or live if you want to use the production environment.
--binance-api-key <value>Your Binance API key.
--binance-api-secret <value>Your Binance API secret.
--binance-environment <value>demo if you want to use the testnet, or real if you want to use the production environment.
--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.
--pushPush local modifications to the cloud before starting live trading.
--openAutomatically open the live results in the browser once the deployment starts.
--verboseEnable debug logging.
--helpDisplay the help text of the lean cloud live 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: