Correct if I understand you. You can do things like this in the debugger to know for sure on things like that:
> np.nan > 2
> np.nan < 2
> np.nan == 2
> np.nan == np.nan
> np.nan != np.nan
So when nan is present, everything's pretty much always false, you're right, except it isn't equal to itself, and that can be useful. If I wanted to avoid np, could do
if some_var != some_var and know it's a nan if True.
I'll share with you something I did with your code to toss some ideas out there for use with the debugger. Since DXYN is a handy available example of a nan here, this can force it to be in the mix (or not) even when pipeline screens it out, to be able to see what changes in the code would do, going step by step in the debugger:
if sid(2384) not in context.security_list:
print 'DXYN absent'
inject_dxyn = 1 # on or off
if sid(2384) not in context.security_list: # 2384 is DXYN
op = data.history(context.security_list, 'open', 2, '1d') #.ffill().bfill()
pc = data.history(context.security_list, 'price', 2, '1d') #.ffill().bfill()
context.security_list = [sid(2384)]
for s in context.security_list:
cp = data.current(s,'price') ; cp=cp
if op[s][-1] > pc[s][-2] * GAP_UP:
context.security_listF[s] = s
context.rsi[s] = 100
That cp=cp is just to quiet the variable unused warning.
Then in the watch window, some ideas for things to place there:
s (I almost always have this first)
pc[s][-2] * GAP_UP
By the way, did you know you can even have a function in the watch window folks?
As an example, and you just have to fix this up, replacing ma and period and then in watch, it should show the return value:
getRSI(ma, s, period)
You can also run functions from the debugger console feeding them different inputs. Just thought it might be worth mentioning.