Release Notes v2.4.0.0

This release adds full Python support to use common Python libraries in your algorithm. It is implemented using the PythonNet library, which allows importing C# classes into Python and vice versa. The new Python algorithms are fully supported in local and cloud trading. Some minor API adjustments exist to use the new library, but most existing Python algorithms should work with no changes. In addition, numerous bug fixes made IB re-connection more resilient, and OANDA Brokerage was updated to support v2 accounts. Download this release from GitHub


  • Full native Python library support.
  • Add support for OANDA v2 accounts.
  • Added OrderType Exercise to OrderJsonConverter.
  • Added NLogHandler for additional logging capabilities.
  • Fix bugs in IEX Data Queue Handler.
  • Add SetTradeBuilder to QCAlgorithm API so users can set their trade builder for statistics.
  • Added Volume Share Slippage Model.
  • Extend LeanData class to generate forex and CFD QuoteBars.
  • Liquidated positions show up tagged with "Liquidated".
  • When backtests drop below $0 equity they are halted.
  • Added Hull Moving Average indicator.
  • Fetch option chains from the OCC website to speed up launching algorithms.

Bug Fixes

  • Update FXCM Brokerage to return QuoteBars in GetHistory request.
  • Fix OANDA Brokerage to return GetHistory requests in the exchange timezone.
  • Fix IB timezone issues in GetHistory and Data Queue Handler.
  • Prevent setting real-time prices when the exchange is closed.
  • Fixed bug updating consolidators with tick data.
  • Fix futures to use quotes for the universe instead of trades.
  • Fix issues with ZB and SGSD30 in the market hours database.
  • Adjusted RAM limit calculations to be less sensitive to short-term spikes.
  • Restart IBGateway each night on IB server disconnection.
  • Allow field selectors to be used with QuoteBars.
  • Removed underlying asset from futures assets.
  • Fix issue calculating holdings in CalculateOrderQuantity.
  • Added NSE data converter to backtest on data from National Stock Exchange of India.
  • Futures expiry date calculated dynamically with date rules.


  • Updated to IB API Version 9.73

Thank you to the community contributors in this release Oswaldo, Ray Bohac, Jay-Jay-D, Anshul, and Ed Rouwendaal!

About LEAN

LEAN aims to empower investors to invest confidently using cutting-edge algorithmic trading technology. Through the power of open source, we are building the world's best algorithmic trading platform, capable of accurately modeling global markets to give you insight into your strategy. Your trading algorithms can be seamlessly deployed from backtesting into production without changing or moving between brokerages. The LEAN user community reaches over 31,000 quants from all over the world. LEAN supports C#, F#, VB, Java, and Python programming languages and can be used in Equity, Forex, CFD, Options, and Futures markets. It supports live paper trading or execution by Interactive Brokers, FXCM, and OANDA Brokerage. For more information, join the LEAN Community on GitHub.