I am trying to understand this example. Particualrly this line:
securities_to_trade = (low_returns | high_returns)
(line number
104
).
What I could gather though, is that
1. low_returns and high_returns are objects of class zipline.pipeline.filters.filter.PercentileFilter
2.securities_to_trade is "a Filter computed from a numexpr expression" and
3.the '|' symbol is a logical 'or' operator for numexpr.
I tried to replicate the function of the '|' function unsuccessfully. Please find code below:
import numpy as np
import numexpr as ne
a = np.array([1,2,3])
b = np.array([4,5,6])
ne.evaluate(a | b)
ne.evaluate('a | b')
This is the error I got:
NotImplementedError: couldn't find matching opcode for 'or_bll'
So, my question is:
1. Am I right in assuming that the '|' symbol is a logical or operator?
2. How do I replicate the operation with arrays?