Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Two questions about simple fundamentals algorithm

Learning the fundamentals API, here's a simple algorithm that buys companies with a high R&D to enterprise value ratio, and holds them for 70 trading days.

  1. I suspect the results aren't really real. (In general, research shows that high R&D spend results in under-performing stocks, at least in the short term.) Any reason to think otherwise?
  2. I'm having trouble understanding what's going on with the leverage. The algorithm both checks for open orders and tries to look at liquidity, only buying stocks that have traded at reasonable total dollar volumes in the days before the re-balancing. But the leverage rises to about 2, and never settles much below 1.5. (It should settle back to 1.) The reason is that there are some stocks that are never completely sold - the list of holdings keeps increasing. Why is this ... and how do I fix it?

Thanks for the help!

Alan

1 response

I am not sure what is going on but I set

context.number_stocks = 1  

And it seemed to buy more than 100K on the very first transaction which certainly seems to be a bad sign.