QuantConnect.pythonnet
2.0.51
Prefix Reserved
dotnet add package QuantConnect.pythonnet --version 2.0.51
NuGet\Install-Package QuantConnect.pythonnet -Version 2.0.51
<PackageReference Include="QuantConnect.pythonnet" Version="2.0.51" />
<PackageVersion Include="QuantConnect.pythonnet" Version="2.0.51" />
<PackageReference Include="QuantConnect.pythonnet" />
paket add QuantConnect.pythonnet --version 2.0.51
#r "nuget: QuantConnect.pythonnet, 2.0.51"
#:package QuantConnect.pythonnet@2.0.51
#addin nuget:?package=QuantConnect.pythonnet&version=2.0.51
#tool nuget:?package=QuantConnect.pythonnet&version=2.0.51
pythonnet is a package that gives .NET programmers ability to
integrate Python engine and use Python libraries.
Embedding Python in .NET
- You must set
Runtime.PythonDLLproperty orPYTHONNET_PYDLLenvironment variable, otherwise you will receiveBadPythonDllException(internal, derived fromMissingMethodException) upon callingInitialize. Typical values arepython38.dll(Windows),libpython3.8.dylib(Mac),libpython3.8.so(most other *nix). Full path may be required. - All calls to Python should be inside a
using (Py.GIL()) {/* Your code here */}block. - Import python modules using
dynamic mod = Py.Import("mod"), then you can call functions as normal, egmod.func(args). You can also access Python objects viaPyObjectand dervied types instead of usingdynamic. - Use
mod.func(args, Py.kw("keywordargname", keywordargvalue))ormod.func(args, keywordargname: keywordargvalue)to apply keyword arguments. - Mathematical operations involving python and literal/managed types
must have the python object first, eg.
np.pi * 2works,2 * np.pidoesn't.
Example
using var _ = Py.GIL();
dynamic np = Py.Import("numpy");
Console.WriteLine(np.cos(np.pi * 2));
dynamic sin = np.sin;
Console.WriteLine(sin(5));
double c = (double)(np.cos(5) + sin(5));
Console.WriteLine(c);
dynamic a = np.array(new List<float> { 1, 2, 3 });
Console.WriteLine(a.dtype);
dynamic b = np.array(new List<float> { 6, 5, 4 }, dtype: np.int32);
Console.WriteLine(b.dtype);
Console.WriteLine(a * b);
Console.ReadKey();
Output:
1.0
-0.958924274663
-0.6752620892
float64
int32
[ 6. 10. 12.]
Resources
Information on installation, FAQ, troubleshooting, debugging, and projects using pythonnet can be found in the Wiki:
https://github.com/pythonnet/pythonnet/wiki
Mailing list https://mail.python.org/mailman/listinfo/pythondotnet Chat https://gitter.im/pythonnet/pythonnet
.NET Foundation
This project is supported by the .NET Foundation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- fasterflect (>= 3.0.0)
NuGet packages (26)
Showing the top 5 NuGet packages that depend on QuantConnect.pythonnet:
| Package | Downloads |
|---|---|
|
QuantConnect.Common
QuantConnect LEAN Engine: Common Project - A collection of common definitions and utils |
|
|
QuantConnect.Indicators
QuantConnect LEAN Engine: Indicators Project - A collection of financial indicators |
|
|
QuantConnect.Algorithm
QuantConnect LEAN Engine: Algorithm Project - Core QCAlgorithm implementation |
|
|
QuantConnect.Algorithm.Framework
QuantConnect LEAN Engine: Algorithm.Framework Project - The core QCAlgorithm framework implementation |
|
|
QuantConnect.Lean.Engine
QuantConnect LEAN Engine: Engine Project - Core engine and datafeed implementation |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on QuantConnect.pythonnet:
| Repository | Stars |
|---|---|
|
QuantConnect/Lean
Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
|
|
|
Capnode/Algoloop
Windows desktop algo trading with QuantConnect Lean engine.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.51 | 103 | 12/26/2025 |
| 2.0.50 | 19,681 | 10/31/2025 |
| 2.0.49 | 3,597 | 10/21/2025 |
| 2.0.48 | 18,436 | 8/15/2025 |
| 2.0.47 | 516 | 8/14/2025 |
| 2.0.46 | 3,196 | 8/6/2025 |
| 2.0.45 | 724 | 7/31/2025 |
| 2.0.44 | 19,379 | 5/2/2025 |
| 2.0.43 | 250 | 5/1/2025 |
| 2.0.42 | 41,708 | 12/20/2024 |
| 2.0.41 | 6,462 | 12/3/2024 |
| 2.0.40 | 2,015 | 11/1/2024 |
| 2.0.39 | 11,284 | 9/27/2024 |
| 2.0.38 | 52,093 | 5/24/2024 |
| 2.0.37 | 4,105 | 5/14/2024 |
| 2.0.36 | 5,953 | 4/23/2024 |
| 2.0.35 | 6,087 | 4/19/2024 |
| 2.0.34 | 18,626 | 4/17/2024 |
| 2.0.33 | 276 | 4/16/2024 |
| 2.0.32 | 1,608 | 4/15/2024 |
| 2.0.31 | 577 | 4/12/2024 |
| 2.0.30 | 308 | 4/11/2024 |
| 2.0.29 | 6,048 | 3/18/2024 |
| 2.0.28 | 9,466 | 3/5/2024 |
| 2.0.27 | 275 | 3/4/2024 |
| 2.0.26 | 50,331 | 12/8/2023 |
| 2.0.25 | 7,294 | 11/21/2023 |
| 2.0.24 | 10,360 | 10/27/2023 |
| 2.0.23 | 2,884 | 10/19/2023 |
| 2.0.22 | 846 | 10/12/2023 |
| 2.0.21 | 57,547 | 7/11/2023 |
| 2.0.20 | 6,493 | 6/26/2023 |
| 2.0.19 | 316 | 6/26/2023 |
| 2.0.18 | 94,821 | 3/3/2023 |
| 2.0.17 | 132,175 | 8/24/2022 |
| 2.0.16 | 22,205 | 6/27/2022 |
| 2.0.15 | 26,773 | 5/17/2022 |
| 2.0.14 | 5,618 | 5/6/2022 |
| 2.0.13 | 5,029 | 5/2/2022 |
| 2.0.12 | 6,232 | 4/28/2022 |
| 2.0.11 | 82,080 | 12/27/2021 |
| 2.0.10 | 32,772 | 10/22/2021 |
| 2.0.9 | 615 | 10/21/2021 |
| 2.0.8 | 5,627 | 10/13/2021 |
| 2.0.7 | 869 | 10/8/2021 |
| 2.0.6 | 17,023 | 8/26/2021 |
| 2.0.5 | 21,426 | 7/14/2021 |
| 2.0.4 | 35,547 | 6/11/2021 |
| 2.0.3 | 3,802 | 6/8/2021 |
| 2.0.2 | 8,778 | 5/28/2021 |
| 2.0.1 | 22,361 | 3/13/2021 |
| 2.0.0 | 1,168 | 3/9/2021 |
| 1.0.5.30 | 236,337 | 3/31/2020 |
| 1.0.5.29 | 47,158 | 11/13/2019 |
| 1.0.5.28 | 853 | 11/12/2019 |
| 1.0.5.27 | 783 | 11/12/2019 |
| 1.0.5.26 | 9,811 | 10/15/2019 |
| 1.0.5.25 | 6,039 | 9/23/2019 |
| 1.0.5.24 | 6,385 | 9/10/2019 |
| 1.0.5.23 | 926 | 9/5/2019 |
| 1.0.5.22 | 841 | 9/5/2019 |
| 1.0.5.21 | 1,030 | 6/24/2019 |
| 1.0.5.20 | 44,085 | 4/23/2019 |
| 1.0.5.19 | 5,563 | 4/2/2019 |
| 1.0.5.18 | 1,063 | 3/27/2019 |
| 1.0.5.17 | 13,068 | 2/21/2019 |
| 1.0.5.16 | 912 | 2/20/2019 |
| 1.0.5.15 | 10,026 | 1/22/2019 |
| 1.0.5.14 | 1,074 | 1/18/2019 |
| 1.0.5.13 | 1,038 | 1/15/2019 |
| 1.0.5.12 | 11,430 | 8/27/2018 |
| 1.0.5.11 | 1,103 | 8/27/2018 |
| 1.0.5.10 | 1,132 | 8/24/2018 |
| 1.0.5.9 | 1,445 | 7/23/2018 |
| 1.0.5.8 | 41,837 | 7/16/2018 |
| 1.0.5.7 | 306,703 | 4/2/2018 |
| 1.0.5.6 | 1,612 | 4/2/2018 |
| 1.0.5.5 | 3,340 | 2/2/2018 |
| 1.0.5.4 | 2,945 | 12/29/2017 |
| 1.0.5.3 | 1,613 | 12/29/2017 |
| 1.0.5.2 | 1,841 | 11/29/2017 |
| 1.0.5.1 | 3,402 | 10/9/2017 |
| 1.0.5 | 1,579 | 9/29/2017 |
| 1.0.4.8 | 1,727 | 9/12/2017 |
| 1.0.4.7 | 1,354 | 9/8/2017 |
| 1.0.4.6 | 1,355 | 9/4/2017 |
| 1.0.4.5 | 1,369 | 8/21/2017 |
| 1.0.4.4 | 2,981 | 6/23/2017 |
| 1.0.4.3 | 1,435 | 6/23/2017 |
| 1.0.4.2 | 1,385 | 6/22/2017 |
| 1.0.4.1 | 1,354 | 6/22/2017 |
| 1.0.4 | 1,474 | 6/15/2017 |
| 1.0.3.5 | 1,837 | 6/1/2017 |
| 1.0.3.4 | 1,388 | 6/1/2017 |
| 1.0.3.3 | 1,373 | 6/1/2017 |
| 1.0.3.2 | 1,372 | 5/31/2017 |
| 1.0.3.1 | 1,399 | 5/31/2017 |
| 1.0.3 | 1,386 | 5/31/2017 |
| 1.0.2.1 | 1,502 | 5/25/2017 |
| 1.0.2 | 1,429 | 5/23/2017 |
| 1.0.1.1 | 2,322 | 4/11/2017 |
| 1.0.0 | 1,463 | 1/12/2017 |