Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Python code optimization

Hello all,
I create this thread to share all tips, good practices and documents for python code optimization in order to build perfomant trading algorithms.
In the same subject, any help about how to use effciently quantopian functions like history() ... is welcome,
Maybe this can be add to the list of tags.

regards
idriss

2 responses

Don't use any loops, except for the final one to place your orders. Do everything you possibly can with vectorized operations in numpy or pandas.

Isn't optimizing "our" algorithm code like trying to optimize the less important part of the framework?
I wonder if Quantopian platform uses CPython as python interpreter of if they figured out an optimized interprer that works well with the supported libraries (I would say PyPy but numpy compatibility is not complete).