From 1e7a0deb2fe7200be017c210474ae180881b9e95 Mon Sep 17 00:00:00 2001 From: Martin Molinero Date: Wed, 11 Dec 2024 17:58:12 -0300 Subject: [PATCH] Dotnet 9 --- .../QuantConnect.Algorithm.CSharp.csproj | 2 +- .../QuantConnect.Algorithm.Framework.csproj | 2 +- .../QuantConnect.Algorithm.Python.csproj | 2 +- Algorithm/QuantConnect.Algorithm.csproj | 2 +- .../QuantConnect.AlgorithmFactory.csproj | 2 +- Api/QuantConnect.Api.csproj | 2 +- Brokerages/QuantConnect.Brokerages.csproj | 2 +- Common/Brokerages/BybitBrokerageModel.cs | 1 + Common/QuantConnect.csproj | 2 +- Common/Util/LinqExtensions.cs | 12 ------------ Compression/QuantConnect.Compression.csproj | 2 +- Configuration/QuantConnect.Configuration.csproj | 2 +- DockerfileJupyter | 3 --- ...ntConnect.DownloaderDataProvider.Launcher.csproj | 2 +- Engine/DataFeeds/Enumerators/RefreshEnumerator.cs | 5 ++++- Engine/QuantConnect.Lean.Engine.csproj | 2 +- Indicators/QuantConnect.Indicators.csproj | 2 +- Launcher/QuantConnect.Lean.Launcher.csproj | 2 +- Logging/QuantConnect.Logging.csproj | 2 +- Messaging/QuantConnect.Messaging.csproj | 2 +- .../QuantConnect.Optimizer.Launcher.csproj | 2 +- Optimizer/QuantConnect.Optimizer.csproj | 2 +- Queues/QuantConnect.Queues.csproj | 2 +- Report/QuantConnect.Report.csproj | 2 +- Research/QuantConnect.Research.csproj | 2 +- .../Indicators/PythonIndicatorNoinheritanceTests.cs | 2 +- .../PythonIndicatorNoinheritanceTestsLegacy.cs | 2 +- Tests/Indicators/PythonIndicatorTests.cs | 2 +- Tests/Indicators/TestHelper.cs | 2 +- Tests/QuantConnect.Tests.csproj | 13 ++++++++++--- ToolBox/QuantConnect.ToolBox.csproj | 2 +- 31 files changed, 41 insertions(+), 45 deletions(-) diff --git a/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj b/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj index bf9c3ff262da..3b86b148aaec 100644 --- a/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj +++ b/Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Algorithm.CSharp QuantConnect.Algorithm.CSharp - net6.0 + net9.0 false bin\$(Configuration)\ AllEnabledByDefault diff --git a/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj b/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj index fa1f265c6a54..84f5c496f0a5 100644 --- a/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj +++ b/Algorithm.Framework/QuantConnect.Algorithm.Framework.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Algorithm.Framework QuantConnect.Algorithm.Framework - net6.0 + net9.0 false bin\$(Configuration)\ AllEnabledByDefault diff --git a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj index eab90b412dad..661aa9769e96 100644 --- a/Algorithm.Python/QuantConnect.Algorithm.Python.csproj +++ b/Algorithm.Python/QuantConnect.Algorithm.Python.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Algorithm.Python QuantConnect.Algorithm.Python - net6.0 + net9.0 AllEnabledByDefault bin\$(Configuration)\ false diff --git a/Algorithm/QuantConnect.Algorithm.csproj b/Algorithm/QuantConnect.Algorithm.csproj index af31c8e90149..2f56b3634017 100644 --- a/Algorithm/QuantConnect.Algorithm.csproj +++ b/Algorithm/QuantConnect.Algorithm.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Algorithm QuantConnect.Algorithm - net6.0 + net9.0 ..\ false AllEnabledByDefault diff --git a/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj b/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj index 29f454310502..1cfd0a97ade2 100644 --- a/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj +++ b/AlgorithmFactory/QuantConnect.AlgorithmFactory.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.AlgorithmFactory QuantConnect.AlgorithmFactory - net6.0 + net9.0 false bin\$(Configuration)\ AllEnabledByDefault diff --git a/Api/QuantConnect.Api.csproj b/Api/QuantConnect.Api.csproj index 109e307ff0d2..ce418f98ec03 100644 --- a/Api/QuantConnect.Api.csproj +++ b/Api/QuantConnect.Api.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Api QuantConnect.Api - net6.0 + net9.0 ..\ true AllEnabledByDefault diff --git a/Brokerages/QuantConnect.Brokerages.csproj b/Brokerages/QuantConnect.Brokerages.csproj index cc3a37530ffb..d2222ce6e49a 100644 --- a/Brokerages/QuantConnect.Brokerages.csproj +++ b/Brokerages/QuantConnect.Brokerages.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Brokerages QuantConnect.Brokerages - net6.0 + net9.0 AllEnabledByDefault false bin\$(Configuration)\ diff --git a/Common/Brokerages/BybitBrokerageModel.cs b/Common/Brokerages/BybitBrokerageModel.cs index 7c6a3e5295ac..d687ba88ad12 100644 --- a/Common/Brokerages/BybitBrokerageModel.cs +++ b/Common/Brokerages/BybitBrokerageModel.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; +using System.Linq; using QuantConnect.Benchmarks; using QuantConnect.Orders; using QuantConnect.Orders.Fees; diff --git a/Common/QuantConnect.csproj b/Common/QuantConnect.csproj index 088dfd992381..ca20add0d8f8 100644 --- a/Common/QuantConnect.csproj +++ b/Common/QuantConnect.csproj @@ -2,7 +2,7 @@ Debug AnyCPU - net6.0 + net9.0 QuantConnect.Common ..\ true diff --git a/Common/Util/LinqExtensions.cs b/Common/Util/LinqExtensions.cs index 2117e2d03b82..38c4ae89ec58 100644 --- a/Common/Util/LinqExtensions.cs +++ b/Common/Util/LinqExtensions.cs @@ -26,18 +26,6 @@ namespace QuantConnect.Util /// public static class LinqExtensions { - /// - /// Creates a dictionary enumerable of key value pairs - /// - /// The key type - /// The value type - /// The IEnumerable of KeyValuePair instances to convert to a dictionary - /// A dictionary holding the same data as the enumerable - public static Dictionary ToDictionary(this IEnumerable> enumerable) - { - return enumerable.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - } - /// /// Creates a new read-only dictionary from the key value pairs /// diff --git a/Compression/QuantConnect.Compression.csproj b/Compression/QuantConnect.Compression.csproj index 083aefed130b..c5f4799bfbed 100644 --- a/Compression/QuantConnect.Compression.csproj +++ b/Compression/QuantConnect.Compression.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Compression QuantConnect.Compression - net6.0 + net9.0 AllEnabledByDefault false bin\$(Configuration)\ diff --git a/Configuration/QuantConnect.Configuration.csproj b/Configuration/QuantConnect.Configuration.csproj index f0ef8301c96a..9b27b189cedf 100644 --- a/Configuration/QuantConnect.Configuration.csproj +++ b/Configuration/QuantConnect.Configuration.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Configuration QuantConnect.Configuration - net6.0 + net9.0 ..\ true AllEnabledByDefault diff --git a/DockerfileJupyter b/DockerfileJupyter index 52c078e3e99c..669021394b67 100644 --- a/DockerfileJupyter +++ b/DockerfileJupyter @@ -37,9 +37,6 @@ ENV PYTHONPATH=${WORK}:${PYTHONPATH} RUN mkdir -p /root/.ipython/profile_default/startup/ && \ ln -s /Lean/Launcher/bin/Debug/start.py /root/.ipython/profile_default/startup/start.py -# conda libc is old and causes issues in research we want to use the hosts version which is updated -RUN mkdir -p /opt/miniconda3/lib/ && ln -vsf /lib/x86_64-linux-gnu/libstdc++.so.6 /opt/miniconda3/lib/libstdc++.so.6 - RUN find ${WORK} -type f -not -name '*.py*' -not -name '*.xml' -not -name '*.exe.config' -not -name '*.exe' -not -name '*.so' -not -name '*.dll' -not -name '*.ipynb' -not -name '*.csx' -not -name 'QuantConnect.Lean.Launcher.runtimeconfig.json' -not -name 'decimal.py' -delete # Create initialize script diff --git a/DownloaderDataProvider/QuantConnect.DownloaderDataProvider.Launcher.csproj b/DownloaderDataProvider/QuantConnect.DownloaderDataProvider.Launcher.csproj index 54f42879b7ad..470a284a7adb 100644 --- a/DownloaderDataProvider/QuantConnect.DownloaderDataProvider.Launcher.csproj +++ b/DownloaderDataProvider/QuantConnect.DownloaderDataProvider.Launcher.csproj @@ -6,7 +6,7 @@ Exe QuantConnect.DownloaderDataProvider.Launcher QuantConnect.DownloaderDataProvider.Launcher - net6.0 + net9.0 AllEnabledByDefault false bin\$(Configuration)\ diff --git a/Engine/DataFeeds/Enumerators/RefreshEnumerator.cs b/Engine/DataFeeds/Enumerators/RefreshEnumerator.cs index 72fa82616bba..e28d02fdd0c1 100644 --- a/Engine/DataFeeds/Enumerators/RefreshEnumerator.cs +++ b/Engine/DataFeeds/Enumerators/RefreshEnumerator.cs @@ -60,7 +60,10 @@ public bool MoveNext() try { moveNext = _enumerator.MoveNext(); - _current = _enumerator.Current; + if (moveNext || _current != null) + { + _current = _enumerator.Current; + } } catch (IOException exception) { diff --git a/Engine/QuantConnect.Lean.Engine.csproj b/Engine/QuantConnect.Lean.Engine.csproj index 5d4f43417f73..090746c15c64 100644 --- a/Engine/QuantConnect.Lean.Engine.csproj +++ b/Engine/QuantConnect.Lean.Engine.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Lean.Engine QuantConnect.Lean.Engine - net6.0 + net9.0 ..\ true publish\ diff --git a/Indicators/QuantConnect.Indicators.csproj b/Indicators/QuantConnect.Indicators.csproj index b044f2f14180..1736fc61357d 100644 --- a/Indicators/QuantConnect.Indicators.csproj +++ b/Indicators/QuantConnect.Indicators.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Indicators QuantConnect.Indicators - net6.0 + net9.0 AllEnabledByDefault false bin\$(Configuration)\ diff --git a/Launcher/QuantConnect.Lean.Launcher.csproj b/Launcher/QuantConnect.Lean.Launcher.csproj index be72e18761df..d948abec2537 100644 --- a/Launcher/QuantConnect.Lean.Launcher.csproj +++ b/Launcher/QuantConnect.Lean.Launcher.csproj @@ -5,7 +5,7 @@ Exe QuantConnect.Lean.Launcher QuantConnect.Lean.Launcher - net6.0 + net9.0 AllEnabledByDefault false bin\$(Configuration)\ diff --git a/Logging/QuantConnect.Logging.csproj b/Logging/QuantConnect.Logging.csproj index 4e4aa64991b8..7c932c6eb0d7 100644 --- a/Logging/QuantConnect.Logging.csproj +++ b/Logging/QuantConnect.Logging.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Logging QuantConnect.Logging - net6.0 + net9.0 ..\ true AllEnabledByDefault diff --git a/Messaging/QuantConnect.Messaging.csproj b/Messaging/QuantConnect.Messaging.csproj index a37c4480c6c2..76e896c2c550 100644 --- a/Messaging/QuantConnect.Messaging.csproj +++ b/Messaging/QuantConnect.Messaging.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Messaging QuantConnect.Messaging - net6.0 + net9.0 AllEnabledByDefault false bin\$(Configuration)\ diff --git a/Optimizer.Launcher/QuantConnect.Optimizer.Launcher.csproj b/Optimizer.Launcher/QuantConnect.Optimizer.Launcher.csproj index ddd049dcad3d..7d740baac8bf 100644 --- a/Optimizer.Launcher/QuantConnect.Optimizer.Launcher.csproj +++ b/Optimizer.Launcher/QuantConnect.Optimizer.Launcher.csproj @@ -5,7 +5,7 @@ Exe QuantConnect.Optimizer.Launcher QuantConnect.Optimizer.Launcher - net6.0 + net9.0 true false bin\$(Configuration)\ diff --git a/Optimizer/QuantConnect.Optimizer.csproj b/Optimizer/QuantConnect.Optimizer.csproj index fd82049e648d..d1ffd365f640 100644 --- a/Optimizer/QuantConnect.Optimizer.csproj +++ b/Optimizer/QuantConnect.Optimizer.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Optimizer QuantConnect.Optimizer - net6.0 + net9.0 true false bin\$(Configuration)\ diff --git a/Queues/QuantConnect.Queues.csproj b/Queues/QuantConnect.Queues.csproj index 013e69d19a75..83822ebc3894 100644 --- a/Queues/QuantConnect.Queues.csproj +++ b/Queues/QuantConnect.Queues.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Queues QuantConnect.Queues - net6.0 + net9.0 false bin\$(Configuration)\ bin\$(Configuration)\QuantConnect.Queues.xml diff --git a/Report/QuantConnect.Report.csproj b/Report/QuantConnect.Report.csproj index d35d6b1d3e04..a8ceb5240cdf 100644 --- a/Report/QuantConnect.Report.csproj +++ b/Report/QuantConnect.Report.csproj @@ -5,7 +5,7 @@ Exe QuantConnect.Report QuantConnect.Report - net6.0 + net9.0 true false bin\$(Configuration)\ diff --git a/Research/QuantConnect.Research.csproj b/Research/QuantConnect.Research.csproj index e5bc65cd1c5e..c6c609a2cabf 100644 --- a/Research/QuantConnect.Research.csproj +++ b/Research/QuantConnect.Research.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Research QuantConnect.Research - net6.0 + net9.0 AllEnabledByDefault bin\$(Configuration)\ false diff --git a/Tests/Indicators/PythonIndicatorNoinheritanceTests.cs b/Tests/Indicators/PythonIndicatorNoinheritanceTests.cs index f895a4f59de7..cafef8f5c64a 100644 --- a/Tests/Indicators/PythonIndicatorNoinheritanceTests.cs +++ b/Tests/Indicators/PythonIndicatorNoinheritanceTests.cs @@ -96,7 +96,7 @@ protected override void RunTestIndicator(IndicatorBase indicator) } if (closeIndex * targetIndex < 0) { - Assert.Fail($"Didn't find one of 'Close' or '{line}' in the header: ", TestColumnName); + Assert.Fail($"Didn't find one of 'Close' or '{TestColumnName}' in the header: {line}"); } continue; diff --git a/Tests/Indicators/PythonIndicatorNoinheritanceTestsLegacy.cs b/Tests/Indicators/PythonIndicatorNoinheritanceTestsLegacy.cs index 662b144b0868..b247d37f0c96 100644 --- a/Tests/Indicators/PythonIndicatorNoinheritanceTestsLegacy.cs +++ b/Tests/Indicators/PythonIndicatorNoinheritanceTestsLegacy.cs @@ -95,7 +95,7 @@ protected override void RunTestIndicator(IndicatorBase indicator) } if (closeIndex * targetIndex < 0) { - Assert.Fail($"Didn't find one of 'Close' or '{line}' in the header: ", TestColumnName); + Assert.Fail($"Didn't find one of 'Close' or '{TestColumnName}' in the header: {line}"); } continue; diff --git a/Tests/Indicators/PythonIndicatorTests.cs b/Tests/Indicators/PythonIndicatorTests.cs index b572219f7586..a2807ce13bd9 100644 --- a/Tests/Indicators/PythonIndicatorTests.cs +++ b/Tests/Indicators/PythonIndicatorTests.cs @@ -112,7 +112,7 @@ protected override void RunTestIndicator(IndicatorBase indicator) } if (closeIndex * targetIndex < 0) { - Assert.Fail($"Didn't find one of 'Close' or '{line}' in the header: ", TestColumnName); + Assert.Fail($"Didn't find one of 'Close' or '{TestColumnName}' in the header: {line}"); } continue; diff --git a/Tests/Indicators/TestHelper.cs b/Tests/Indicators/TestHelper.cs index 21b08d17fd2b..0eac582ffde7 100644 --- a/Tests/Indicators/TestHelper.cs +++ b/Tests/Indicators/TestHelper.cs @@ -75,7 +75,7 @@ public static void TestIndicator(IndicatorBase indicator, st { if (!(parts.ContainsKey("Close") && parts.ContainsKey(targetColumn))) { - Assert.Fail("Didn't find one of 'Close' or '{0}' in the header.", targetColumn); + Assert.Fail($"Didn't find one of 'Close' or '{targetColumn}' in the header."); break; } diff --git a/Tests/QuantConnect.Tests.csproj b/Tests/QuantConnect.Tests.csproj index 88daa6e7d5f5..0a712089fda9 100644 --- a/Tests/QuantConnect.Tests.csproj +++ b/Tests/QuantConnect.Tests.csproj @@ -4,7 +4,7 @@ AnyCPU QuantConnect.Tests QuantConnect.Tests - net6.0 + net9.0 ..\ AllEnabledByDefault false @@ -45,13 +45,20 @@ - - + + all + + + + + + + diff --git a/ToolBox/QuantConnect.ToolBox.csproj b/ToolBox/QuantConnect.ToolBox.csproj index 782dc9c5f97a..9ae34cc44de9 100644 --- a/ToolBox/QuantConnect.ToolBox.csproj +++ b/ToolBox/QuantConnect.ToolBox.csproj @@ -5,7 +5,7 @@ Exe QuantConnect.ToolBox QuantConnect.ToolBox - net6.0 + net9.0 AllEnabledByDefault false bin\$(Configuration)\