Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Please Help Gauge my Algorithm

Hey folks, I'm new here and currently going through the Quantopian tutorials. I must say that I find them to be well-written.

To my question: I generated a factor and tested with Alphalens as per the tutorial. Out of curiosity, I decided to do a back test and thus copied my code from Notebook to Algorithm. In Algorithm, I set a simple criterion to choose stocks to long and short. The criterion was to short the bottom 75 assets and long the top 75 assets ranked by my chosen factor. I did a backtest and obtained positive returns. My issue is that my choice for long and short was arbitrary. I would like your input regarding if my approach makes sense and hw I can improve it. Thanks

For reference, I am talking about my "make_pipeline" function

2 responses

@Ayo,

Try to replace:

    for sec in pipe_results[pipe_results.longs].index.tolist():  
    for sec in pipe_results[pipe_results.shorts].index.tolist():  

to this:

    for sec in pipe_results[pipe_results['shorts']].index.tolist():  
    for sec in pipe_results[pipe_results['longs']].index.tolist():  

@Vladimir, is there a performance difference between using the dot notation(as I used) and the quotation format that you suggest? Thanks