Back to Community
Does Quantopian allow multithreading?

If I need to perform parallelization, to optimize the hyperparameters in machine learning for example, then is it possible to use multithreading for more efficient calculation?

8 responses


This is unfortunate. They provide and have capital but the platform as is today only allows certain types of algorithms (mostly "basic"). Any realistic strategies that requires heavy computations are out of scope. I have a relatively simple strategy and tried to make it robust with some additional statistical tests and it does not finish on time on this platform.

Hi Pravin -

Are the tests run in before_trading_start? It has a 5-minute time-out.

Also, I'm wondering if your statistical tests could be improved for execution speed (e.g. by writing custom versions, if you are using off-the-shelf versions from libraries)?

Hi Grant,

I tried moving tests to before_trading_start. There are two issues with that:
1. The prices are not latest.
2. The backtest has to be run overnight. Takes so long.

Regarding writing custom versions of all the standard libraries is a huge task! I am seriously considering buying my own data cloud on That will help me during my research phase and can port the algorithm to Quantopian once it is ready.

Disclaimer: I am not affiliated to in any way.

Well, how do you know that the "statistical tests" are doing anything for you? Needing to run a backtest overnight suggests that something may be amiss. Could your fancy statistical tests be replaced with something simpler (i.e. computationally efficient) without significant degradation in your strategy?

Also, if you are trading frequently, with lots of turnover, I'd be sure to test with:



Grant. I use FixedBasisPointsSlippage() and am trading only once a day.

Regarding relevance of tests that is another story. Bottom line is that Quantopian does not scale. Try the simple machine learning algorithm (I think version 3 is very popular) posted in forums.

Or for that matter try clustering stocks from universe in before_trading_start and you will realise.

I understand that you can always fit it to work with Quantopian but that defeats the purpose.

Generally, I agree with your sentiment. I suspect we'll eventually see some movement in the area of high(er)-performance computing (HPC) on Q. My read is that Q has basically been working to implement the basic framework on for the last year or so. The latest (and last?) addition is the risk model. I give them credit for laying out a plan and executing it in a focused way.

I think so too Grant. I am not saying that they are not doing a great job but speed of backtesting has been a pain for a while now.