From a268fc0ad11dfb7a000729789ae71be987936a10 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 09:51:42 -0600 Subject: [PATCH 01/20] Update CI to run demo algorithms --- .github/actions/setup/action.yml | 43 ++++++++++++++++++ .github/workflows/build.yml | 62 +++----------------------- .github/workflows/rename-build.yml | 71 ++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 57 deletions(-) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/rename-build.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..48ab550 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,43 @@ +name: Setup +description: Liberate disk space, checkout Lean, pull foundation image, define docker helper + +runs: + using: composite + steps: + - name: Liberate disk space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: true + large-packages: false + docker-images: false + swap-storage: false + + - name: Checkout Lean Same Branch + id: lean-same-branch + uses: actions/checkout@v4 + continue-on-error: true + with: + ref: ${{ github.ref }} + repository: QuantConnect/Lean + path: Lean + + - name: Checkout Lean Master + if: steps.lean-same-branch.outcome != 'success' + uses: actions/checkout@v4 + with: + repository: QuantConnect/Lean + path: Lean + + - name: Move Lean + run: mv Lean ../Lean + shell: bash + + - name: Pull foundation image + run: docker pull quantconnect/lean:foundation + shell: bash + + - name: Define docker helper + run: | + echo 'runInContainer() { docker exec test-container "$@"; }' > $HOME/ci_functions.sh + echo "BASH_ENV=$HOME/ci_functions.sh" >> $GITHUB_ENV + shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5093f4c..b2efbd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,40 +13,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Liberate disk space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: true - large-packages: false - docker-images: false - swap-storage: false - - - name: Checkout Lean Same Branch - id: lean-same-branch - uses: actions/checkout@v4 - continue-on-error: true - with: - ref: ${{ github.ref }} - repository: QuantConnect/Lean - path: Lean - - - name: Checkout Lean Master - if: steps.lean-same-branch.outcome != 'success' - uses: actions/checkout@v4 - with: - repository: QuantConnect/Lean - path: Lean - - - name: Move Lean - run: mv Lean ../Lean - - - name: Pull foundation image - run: docker pull quantconnect/lean:foundation - - - name: Define docker helper - run: | - echo 'runInContainer() { docker exec test-container "$@"; }' > $HOME/ci_functions.sh - echo "BASH_ENV=$HOME/ci_functions.sh" >> $GITHUB_ENV + - name: Setup + uses: ./.github/actions/setup - name: Start container run: | @@ -69,26 +37,6 @@ jobs: - name: Stop container run: docker rm -f test-container - - name: Rename Dataset - run: | - cp -r . ../Lean.DataSource.RenameDataset - cd ../Lean.DataSource.RenameDataset - python renameDataset.py RenameDataset - - - name: Start container (renamed) - run: | - docker run -d \ - --workdir /__w/Lean.DataSource.SDK/Lean.DataSource.RenameDataset \ - -v /home/runner/work:/__w \ - --name test-container \ - quantconnect/lean:foundation \ - tail -f /dev/null - - - name: Build Renamed DataSource - run: runInContainer dotnet build ./QuantConnect.DataSource.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 - - - name: Build Renamed Tests - run: runInContainer dotnet build ./tests/Tests.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 - - - name: Run Renamed Tests - run: runInContainer dotnet test ./tests/bin/Release/net10.0/Tests.dll + rename: + needs: build + uses: ./.github/workflows/rename-build.yml diff --git a/.github/workflows/rename-build.yml b/.github/workflows/rename-build.yml new file mode 100644 index 0000000..69f1ff7 --- /dev/null +++ b/.github/workflows/rename-build.yml @@ -0,0 +1,71 @@ +name: Rename & Test + +on: + workflow_call: + +jobs: + rename-build: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Rename Dataset + run: | + cp -r . ../Lean.DataSource.RenameDataset + cd ../Lean.DataSource.RenameDataset + python renameDataset.py RenameDataset + + - name: Start container (renamed) + run: | + docker run -d \ + --workdir /__w/Lean.DataSource.SDK/Lean.DataSource.RenameDataset \ + -v /home/runner/work:/__w \ + --name test-container \ + quantconnect/lean:foundation \ + tail -f /dev/null + + - name: Build Renamed DataSource + run: runInContainer dotnet build ./QuantConnect.DataSource.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 + + - name: Build Renamed Tests + run: runInContainer dotnet build ./tests/Tests.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 + + - name: Run Renamed Tests + run: runInContainer dotnet test ./tests/bin/Release/net10.0/Tests.dll + + - name: Build LEAN Launcher + run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 + + - name: Copy sample data to LEAN Data folder + run: cp -r ../Lean.DataSource.RenameDataset/output/* ../Lean/Data/ + + - name: Run C# Demonstration Algorithm + run: | + cat > ../Lean.DataSource.RenameDataset/demo-csharp-config.json << 'EOF' + { + "algorithm-type-name": "RenameDatasetAlgorithm", + "algorithm-language": "CSharp", + "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", + "data-folder": "../Lean/Data/" + } + EOF + runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json + + - name: Run Python Demonstration Algorithm + run: | + cat > ../Lean.DataSource.RenameDataset/demo-python-config.json << 'EOF' + { + "algorithm-type-name": "RenameDatasetAlgorithm", + "algorithm-language": "Python", + "algorithm-location": "RenameDatasetAlgorithm.py", + "data-folder": "../Lean/Data/" + } + EOF + runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json + + - name: Stop container + run: docker rm -f test-container From 273bc5afe9d1fb3bad9a3d5e991ca4cb6d16760c Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 10:07:36 -0600 Subject: [PATCH 02/20] address review --- .github/workflows/build.yml | 51 ++++++++++++++++++++++++++++-- .github/workflows/rename-build.yml | 31 +++--------------- 2 files changed, 53 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2efbd8..9055fbf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,51 @@ jobs: - name: Stop container run: docker rm -f test-container - rename: - needs: build - uses: ./.github/workflows/rename-build.yml + - name: Run C# Demonstration Algorithm + run: | + cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' + { + "algorithm-type-name": "Demostration", + "algorithm-language": "CSharp", + "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", + "data-folder": "../Lean/Data/" + } + EOF + runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json + + - name: Run Python Demonstration Algorithm + run: | + cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' + { + "algorithm-type-name": "Demostration", + "algorithm-language": "Python", + "algorithm-location": "Demostration.py", + "data-folder": "../Lean/Data/" + } + EOF + runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json + + - name: Run C# Demonstration Universe Algorithm + run: | + cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' + { + "algorithm-type-name": "DemostrationUniverse", + "algorithm-language": "CSharp", + "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", + "data-folder": "../Lean/Data/" + } + EOF + runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json + + - name: Run Python Demonstration Universe Algorithm + run: | + cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' + { + "algorithm-type-name": "DemostrationUniverse", + "algorithm-language": "Python", + "algorithm-location": "DemostrationUniverse.py", + "data-folder": "../Lean/Data/" + } + EOF + runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json + diff --git a/.github/workflows/rename-build.yml b/.github/workflows/rename-build.yml index 69f1ff7..e3ed095 100644 --- a/.github/workflows/rename-build.yml +++ b/.github/workflows/rename-build.yml @@ -1,10 +1,14 @@ name: Rename & Test on: - workflow_call: + push: + branches: ['*'] + pull_request: + branches: [master] jobs: rename-build: + if: github.repository == 'QuantConnect/Lean.DataSource.SDK' runs-on: ubuntu-24.04 steps: - name: Checkout @@ -43,29 +47,4 @@ jobs: - name: Copy sample data to LEAN Data folder run: cp -r ../Lean.DataSource.RenameDataset/output/* ../Lean/Data/ - - name: Run C# Demonstration Algorithm - run: | - cat > ../Lean.DataSource.RenameDataset/demo-csharp-config.json << 'EOF' - { - "algorithm-type-name": "RenameDatasetAlgorithm", - "algorithm-language": "CSharp", - "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", - "data-folder": "../Lean/Data/" - } - EOF - runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json - - - name: Run Python Demonstration Algorithm - run: | - cat > ../Lean.DataSource.RenameDataset/demo-python-config.json << 'EOF' - { - "algorithm-type-name": "RenameDatasetAlgorithm", - "algorithm-language": "Python", - "algorithm-location": "RenameDatasetAlgorithm.py", - "data-folder": "../Lean/Data/" - } - EOF - runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json - - name: Stop container - run: docker rm -f test-container From 88b9da17e4a696bc886ac5e54f2d5184124ebf13 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 10:24:04 -0600 Subject: [PATCH 03/20] Address review 2 --- .github/workflows/build.yml | 23 +++++++++++++---------- .github/workflows/rename-build.yml | 8 -------- renameDataset.py | 2 ++ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9055fbf..83c9414 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,9 @@ jobs: - name: Setup uses: ./.github/actions/setup + - name: Copy sample data to LEAN Data folder + run: cp -r ../Lean.DataSource.SDK/output/* ../Lean/Data/ + - name: Start container run: | docker run -d \ @@ -37,11 +40,11 @@ jobs: - name: Stop container run: docker rm -f test-container - - name: Run C# Demonstration Algorithm + - name: Run C# Demo Algorithm run: | cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' { - "algorithm-type-name": "Demostration", + "algorithm-type-name": "Demonstration", "algorithm-language": "CSharp", "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", "data-folder": "../Lean/Data/" @@ -49,23 +52,23 @@ jobs: EOF runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json - - name: Run Python Demonstration Algorithm + - name: Run Python Demo Algorithm run: | cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' { - "algorithm-type-name": "Demostration", + "algorithm-type-name": "Demonstration", "algorithm-language": "Python", - "algorithm-location": "Demostration.py", + "algorithm-location": "Demonstration.py", "data-folder": "../Lean/Data/" } EOF runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json - - name: Run C# Demonstration Universe Algorithm + - name: Run C# Universe Demo Algorithm run: | cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' { - "algorithm-type-name": "DemostrationUniverse", + "algorithm-type-name": "DemonstrationUniverse", "algorithm-language": "CSharp", "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", "data-folder": "../Lean/Data/" @@ -73,13 +76,13 @@ jobs: EOF runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json - - name: Run Python Demonstration Universe Algorithm + - name: Run Python Universe Demo Algorithm run: | cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' { - "algorithm-type-name": "DemostrationUniverse", + "algorithm-type-name": "DemonstrationUniverse", "algorithm-language": "Python", - "algorithm-location": "DemostrationUniverse.py", + "algorithm-location": "DemonstrationUniverse.py", "data-folder": "../Lean/Data/" } EOF diff --git a/.github/workflows/rename-build.yml b/.github/workflows/rename-build.yml index e3ed095..a28d5a8 100644 --- a/.github/workflows/rename-build.yml +++ b/.github/workflows/rename-build.yml @@ -40,11 +40,3 @@ jobs: - name: Run Renamed Tests run: runInContainer dotnet test ./tests/bin/Release/net10.0/Tests.dll - - - name: Build LEAN Launcher - run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 - - - name: Copy sample data to LEAN Data folder - run: cp -r ../Lean.DataSource.RenameDataset/output/* ../Lean/Data/ - - diff --git a/renameDataset.py b/renameDataset.py index 51ac68f..33d12f3 100644 --- a/renameDataset.py +++ b/renameDataset.py @@ -98,6 +98,7 @@ def main(): # --- Text replacements --- # Order matters: longer/more-specific patterns first to avoid partial matches replacements = [ + ("Lean.DataSource.SDK", root.name), ("MyCustomDataQueueHandler", f"{name}DataQueueHandler"), ("MyCustomDataDownloader", downloader_name), ("MyCustomDataProvider", provider_name), @@ -132,6 +133,7 @@ def main(): "tests/Tests.csproj", "DataProcessing/MyCustomDataDownloader.cs", "DataProcessing/Program.cs", + ".github/workflows/build.yml", ] print("Text replacements:") From f56b503cd0c3ce57939f7bc6a8b61aea90029684 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 10:59:37 -0600 Subject: [PATCH 04/20] Stop the container after running demo algos --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83c9414..18056f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,9 +37,6 @@ jobs: - name: Run Tests run: runInContainer dotnet test ./tests/bin/Release/net10.0/Tests.dll - - name: Stop container - run: docker rm -f test-container - - name: Run C# Demo Algorithm run: | cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' @@ -88,3 +85,6 @@ jobs: EOF runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json + - name: Stop container + run: docker rm -f test-container + From 14e604cb99bc2f6faa840eb18e9a5f0932cb9a29 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 11:15:17 -0600 Subject: [PATCH 05/20] Build the lean launcher before running demos --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18056f6..065cc1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,9 @@ jobs: - name: Run Tests run: runInContainer dotnet test ./tests/bin/Release/net10.0/Tests.dll + - name: Build LEAN Launcher + run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 + - name: Run C# Demo Algorithm run: | cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' From 46a4ab51b154be6d07b7c10c6126b5fcd24c4b79 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 11:54:19 -0600 Subject: [PATCH 06/20] Fix failing CI --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 065cc1b..f74393e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,9 +37,6 @@ jobs: - name: Run Tests run: runInContainer dotnet test ./tests/bin/Release/net10.0/Tests.dll - - name: Build LEAN Launcher - run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /v:quiet /p:WarningLevel=1 - - name: Run C# Demo Algorithm run: | cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' @@ -50,7 +47,7 @@ jobs: "data-folder": "../Lean/Data/" } EOF - runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json + runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-csharp-config.json - name: Run Python Demo Algorithm run: | @@ -62,7 +59,7 @@ jobs: "data-folder": "../Lean/Data/" } EOF - runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json + runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-python-config.json - name: Run C# Universe Demo Algorithm run: | @@ -74,7 +71,7 @@ jobs: "data-folder": "../Lean/Data/" } EOF - runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-csharp-config.json + runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-csharp-config.json - name: Run Python Universe Demo Algorithm run: | @@ -86,8 +83,11 @@ jobs: "data-folder": "../Lean/Data/" } EOF - runInContainer dotnet ../Lean/Launcher/bin/Release/net10.0/QuantConnect.Lean.Launcher.dll --config ./demo-python-config.json + runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-python-config.json - name: Stop container run: docker rm -f test-container + rename: + needs: build + uses: ./.github/workflows/rename-build.yml From 0980399e96b480a6af8435f5363fc328eafcbcc5 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 13:15:54 -0600 Subject: [PATCH 07/20] Make both workflows run --- .github/workflows/rename-build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/rename-build.yml b/.github/workflows/rename-build.yml index a28d5a8..09ff15f 100644 --- a/.github/workflows/rename-build.yml +++ b/.github/workflows/rename-build.yml @@ -1,10 +1,7 @@ name: Rename & Test on: - push: - branches: ['*'] - pull_request: - branches: [master] + workflow_call: jobs: rename-build: From d5b6e0c264fddc87f6183d98f6de9fd2b5b91050 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 13:41:59 -0600 Subject: [PATCH 08/20] Fix algorithm-type-name in config files --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f74393e..79d79f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: run: | cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' { - "algorithm-type-name": "Demonstration", + "algorithm-type-name": "CustomDataAlgorithm", "algorithm-language": "CSharp", "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", "data-folder": "../Lean/Data/" @@ -53,7 +53,7 @@ jobs: run: | cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' { - "algorithm-type-name": "Demonstration", + "algorithm-type-name": "CustomDataAlgorithm", "algorithm-language": "Python", "algorithm-location": "Demonstration.py", "data-folder": "../Lean/Data/" @@ -65,7 +65,7 @@ jobs: run: | cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' { - "algorithm-type-name": "DemonstrationUniverse", + "algorithm-type-name": "CustomDataUniverse", "algorithm-language": "CSharp", "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", "data-folder": "../Lean/Data/" @@ -77,7 +77,7 @@ jobs: run: | cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' { - "algorithm-type-name": "DemonstrationUniverse", + "algorithm-type-name": "CustomDataUniverse", "algorithm-language": "Python", "algorithm-location": "DemonstrationUniverse.py", "data-folder": "../Lean/Data/" From a3719433aca896ad64977cf34689051df4e9429b Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 14:50:09 -0600 Subject: [PATCH 09/20] Update demo algorithm run commands --- .github/workflows/build.yml | 47 ++++++------------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 79d79f8..c60ac65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,53 +37,20 @@ jobs: - name: Run Tests run: runInContainer dotnet test ./tests/bin/Release/net10.0/Tests.dll + - name: Build LEAN Launcher + run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /p:OutputPath=bin/Release /v:quiet /p:WarningLevel=1 + - name: Run C# Demo Algorithm - run: | - cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' - { - "algorithm-type-name": "CustomDataAlgorithm", - "algorithm-language": "CSharp", - "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", - "data-folder": "../Lean/Data/" - } - EOF - runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-csharp-config.json + run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll" --log-handler ConsoleErrorLogHandler --close-automatically true - name: Run Python Demo Algorithm - run: | - cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' - { - "algorithm-type-name": "CustomDataAlgorithm", - "algorithm-language": "Python", - "algorithm-location": "Demonstration.py", - "data-folder": "../Lean/Data/" - } - EOF - runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-python-config.json + run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py" --log-handler ConsoleErrorLogHandler --close-automatically true - name: Run C# Universe Demo Algorithm - run: | - cat > ../Lean.DataSource.SDK/demo-csharp-config.json << 'EOF' - { - "algorithm-type-name": "CustomDataUniverse", - "algorithm-language": "CSharp", - "algorithm-location": "tests/bin/Release/net10.0/Tests.dll", - "data-folder": "../Lean/Data/" - } - EOF - runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-csharp-config.json + run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll" --log-handler ConsoleErrorLogHandler --close-automatically true - name: Run Python Universe Demo Algorithm - run: | - cat > ../Lean.DataSource.SDK/demo-python-config.json << 'EOF' - { - "algorithm-type-name": "CustomDataUniverse", - "algorithm-language": "Python", - "algorithm-location": "DemonstrationUniverse.py", - "data-folder": "../Lean/Data/" - } - EOF - runInContainer dotnet run --project ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj --configuration Release -- --config ./demo-python-config.json + run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language Python --algorithm-type-name CustomDataUniverse --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py" --log-handler ConsoleErrorLogHandler --close-automatically true - name: Stop container run: docker rm -f test-container From a23a21508566acc4088dbd3f0dd9863c913801a2 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 15:07:05 -0600 Subject: [PATCH 10/20] Adjust the run commands --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c60ac65..96ecb8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,16 +41,16 @@ jobs: run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /p:OutputPath=bin/Release /v:quiet /p:WarningLevel=1 - name: Run C# Demo Algorithm - run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll" --log-handler ConsoleErrorLogHandler --close-automatically true + run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Demo Algorithm - run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py" --log-handler ConsoleErrorLogHandler --close-automatically true + run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run C# Universe Demo Algorithm - run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll" --log-handler ConsoleErrorLogHandler --close-automatically true + run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Universe Demo Algorithm - run: runInContainer dotnet ../Lean/Launcher/bin/Release/QuantConnect.Lean.Launcher.dll --data-folder "/__w/Lean.DataSource.SDK/Lean/Data/" --algorithm-language Python --algorithm-type-name CustomDataUniverse --algorithm-location "/__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py" --log-handler ConsoleErrorLogHandler --close-automatically true + run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Stop container run: docker rm -f test-container From 0d92dc23968e7f88107d8f23b296d1ef3de9303e Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 15:24:01 -0600 Subject: [PATCH 11/20] Fix paths --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96ecb8c..bf50759 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,16 +41,16 @@ jobs: run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /p:OutputPath=bin/Release /v:quiet /p:WarningLevel=1 - name: Run C# Demo Algorithm - run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Demo Algorithm - run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run C# Universe Demo Algorithm - run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Universe Demo Algorithm - run: runInContainer bash -c "cd ./Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Stop container run: docker rm -f test-container From f661793401ab9f7f891006bb2d26e2762fb1f3aa Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 15:51:37 -0600 Subject: [PATCH 12/20] Fix path slashes and fix language arg --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf50759..11c30ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,16 +41,16 @@ jobs: run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /p:OutputPath=bin/Release /v:quiet /p:WarningLevel=1 - name: Run C# Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run C# Universe Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Universe Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet .\QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language python--algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Stop container run: docker rm -f test-container From edc86a847b0434c1fafecfa0e5f21b68047f7d0f Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 16:16:21 -0600 Subject: [PATCH 13/20] Copy DataSource to LEAN Launcher --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11c30ad..d94422d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,6 +40,9 @@ jobs: - name: Build LEAN Launcher run: runInContainer dotnet build ../Lean/Launcher/QuantConnect.Lean.Launcher.csproj /p:Configuration=Release /p:OutputPath=bin/Release /v:quiet /p:WarningLevel=1 + - name: Copy DataSource to LEAN Launcher + run: runInContainer cp ./tests/bin/Release/net10.0/QuantConnect.DataSource.MyCustomDataType.dll ../Lean/Launcher/bin/Release/ + - name: Run C# Demo Algorithm run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" From f3bcd52938cd699075352139d923eeb5a88e6c5b Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 16:39:49 -0600 Subject: [PATCH 14/20] Fix Python demo algorithm CI steps --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d94422d..cdb9d2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,13 +47,13 @@ jobs: run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true || [ $? -eq 134 ]' - name: Run C# Universe Demo Algorithm run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" - name: Run Python Universe Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true || [ $? -eq 134 ]' - name: Stop container run: docker rm -f test-container From 7f0824a5968c94926e111af2485218888f931158 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Wed, 11 Mar 2026 17:11:47 -0600 Subject: [PATCH 15/20] Remove log-handler --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cdb9d2e..00a67a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,16 +44,16 @@ jobs: run: runInContainer cp ./tests/bin/Release/net10.0/QuantConnect.DataSource.MyCustomDataType.dll ../Lean/Launcher/bin/Release/ - name: Run C# Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --close-automatically true" - name: Run Python Demo Algorithm - run: runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --log-handler ConsoleErrorLogHandler --close-automatically true || [ $? -eq 134 ]' + run: runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --close-automatically true || [ $? -eq 134 ]' - name: Run C# Universe Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --log-handler ConsoleErrorLogHandler --close-automatically true" + run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --close-automatically true" - name: Run Python Universe Demo Algorithm - run: runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --log-handler ConsoleErrorLogHandler --close-automatically true || [ $? -eq 134 ]' + run: runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/DemonstrationUniverse.py --close-automatically true || [ $? -eq 134 ]' - name: Stop container run: docker rm -f test-container From 02c33a270a6697434d47d39af7cda17516f23f28 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Fri, 13 Mar 2026 11:23:42 -0600 Subject: [PATCH 16/20] Update demo algorithm to check for trades --- Demonstration.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Demonstration.py b/Demonstration.py index 745a3d4..f8412d9 100644 --- a/Demonstration.py +++ b/Demonstration.py @@ -45,3 +45,7 @@ def OnOrderEvent(self, orderEvent): ''' if orderEvent.Status == OrderStatus.Filled: self.Debug(f'Purchased Stock: {orderEvent.Symbol}') + + def OnEndOfAlgorithm(self): + if self.Transactions.Count == 0: + raise Exception("No trades") From 2f1c572a1d009f2915a678c898b5148926ace840 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Fri, 13 Mar 2026 16:47:23 -0600 Subject: [PATCH 17/20] Update Python algorithms to PEP8 --- Demonstration.py | 39 ++++++++++++++++++--------------------- DemonstrationUniverse.py | 29 +++++++++++++++-------------- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/Demonstration.py b/Demonstration.py index f8412d9..cbc301f 100644 --- a/Demonstration.py +++ b/Demonstration.py @@ -17,35 +17,32 @@ ### Example algorithm using the custom data type as a source of alpha ### class CustomDataAlgorithm(QCAlgorithm): - def Initialize(self): + + def initialize(self): ''' Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.''' - - self.SetStartDate(2020, 10, 7) #Set Start Date - self.SetEndDate(2020, 10, 11) #Set End Date - self.equity_symbol = self.AddEquity("SPY", Resolution.Daily).Symbol - self.custom_data_symbol = self.AddData(MyCustomDataType, self.equity_symbol).Symbol + self.set_start_date(2013, 10, 7) + self.set_end_date(2013, 10, 11) + self._equity_symbol = self.add_equity("SPY", Resolution.DAILY).symbol + self._custom_data_symbol = self.add_data(MyCustomDataType, self._equity_symbol).symbol - def OnData(self, slice): + def on_data(self, slice): ''' OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. :param Slice slice: Slice object keyed by symbol containing the stock data ''' - data = slice.Get(MyCustomDataType) - if data: - custom_data = data[self.custom_data_symbol] - if custom_data.SomeCustomProperty == "buy": - self.SetHoldings(self.equitySymbol, 1) - elif custom_data.SomeCustomProperty == "sell": - self.SetHoldings(self.equitySymbol, -1) + custom_data = slice.get(MyCustomDataType) + if custom_data: + point = custom_data[self._custom_data_symbol] + if point.some_custom_property == "buy": + self.set_holdings(self._equity_symbol, 1) + elif point.some_custom_property == "sell": + self.set_holdings(self._equity_symbol, -1) - def OnOrderEvent(self, orderEvent): + def on_order_event(self, order_event): ''' Order fill event handler. On an order fill update the resulting information is passed to this method. - :param OrderEvent orderEvent: Order event details containing details of the events + :param OrderEvent order_event: Order event details containing details of the events ''' - if orderEvent.Status == OrderStatus.Filled: - self.Debug(f'Purchased Stock: {orderEvent.Symbol}') + if order_event.status == OrderStatus.FILLED: + self.debug(f'Purchased Stock: {order_event.symbol}') - def OnEndOfAlgorithm(self): - if self.Transactions.Count == 0: - raise Exception("No trades") diff --git a/DemonstrationUniverse.py b/DemonstrationUniverse.py index c7fa358..14cd425 100644 --- a/DemonstrationUniverse.py +++ b/DemonstrationUniverse.py @@ -17,42 +17,43 @@ ### Example algorithm using the custom data type as a source of alpha ### class CustomDataUniverse(QCAlgorithm): - def Initialize(self): + + def initialize(self): ''' Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. ''' # Data ADDED via universe selection is added with Daily resolution. - self.UniverseSettings.Resolution = Resolution.Daily + self.universe_settings.resolution = Resolution.DAILY - self.SetStartDate(2022, 2, 14) - self.SetEndDate(2022, 2, 18) - self.SetCash(100000) + self.set_start_date(2022, 2, 14) + self.set_end_date(2022, 2, 18) + self.set_cash(100000) # add a custom universe data source (defaults to usa-equity) - universe = self.AddUniverse(MyCustomDataUniverse, self.UniverseSelection) + universe = self.add_universe(MyCustomDataUniverse, self._universe_selection) - history = self.History(universe, TimeSpan(1, 0, 0, 0)) + history = self.history(universe, 1) if len(history) != 1: raise ValueError(f"Unexpected history count {len(history)}! Expected 1") - for dataForDate in history: - if len(dataForDate) < 300: + for data_for_date in history: + if len(data_for_date) < 300: raise ValueError(f"Unexpected historical universe data!") - def UniverseSelection(self, data): + def _universe_selection(self, data): ''' Selected the securities :param List of MyCustomUniverseType data: List of MyCustomUniverseType :return: List of Symbol objects ''' for datum in data: - self.Log(f"{datum.Symbol},{datum.SomeNumericProperty},{datum.SomeCustomProperty}") + self.log(f"{datum.symbol},{datum.some_numeric_property},{datum.some_custom_property}") # define our selection criteria - return [d.Symbol for d in data if d.SomeCustomProperty == 'buy'] + return [d.symbol for d in data if d.some_custom_property == 'buy'] - def OnSecuritiesChanged(self, changes): + def on_securities_changed(self, changes): ''' Event fired each time that we add/remove securities from the data feed :param SecurityChanges changes: Security additions/removals for this time step ''' - self.Log(changes.ToString()) \ No newline at end of file + self.log(changes.to_string()) \ No newline at end of file From 0c95d09d55395b6a7876e92579e7c418cf8e5a6c Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Fri, 13 Mar 2026 16:47:39 -0600 Subject: [PATCH 18/20] Scan logs to ensure the demo algos trade --- .github/workflows/build.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00a67a8..e333dcd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,10 +44,18 @@ jobs: run: runInContainer cp ./tests/bin/Release/net10.0/QuantConnect.DataSource.MyCustomDataType.dll ../Lean/Launcher/bin/Release/ - name: Run C# Demo Algorithm - run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --close-automatically true" + run: | + output=$(runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --close-automatically true" 2>&1) + echo "$output" + echo "$output" | grep -q "STATISTICS:: Total Orders [^0]" || { echo "Algorithm placed no trades"; exit 1; } - name: Run Python Demo Algorithm - run: runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --close-automatically true || [ $? -eq 134 ]' + run: | + output=$(runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --close-automatically true' 2>&1) + rc=$? + echo "$output" + [ $rc -eq 0 ] || [ $rc -eq 134 ] || exit $rc + echo "$output" | grep -q "STATISTICS:: Total Orders [^0]" || { echo "Algorithm placed no trades"; exit 1; } - name: Run C# Universe Demo Algorithm run: runInContainer bash -c "cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language CSharp --algorithm-type-name CustomDataUniverse --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/tests/bin/Release/net10.0/Tests.dll --close-automatically true" From 4f339b1de7185d8eee40ff9b33d5bdd9a4e65806 Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Mon, 16 Mar 2026 08:37:05 -0600 Subject: [PATCH 19/20] Suppress Python GIL exit code so trade check can run --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e333dcd..fa5e487 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,10 +51,8 @@ jobs: - name: Run Python Demo Algorithm run: | - output=$(runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --close-automatically true' 2>&1) - rc=$? + output=$(runInContainer bash -c 'cd ../Lean/Launcher/bin/Release && dotnet ./QuantConnect.Lean.Launcher.dll --data-folder /__w/Lean.DataSource.SDK/Lean/Data/ --algorithm-language Python --algorithm-type-name CustomDataAlgorithm --algorithm-location /__w/Lean.DataSource.SDK/Lean.DataSource.SDK/Demonstration.py --close-automatically true' 2>&1) || true echo "$output" - [ $rc -eq 0 ] || [ $rc -eq 134 ] || exit $rc echo "$output" | grep -q "STATISTICS:: Total Orders [^0]" || { echo "Algorithm placed no trades"; exit 1; } - name: Run C# Universe Demo Algorithm From 45b50cf3fd4ae98c2554d390ff278716beb8674d Mon Sep 17 00:00:00 2001 From: Derek Melchin Date: Mon, 16 Mar 2026 09:32:21 -0600 Subject: [PATCH 20/20] Update checkout to v5 and fix Lean branch ref for PRs --- .github/actions/setup/action.yml | 6 +++--- .github/workflows/build.yml | 2 +- .github/workflows/rename-build.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 48ab550..be88df1 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -14,16 +14,16 @@ runs: - name: Checkout Lean Same Branch id: lean-same-branch - uses: actions/checkout@v4 + uses: actions/checkout@v5 continue-on-error: true with: - ref: ${{ github.ref }} + ref: ${{ github.head_ref || github.ref_name }} repository: QuantConnect/Lean path: Lean - name: Checkout Lean Master if: steps.lean-same-branch.outcome != 'success' - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: repository: QuantConnect/Lean path: Lean diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa5e487..3599f13 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup uses: ./.github/actions/setup diff --git a/.github/workflows/rename-build.yml b/.github/workflows/rename-build.yml index 09ff15f..8130044 100644 --- a/.github/workflows/rename-build.yml +++ b/.github/workflows/rename-build.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup uses: ./.github/actions/setup