Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Most Efficient Way to Iterate Through Pairs?

Hi all,

I'm new to Quantopian and its pipeline system and was wondering if someone could help me out!

I want to create an algorithm that will iterate through all pairs of stocks looking for pairs to use in a typical pairs trading algorithm. Is the best way to do this simply to create a pipeline with all relevant data, and then manually iterate through each pair in the resultant data frame? Or is there a more efficient way to compare pairs directly in the pipeline? I'm worried about performance/memory issues.

Any advice would be much appreciated.

2 responses

Maybe take a look at these two posts. The first focusses on how to reduce the number of pairs to analyze.
https://www.quantopian.com/posts/pairs-trading-with-machine-learning
https://www.quantopian.com/posts/pipeline-pair-cointegration-notebook-3700-cointegrated-pairs

Thanks for the links!