Skip to content

Commit

Permalink
Merge branch 'QuantConnect:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
eramosr16 authored Jan 5, 2024
2 parents f48535f + 1d52e5b commit a893f59
Show file tree
Hide file tree
Showing 2,019 changed files with 185,861 additions and 77,795 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/gh-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@ on:
jobs:
build:
runs-on: ubuntu-20.04
container:
image: quantconnect/lean:foundation
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
- name: Free space
run: df -h && rm -rf /opt/hostedtoolcache* && df -h

- name: Build
run: dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln

- name: Run Tests
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --blame-hang-timeout 300seconds --blame-crash --filter "TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests" -- TestRunParameters.Parameter\(name=\"log-handler\", value=\"ConsoleErrorLogHandler\"\)

- name: Generate & Publish python stubs
if: startsWith(github.ref, 'refs/tags/')
run: |
chmod +x ci_build_stubs.sh
./ci_build_stubs.sh -t -g -p
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
ADDITIONAL_STUBS_REPOS: ${{ secrets.ADDITIONAL_STUBS_REPOS }}
QC_GIT_TOKEN: ${{ secrets.QC_GIT_TOKEN }}
- uses: addnab/docker-run-action@v3
with:
image: quantconnect/lean:foundation
options: --workdir /__w/Lean/Lean -v /home/runner/work:/__w -e GITHUB_REF=${{ github.ref }} -e PYPI_API_TOKEN=${{ secrets.PYPI_API_TOKEN }} -e ADDITIONAL_STUBS_REPOS=${{ secrets.ADDITIONAL_STUBS_REPOS }} -e QC_GIT_TOKEN=${{ secrets.QC_GIT_TOKEN }}
shell: bash
run: |
# Build
dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln && \
# Run Tests
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --blame-hang-timeout 300seconds --blame-crash --filter "TestCategory!=TravisExclude&TestCategory!=ResearchRegressionTests" -- TestRunParameters.Parameter\(name=\"log-handler\", value=\"ConsoleErrorLogHandler\"\) && \
# Generate & Publish python stubs
echo "GITHUB_REF $GITHUB_REF" && if [[ $GITHUB_REF = refs/tags/* ]]; then (chmod +x ci_build_stubs.sh && ./ci_build_stubs.sh -t -g -p); else echo "Skipping stub generation"; fi
22 changes: 14 additions & 8 deletions .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ on:
jobs:
build:
runs-on: ubuntu-20.04
container:
image: quantconnect/lean:foundation
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
- name: Free space
run: df -h && rm -rf /opt/hostedtoolcache* && df -h

- name: Build
run: dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln

- name: Run Tests
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter TestCategory=RegressionTests -- TestRunParameters.Parameter\(name=\"log-handler\", value=\"ConsoleErrorLogHandler\"\) TestRunParameters.Parameter\(name=\"reduced-disk-size\", value=\"true\"\)
- uses: addnab/docker-run-action@v3
with:
image: quantconnect/lean:foundation
options: --workdir /__w/Lean/Lean -v /home/runner/work:/__w
shell: bash
run: |
# Build
dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln
# Run Tests
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter TestCategory=RegressionTests -- TestRunParameters.Parameter\(name=\"log-handler\", value=\"ConsoleErrorLogHandler\"\) TestRunParameters.Parameter\(name=\"reduced-disk-size\", value=\"true\"\)
45 changes: 23 additions & 22 deletions .github/workflows/research-regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,27 @@ on:
jobs:
build:
runs-on: ubuntu-20.04
container:
image: quantconnect/lean:foundation
steps:
- uses: actions/checkout@v2

- name: install dependencies
run: |
pip3 install papermill==2.4.0 clr-loader==0.1.6
- name: install kernel
run: dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.340501

- name: Add dotnet tools to Path
run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH

- name: activate kernel for jupyter
run: dotnet interactive jupyter install

- name: Build
run: dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln

- name: Run Tests
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter TestCategory=ResearchRegressionTests -- TestRunParameters.Parameter\(name=\"log-handler\", value=\"ConsoleErrorLogHandler\"\) TestRunParameters.Parameter\(name=\"reduced-disk-size\", value=\"true\"\)
- name: Checkout
uses: actions/checkout@v2
- name: Free space
run: df -h && rm -rf /opt/hostedtoolcache* && df -h

- uses: addnab/docker-run-action@v3
with:
image: quantconnect/lean:foundation
options: --workdir /__w/Lean/Lean -v /home/runner/work:/__w
shell: bash
run: |
# install dependencies
pip3 install papermill==2.4.0 clr-loader==0.1.6
# install kernel
dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.340501
# Add dotnet tools to Path
export PATH="$HOME/.dotnet/tools:$PATH"
# activate kernel for jupyter
dotnet interactive jupyter install
# Build
dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln
# Run Tests
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter TestCategory=ResearchRegressionTests -- TestRunParameters.Parameter\(name=\"log-handler\", value=\"ConsoleErrorLogHandler\"\) TestRunParameters.Parameter\(name=\"reduced-disk-size\", value=\"true\"\)
102 changes: 45 additions & 57 deletions .github/workflows/virtual-environments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,49 @@ on:
jobs:
build:
runs-on: ubuntu-20.04
container:
image: quantconnect/lean:foundation
steps:
- uses: actions/checkout@v2

- name: Build
run: dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln

- name: Python Virtual Environment System Packages
run: python -m venv /lean-testenv --system-site-packages && . /lean-testenv/bin/activate && pip install --no-cache-dir lean==1.0.99 && deactivate

- name: Run Virtual Environment Test System Packages
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonVirtualEnvironmentTests.AssertVirtualEnvironment"

- name: Python Virtual Environment
run: rm -rf /lean-testenv && python -m venv /lean-testenv && . /lean-testenv/bin/activate && pip install --no-cache-dir lean==1.0.99 && deactivate

- name: Run Virtual Environment Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonVirtualEnvironmentTests.AssertVirtualEnvironment"

- name: Run Python Package Tests
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests" --blame-hang-timeout 120seconds --blame-crash

- name: Run Pomegranate & Tigramite Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.PomegranateTest|Tigramite" --blame-hang-timeout 120seconds --blame-crash

- name: Run StableBaselines Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.StableBaselinesTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run AxPlatform Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.AxPlatformTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run NBeats Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.NBeatsTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run TensorlyTest Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorlyTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run NeuralTangents, Ignite Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.NeuralTangentsTest|IgniteTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run TensorflowTest
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorflowTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run TensorflowProbability
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorflowProbabilityTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run Hvplot Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.HvplotTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run Hvplot Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.StellargraphTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run Keras Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.KerasTest" --blame-hang-timeout 120seconds --blame-crash

- name: Run Keras Python Package Test
run: dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.ScikerasTest" --blame-hang-timeout 120seconds --blame-crash
- name: Checkout
uses: actions/checkout@v2
- name: Free space
run: df -h && rm -rf /opt/hostedtoolcache* && df -h

- uses: addnab/docker-run-action@v3
with:
image: quantconnect/lean:foundation
options: --workdir /__w/Lean/Lean -v /home/runner/work:/__w
shell: bash
run: |
# Build
dotnet build /p:Configuration=Release /v:quiet /p:WarningLevel=1 QuantConnect.Lean.sln
# Python Virtual Environment System Packages
python -m venv /lean-testenv --system-site-packages && . /lean-testenv/bin/activate && pip install --no-cache-dir lean==1.0.99 && deactivate
# Run Virtual Environment Test System Packages
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonVirtualEnvironmentTests.AssertVirtualEnvironment"
# Python Virtual Environment
rm -rf /lean-testenv && python -m venv /lean-testenv && . /lean-testenv/bin/activate && pip install --no-cache-dir lean==1.0.99 && deactivate
# Run Virtual Environment Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonVirtualEnvironmentTests.AssertVirtualEnvironment"
# Run Python Package Tests
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests" --blame-hang-timeout 120seconds --blame-crash
# Run StableBaselines Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.StableBaselinesTest" --blame-hang-timeout 120seconds --blame-crash
# Run AxPlatform Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.AxPlatformTest" --blame-hang-timeout 120seconds --blame-crash
# Run TensorlyTest Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorlyTest" --blame-hang-timeout 120seconds --blame-crash
# Run NeuralTangents, Ignite Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.NeuralTangentsTest|IgniteTest" --blame-hang-timeout 120seconds --blame-crash
# Run TensorflowTest
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorflowTest" --blame-hang-timeout 120seconds --blame-crash
# Run TensorflowProbability
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.TensorflowProbabilityTest" --blame-hang-timeout 120seconds --blame-crash
# Run Hvplot Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.HvplotTest" --blame-hang-timeout 120seconds --blame-crash
# Run Stellargraph Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.StellargraphTest" --blame-hang-timeout 120seconds --blame-crash
# Run Keras Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.KerasTest" --blame-hang-timeout 120seconds --blame-crash
# Run Scikeras Python Package Test
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.ScikerasTest" --blame-hang-timeout 120seconds --blame-crash
# Run Transformers
dotnet test ./Tests/bin/Release/QuantConnect.Tests.dll --filter "FullyQualifiedName=QuantConnect.Tests.Python.PythonPackagesTests.Transformers|XTransformers" --blame-hang-timeout 120seconds --blame-crash
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# OS Files
.DS_Store

# Object files
*.o
*.ko
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,24 @@ public override void OnEndOfAlgorithm()
{"Drawdown", "0.200%"},
{"Expectancy", "-0.585"},
{"Net Profit", "-0.172%"},
{"Sharpe Ratio", "-10.169"},
{"Sharpe Ratio", "-11.13"},
{"Sortino Ratio", "-16.704"},
{"Probabilistic Sharpe Ratio", "12.075%"},
{"Loss Rate", "78%"},
{"Win Rate", "22%"},
{"Profit-Loss Ratio", "0.87"},
{"Alpha", "-0.149"},
{"Alpha", "-0.156"},
{"Beta", "0.035"},
{"Annual Standard Deviation", "0.008"},
{"Annual Variance", "0"},
{"Information Ratio", "-9.603"},
{"Tracking Error", "0.215"},
{"Treynor Ratio", "-2.264"},
{"Treynor Ratio", "-2.478"},
{"Total Fees", "$199.00"},
{"Estimated Strategy Capacity", "$26000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},
{"Portfolio Turnover", "119.89%"},
{"OrderListHash", "3c4c4085810cc5ecdb927d3647b9bbf3"}
{"OrderListHash", "2b4c6d1cb2fc32e25f9a744e8aa7229a"}
};
}
}
9 changes: 5 additions & 4 deletions Algorithm.CSharp/AddAlphaModelAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,24 @@ public override IEnumerable<Insight> Update(QCAlgorithm algorithm, Slice data)
{"Drawdown", "1.700%"},
{"Expectancy", "1.781"},
{"Net Profit", "1.442%"},
{"Sharpe Ratio", "4.86"},
{"Sharpe Ratio", "4.836"},
{"Sortino Ratio", "10.481"},
{"Probabilistic Sharpe Ratio", "59.497%"},
{"Loss Rate", "33%"},
{"Win Rate", "67%"},
{"Profit-Loss Ratio", "3.17"},
{"Alpha", "4.181"},
{"Alpha", "4.164"},
{"Beta", "-1.322"},
{"Annual Standard Deviation", "0.321"},
{"Annual Variance", "0.103"},
{"Information Ratio", "-0.795"},
{"Tracking Error", "0.532"},
{"Treynor Ratio", "-1.18"},
{"Treynor Ratio", "-1.174"},
{"Total Fees", "$14.78"},
{"Estimated Strategy Capacity", "$47000000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},
{"Portfolio Turnover", "41.18%"},
{"OrderListHash", "9da9afe1e9137638a55db1676adc2be1"}
{"OrderListHash", "e07dec6ddf0ef6b5d9c791b0593ec4dc"}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public override void OnEndOfAlgorithm()
{"Expectancy", "0"},
{"Net Profit", "0%"},
{"Sharpe Ratio", "0"},
{"Sortino Ratio", "0"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public override void OnEndOfAlgorithm()
{"Expectancy", "0"},
{"Net Profit", "0%"},
{"Sharpe Ratio", "0"},
{"Sortino Ratio", "0"},
{"Probabilistic Sharpe Ratio", "0%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
Expand Down
9 changes: 5 additions & 4 deletions Algorithm.CSharp/AddBetaIndicatorRegressionAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,24 @@ public override void OnOrderEvent(OrderEvent orderEvent)
{"Drawdown", "0.300%"},
{"Expectancy", "0"},
{"Net Profit", "0.289%"},
{"Sharpe Ratio", "4.233"},
{"Sharpe Ratio", "3.924"},
{"Sortino Ratio", "0"},
{"Probabilistic Sharpe Ratio", "68.349%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "0.035"},
{"Alpha", "0.028"},
{"Beta", "0.122"},
{"Annual Standard Deviation", "0.024"},
{"Annual Variance", "0.001"},
{"Information Ratio", "-3.181"},
{"Tracking Error", "0.142"},
{"Treynor Ratio", "0.842"},
{"Treynor Ratio", "0.78"},
{"Total Fees", "$1.00"},
{"Estimated Strategy Capacity", "$35000000.00"},
{"Lowest Capacity Asset", "IBM R735QTJ8XC9X"},
{"Portfolio Turnover", "1.51%"},
{"OrderListHash", "bd88c6a0e10c7e146b05377205101a12"}
{"OrderListHash", "e930f95771bc50dd2db1c353e054c4e7"}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,24 @@ public override void OnSecuritiesChanged(SecurityChanges changes)
{"Drawdown", "0.000%"},
{"Expectancy", "-1"},
{"Net Profit", "-0.034%"},
{"Sharpe Ratio", "-7.854"},
{"Sharpe Ratio", "-10.666"},
{"Sortino Ratio", "0"},
{"Probabilistic Sharpe Ratio", "1.216%"},
{"Loss Rate", "100%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.022"},
{"Alpha", "-0.029"},
{"Beta", "0.004"},
{"Annual Standard Deviation", "0.003"},
{"Annual Variance", "0"},
{"Information Ratio", "-0.768"},
{"Tracking Error", "0.241"},
{"Treynor Ratio", "-4.689"},
{"Treynor Ratio", "-6.368"},
{"Total Fees", "$8.60"},
{"Estimated Strategy Capacity", "$5500000.00"},
{"Lowest Capacity Asset", "ES VMKLFZIH2MTD"},
{"Portfolio Turnover", "66.80%"},
{"OrderListHash", "802a335b5c355e83b8cd2174f053c1b9"}
{"OrderListHash", "0ade3a7a7aaafa3263082c93cf17c4d8"}
};
}
}
Loading

0 comments on commit a893f59

Please sign in to comment.