Back

[Update] Python Library Support

We're happy to share that python libraries are now fully supported in QuantConnect. We've completely re-engineered the python stack to use PythonNet which acts as a bridge between Python and .NET enabling use of all your favorite libraries!

The vast majority of the API remains identical but there will be some gotcha's. If you find your python algorithm aren't working anymore you will need to do a little conversion work to get them into the new system. There are 30 examples of the new python net framework in github you can use as a reference.

We've been testing for about 6 months but there will likely be issues in the integration. If you find an issue please let us know through support: support@quantconnect.com 

Thanks Alex and Stefano for all their work!

 

Update Backtest






The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.



Thanks for all of your hard work guys, much appreciated!

1

Is there an option of using sklearn now? I failed importing it for some reason.

1

Yes it should be available next week. We're taking a poll of all the

libraries people want -- are there any others you might need?



Best,

Jared
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Awesome, thank you for the reply and your work! 

Well, there are also keras, theano and tensorflow might be needed in the future:) 

1

That is super. 

Nice work!

1

Would love keras, tensorflow, pandas, and numpy
0

Really appreciate the work and the python implementation
0

At the moment, numpy, pandas and scipy are supported.
We have tested sklearn, blaze, cvxopt, cvxpy, pykalman and statsmodels and they will be available as soon as possible.
 

3

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


+1 for keras, theano and tensorflow 

5

Add a vote for xgboost.

2

I haven't researched PythonNet yet; could a C# algorithm reference the whitelisted Python libraries?

The use case I'm thinking of would involve using C# for all of the trade execution logic, but pass data to one of Python's superior predictive modeling packages for scoring?

3

With Python.NET, a C# algorithm can import the whitelisted Python libraries.
We will work on this idea/suggestion. Thank you.

2

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update.
Here is the whilelist as of today (20170602): pycparser, pandas, scipy, numpy, sklearn, blaze, cvxopt, cvxpy, pykalman, statistics, statsmodels, arch, copulalib, xgboost, theano, keras and tensorflow.

4

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Would love pyhsmm and pymc3 as well

0

Will you please add Chainer?

0

hi great. thanks
0

I will add to Alexandre Catarino wish list tpot, gplearn and deap

1

i was waiting for python support to go prime.
1

Hey, 

just started playing around with 

https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/MACDTrendAlgorithm.py

and lines 42/43, which are self.PlotIndicator(..) lead to this error:

"Backtest Error: Array type can not be an open generic type".

1

Like Nate Betz says, I would love an option to use Python libs from my C# code or otherwise my own Python code (using said libs) from my C# code to build alpha signal part of my algos. Mainly because Python has better ML tooling (also since Accord.net remains broken on QC cloud). Usually I find C# more productive though and I would certainly prefer to not port my codebase to Python.

0

Hi, what about plotting libraries like matplotlib and seaborn.

 

0

Great news!
0

How about pretty much everything supported by Anaconda?

3

Another +1 for xgboost, keras, theano and tensorflow
2

Hi guys I just landed here and I'm setting up the enviroment. Is there an up to date list of the current available python libraries? How are you guys doing in order to use Keras, Tensorflow, etc. in your algorithms? I saw something about porting data via Lean. Any help on that is appreciated.  

0

GREAT

0

I also think DEAP would make an amazing addition for python users.
2

+1 for more resources on how to enable debugging python scripts in VS lean locally. So far, I found only this. Does it work for others seamlessly?

2

i cound't get it to work either. actually i can't even get the 'auto suggestion' to work. for example when we type 'pandas. ', no suggestion pop up

 

0

Please white-list seaborn as well, thx!

0

Woulld it make sense, secuirty wise, to consider the Dropbox(or other cloud storage api like google storage, etc) package as a quick way to allow for uploading files to a cloud storage? Might be considered a lazy/terrible quickfix to algo/model persistance untill that feature is platform wide?

https://stackoverflow.com/questions/23894221/upload-file-to-my-dropbox-from-python-script
1

Would be great if add PyTorch as well. Thanks!

1

I would like to have the NLTK library (natural language processing)

1

Is there a list of the python libraries that are supported and the version #'s?

I am seeing some known errors with scipy and I'd like to know which version is currently deployed.

Thanks!

Rob

0

Rob Robinson you can see the 'install' scripts here to see exactly what is in the master(may not be live in the cloud yet) version.

To get the working version perhaps you can try something like:
import x as X
#inside init
self.Log(str(X.__version__))

0

That worked great - thanks!

FWIW scipy shows it is installed as version 0.19.1.

#import pycparser
#import pandas
import scipy
#import numpy
#import sklearn
#import blaze
#import cvxopt
#import cvxpy
#import pykalman
#import statistics
#import statsmodels
#import arch
#import copulalib
#import xgboost
#import theano
#import keras
#import tensorflow
#import deap

class BasicTemplateAlgorithm(QCAlgorithm):

def Initialize(self):

self.Log(str(scipy.__version__))

def OnData(self, slice):

pass
0

How to use the latest python 3.0 here? I saw it is supporting python 2.0

2

Does Python Net allow to install talib? Would be useful. I know you support about 100 indicators, but the way TA-LIB manages is different (using Pandas Dataframe, and also is easier to migrate Quantopian algos. 

Thanks.

1

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed