Live Trading

Getting Started


A live algorithm is an algorithm that trades in real-time with real market data. QuantConnect enables you to run your algorithms in live mode with real-time market data. Deploy your algorithms using QuantConnect because our infrastructure is battle-tested. We have successfully hosted more than 200,000 live algorithms and have had more than $22B in volume traded on our servers since 2015. The algorithms that our members create are run on co-located servers and the trading infrastructure is maintained at all times by our team of engineers. It's common for members to achieve 6-months of uptime with no interruptions.

Deploy Live Algorithms

The following video demonstrates how to deploy live paper trading algorithms:

Deploy a live algorithm

You must have an available live trading node for each live trading algorithm you deploy.

Follow these steps to deploy a live paper trading algorithm:

  1. Open the project that you want to deploy.
  2. Click the Deploy live icon Deploy Live icon.
  3. On the Deploy Live page, click the Brokerage field and then click Paper Trading from the drop-down menu.
  4. Click the Node field and then click the live trading node that you want to use from the drop-down menu.
  5. (Optional) Follow these steps to start the algorithm with existing cash holdings (see video):
    1. In the Algorithm Cash State section, click Show.
    2. Click Add Currency.
    3. Enter the currency ticker (for example, USD or BTC) and a quantity.
  6. (Optional) Follow these steps to start the algorithm with existing position holdings (see video):
    1. In the Algorithm Holdings State section, click Show.
    2. Click Add Holding.
    3. Enter the symbol ID, symbol, quantity, and average price.
  7. (Optional) Set up notifications.
  8. Configure the Automatically restart algorithm setting.
  9. By enabling automatic restarts, the algorithm will use best efforts to restart the algorithm if it fails due to a runtime error. This can help improve the algorithm's resilience to temporary outages such as a brokerage API disconnection.

  10. Click Deploy.

The deployment process can take up to 5 minutes. When the algorithm deploys, the live results page displays. If you know your brokerage positions before you deployed, you can verify they have been loaded properly by checking your equity value in the runtime statistics, your cashbook holdings, and your position holdings.

To deploy a live algorithm with a different brokerage, see the Deploy Live Algorithms section of the brokerage integration documentation.

Stop Live Algorithms

The live trading results page has a Stop button to immediately stop your algorithm from executing. When you stop a live algorithm, your portfolio holdings are retained. Stop your algorithm if you want to perform any of the following actions:

  • Update your project's code files
  • Upgrade the live trading node
  • Update the settings you entered into the deployment wizard
  • Place manual orders through your brokerage account instead of the web IDE

Furthermore, if you receive new securities in your portfolio because of a reverse merger, you also need to stop and redeploy the algorithm.

LEAN actively terminates live algorithms when it detects interference outside of the algorithm's control to avoid conflicting race conditions between the owner of the account and the algorithm, so avoid manipulating your brokerage account and placing manual orders on your brokerage account while your algorithm is running. If you need to adjust your brokerage account holdings, stop the algorithm, manually place your trades, and then redeploy the algorithm.

Follow these steps to stop your algorithm:

  1. Open your algorithm's live results page.
  2. Click Stop.
  3. Click Stop again.

Liquidate Live Algorithms

The live results page has a Liquidate button that acts as a "kill switch" to sell all of your portfolio holdings. If your algorithm has a bug in it that caused it to purchase a lot of securities that you didn't want, this button let's you easily liquidate your portfolio instead of placing many manual trades. When you click the Liquidate button, if the market is open for an asset you hold, the algorithm liquidates it with market orders. If the market is not open, the algorithm places market on open orders. After the algorithm submits the liquidation orders, it stops executing.

Follow these steps to liquidate your positions:

  1. Open your algorithm's live results page.
  2. Click Liquidate.
  3. Click Liquidate again.

On-Premise Live Algorithms

For information about on-premise live trading with Local Platform, see Getting Started.

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: