Live Trading



There are risks associated with deploying your algorithms to live trading. Strategy, portfolio, market, counterparty, operational, and error risks can cause you to lose capital. Some of these risks can be out of your control, but there are ways that you can mitigate them.


Strategy risk is the risk that results from designing a strategy based on a statistical model. If you ignore the underlying assumptions of the statistical model, you are exposed to strategy risk. Even if you test that the model assumptions are held, if the market environment changes, the new environment may violate the underlying assumptions of the model after you have deployed it to live trading. Additionally, your strategy development process may be prone to overfitting, survivorship bias, or look-ahead bias, which increases your exposure to strategy risk. To address strategy risk, use rolling parameters when training your statistical models and perform the required statistical tests before training such models.


Portfolio risk is the risk associated with your portfolio as a whole. For instance, you're exposed to portfolio risk if you allocate too much of your portfolio to a particular factor, the capacity of your trading strategies reduces, or the correlation of the strategies in your portfolio increases. To address portfolio risk, diversify your portfolio among multiple factors, monitor the rolling capacity of your trading strategies, and frequently check the correlation of your trading strategies.


Market risk, also known as systematic risk, is the risk that the value of your portfolio will decrease due to the value of the entire market decreasing. Market risk is caused by changes in interest rates, changes in currency exchange rates, geopolitical events, natural disasters, wars, terrorist attacks, and economic recessions. Additionally, central bank announcements and changes to monetary policy can increase overall market volatility and market risk. To address market risk, you can increase diversification, reduce your portfolio beta, hedge your positions with put Options, or hedge against volatility with volatility index securities.


Counterparty risk is the risk that a counterparty with which you engage won't pay an obligation that they have made with you. Most commonly, counterparty risk is associated with the risk that your brokerage goes out of business without returning the trading capital that you have in your brokerage account. Brokerages can go bankrupt just like any other business. To address counterparty risk, diversify your portfolio across multiple brokers that have a strong reputation. If you allocate your capital across multiple brokers and one of them goes out of business, you won't lose all of your trading capital.


Operational risks are the risks within your fund that relate to business operations, such as business risks, regulatory risks, trading infrastructure risks, and the risks of employees committing fraud or quitting. Operational risks are a result of the nature of a trading business, having employees, and regulatory changes. To address operational risks, stay up to date on potential regulatory changes, only hire employees that have signed contracts that protect your firm, use open-source trading infrastructure that's maintained by experts (Lean), and use co-located servers so that you don't need to tend to hardware failures and internet outages.


Error risk is the risk associated with errors occurring in your strategy logic or trading infrastructure. Error risks occur because bugs naturally arise in trading algorithms and the underlying engine that the algorithms use to execute. The Lean trading engine has been under constant development for over 10 years, but there are always more improvements that can be implemented. To address error risk, backtest your trading algorithm before deploying it live to test if it has coding errors, stay up to date on the Lean GitHub Issues, and have close access to your email at all times. If your trading algorithm fails, we notify you through email. You can also enable automatic restarts when you deploy algorithms.

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: