Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Debugging: "inputs are all NaN" randomly occurring

Is anyone aware of a good strategy for debugging "Exception: inputs are all NaN" that occurs only occasionally when back-testing my algorithm? For certain time spans, everything works fine. I'm trying to lock down the exact date it occurs so I can diagnose the problem.

I've already tried using to use "set_symbol_lookup_date('2016-03-08')" to avoid pulling bad/old data, but it doesn't help.

For reference, I'm running a SMA on an EMA result. My guess is one of two:

  1. Either there's no stock price information (on a specific day) and it's pulling a NaN and crashing.
  2. or talib.EMA is calculating a zero and feeding that into talib.SMA. Does zero cause a NaN runtime error?

Here's the code for reference:

b = talib.EMA(a, timeperiod=21)  
c = talib.SMA(b, timeperiod=4)

b pulls through a few variables but originates here:

high_price = history(bar_count=50, frequency='1m', field='high')  
my_sid_series = high_price[context.stock]  
hp = talib.EMA(my_sid_series, timeperiod=10) 

Thanks for any help!

1 response

Michael,
have the same problem, do you have any solution? want to skip if the return is Nan...