I'm trying to slice an Aroon factor by the stocks I'm wanting to buy. When I slice it, I'm no longer allowed to get the up/down attributes. How would I be able to create an Aroon oscillator outside of the pipeline if I can't slice the Aroon and get the up/down attributes.
def before_trading_start(context, data):
context.output = pipeline_output('defensive_consumer_pipeline')
context.security_list = context.output[context.output['longs']].index
context.equities = context.output[context.output['longs']]
def get_aroon(s):
aroon = Aroon(window_length=15, mask=context.equities)
up = aroon[s].up
down = aroon[s].down
osc = up - down
return osc
I call the get_aroon(s) function in my selling and buying methods. What I get is slice it and use the .up attribute or the .down attribute, I get a runtime error saying " 'Slice' object has no attribute 'up'." or " 'Slice' object has no attribute 'down'."