Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Need help with my first algorithm (long-short based on custom factor)

Hi everyone,

I am trying to create my first algorithm, but I hit the wall and now am desperate for your help. My goal is to buy 10 and sell 10 stocks in the beginning of the year and then just wait until the end of the year, no rebalancing. What I'm trying to do:

  1. I've got my custom data set with carbon emissions data - variables 'scope1' , 'scope2' and 'scope3'
  2. I am creating a factor, which is a weighted average of the above three values and call it "carbon_score"
  3. I am filtering algorithm to only tradeable stocks
  4. Creating 10 longs and 10 shorts based on top10 and bottom10 values of carbon_score

There are no bugs seems like, it works both in the Research and the backtesting environments. However, it does not show the returns of the algo. And hence I can't see the performance. I am clearly missing something and it's probably something obvious, but I ran out of options..

2 responses

Hi Ruslan,

Not sure if it's the reason, but I'm just wondering if it's because of the "rebalance" function. It seems the "rebalance" function now is just passed, which is supposed to buy and short the specific securities according to the results of "before_trading_start" function.

@Yongye Jiang , thank you so much! Indeed that was a problem! It works now!!!!!