Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
All NaN Slice & Axis encountered

Hi, I just started using Quantopian this weekend and have tried to get as far as I can with learning Python. I am trying out some algorithms and this one is giving me some problems.

Goal: When a stock has hit $90 for the first time in a year, buy it, and then sell it later after a 5% increase. (fyi, this is not a serious scenario I would use, it's just for practice with writing algorithms).

Issue: I'm getting errors that say AllNaN slice encountered or AllNaN axis encountered when using multiple stocks. When using one stock, it seems to be fine.

Other things I'm trying to do, but is not related to the above issue:
1) how can you have a stock not trade if it will announce earnings in X days?
2) how can I have a stock sell after holding it for X days from when it was purchased?
3) how can I get a universe of stocks that are between a price range?

Any help would be awesome. Thanks in advance!

  • JP
2 responses

Hello JP, if the other points are not resolved yet, you might want to consider a new post for them.

To close the loop on the warning, it is being suppressed now because the condition wasn't harmful, more info on that here.