Candlestick Charts Support, Customizable Report Templating, Trailing Stop Orders

We have enhanced LEAN Open Source project with the addition of support for Candlestick Charts, the integration of trailing stop orders, and the ability for report generator to use custom HTML templates. Essential bug fixes included overflow correction in RandomDataGenerator, to the minimum price variation for LE future symbol, and updates to Math.Numerics & QLNet. Additionally, an update ensuring 'AlgorithmConfiguration.Parameters' inclusion in the report has been implemented, the symbol-count has been made optional contingent on tickers in the random data generator, and a new feature, UnrealizedPnLPercent, has been added to holdings. Lastly, RangeConsolidator has been implemented to allow users to analyze financial instrument price movements.

Thanks to our dedicated contributors, LEAN continues to improve. ArthurAsenheimer corrected minimum price variations for specific futures, enhancing our trading precision. henrik-strand promptly updated our communication badge from Slack to Discord. Lehonti also contributed to bolster code readability by modernizing argument check exceptions. Your hard work and expertise are sincerely appreciated. Keep up the excellent work!

Features

  • Shipped (#7425): Candlestick charts: As part of the LEAN Open Source project, we've added support for Candlestick charts. Beside this, we've also transitioned the default equity chart to a Candlestick format. The new feature was meticulously validated through unit tests, algorithms, and backtests/live deployments. Lastly, corresponding documentation changes have been made to guide users through the new Candlestick charts.
  • Shipped (#7410): Enable Report generator to use custom HTML template: We've enhanced the LEAN Report generator with custom HTML template capability. By altering "template.html", users can now personalize their report layouts. We have revised 'CrisisReportElement.cs' and 'ParametersReportElement.cs' to utilize chosen templates. We also developed unit tests to assure regex functionality in different scenarios, and assert that the report generator works as expected under various conditions.
  • Shipped (#7402): Trailing stop orders: We have implemented trailing stop orders in our LEAN Open Source project. These orders function similar to 'StopMarketOrders' with the caveat that the stop price is continually updated to follow the highest high for sell orders, or lowest low for buy orders. This feature has been tested across unit tests, regression algorithms, and live trading environments with IB. Documentation changes are necessary for the new order type.
  • Shipped (#7401): Include 'AlgorithmConfiguration.Parameters' in the report generated and allow to override stylesheet: We've updated the LEAN Open Source project to improve the report generation. Now, AlgorithmConfiguration.Parameters will be included within reports. If there are no parameters set, they won't be shown. We also now allow users to override the default stylesheet for these reports. Additionally, we've planned to update our documentation to guide users on how to override the default stylesheet.
  • Shipped (#7390): Make 'symbol-count' optional and dependent on tickers in random data generator: We've optimized the random data generator in our LEAN Open Source project. The 'symbol-count' will now only be mandatory if no tickers are passed. If tickers are passed, the 'symbol-count' will automatically align with the number of tickers. This enhancement underwent successful manual testing.
  • Shipped (#7385): Implement RangeConsolidator: We've implemented RangeConsolidator in our LEAN open source project. This allows users to analyze financial instrument price movements while reducing market noise, by creating 'Range Bars' when a user-set price point is reached. This is accomplished by the 'BaseTimelessConsolidator' abstract class, and two derivates 'RangeConsolidator' and 'ClassicRangeConsolidator'. Functionality proved by unit and regression tests. This offers users a new way to consolidate their strategy data.
  • Shipped (#7358): Add UnrealizedPnLPercent to holdings: We've added a new feature, UnrealizedPnLPercent, to holdings in our LEAN open source project. This will simplify tracking unrealized profit and loss percentage for users, enhancing the overall efficiency of managing investments. No associated issue or documentation change is required. Testing details have not been provided.

Bug Fixes

  • Fixed issue (#7423): Fix overflow bug in RandomDataGenerator by upper bounding prices and lower bounding FinalSplitFactor, tested with unit tests.
  • Fixed issue (#7421): Fix minimum price variation for LE future symbol in QuantConnect Lean.
  • Fixed issue (#7420): Replace Slack chat badge with Discord in project readme.md file.
  • Fixed issue (#7415): Revert breaking plotly update to fix C# plotting in notebooks.
  • Fixed issue (#7413): Fix bug in parameters table in report and add unit tests to cover changes.
  • Fixed issue (#7407): Fix updating 'StopLimitOrder.StopTriggered' flag globally, tested with unit tests and regression algorithms.
  • Fixed issue (#7405): Fix tested by running job in fork and verifying stubs were generated.
  • Fixed issue (#7404): Return valid default value for indicator 'Previous' property.
  • Fixed issue (#7399): Replace default container to enable cleaning up host to fix failing CI.
  • Fixed issue (#7395): Handle API backtest charts read null requests to prevent errors.
  • Fixed issue (#7394): Fix minimum price variation for Futures ZL and HE to 0.0001 and 0.00025 respectively.
  • Fixed issue (#7391): Fix naked index option margin requirement percentage to 15%.
  • Fixed issue (#7382): Minor adjustment to prevent race condition in live trading, adding unit tests.
  • Fixed issue (#7377): Remove expiration check causing errors for live universe subscriptions.
  • Fixed issue (#7376): Improve contract chain selection for futures and options, adding unit tests.
  • Fixed issue (#7374): Fix contract security filter universe with unit tests to reproduce issue.
  • Fixed issue (#7372): Fix download CI unit test tested by running unit test.
  • Fixed issue (#7369): Fix live option chain sources handling, reuse http client for option chain requests, and lazy rate gate initialization.
  • Fixed issue (#7364): : Check continuous future mapped symbol is not expired in live trading and add unit tests.
  • Fixed issue (#7363): Fix 'IsExchangeOpen' bar check in 'FillModel' and 'EquityFillModel' for resolutions < daily. Tested with unit tests and regression algorithms.
  • Fixed issue (#7354): Fix win/loss count and rate statistics for options assignments.

Updates

  • Fixed issue (#7411): Update Math.Numerics & QLNet, add Plotly.NET.Interactive, remove unused FSharp core, tested on cloud deployments.
  • Fixed issue (#7383): Add warning for unsupported live configurations and test with live trading.
  • Fixed issue (#7381): Update debugger version for PyCharm 2023.1.4 to ensure compatibility.
  • Fixed issue (#7373): Improve Tradier Brokerage Model to reject orders with unsupported TimeInForce types and add unit test to cover the change.
  • Fixed issue (#7370): Increase timeout of research start test and minor tweaks to rate gate to avoid random CI test failures.
  • Fixed issue (#7368): Update MHDB CME Group Futures on Good Friday to ensure accurate 2023 trading schedule.
  • Fixed issue (#7366): Update MHDB with 3rd/4th July Holiday hours for NYSE equities, ICE Futures US and CME Group Futures.