First, thanks for this awesome platform! I've gone through the tutorials and am very eager to get started. Unfortunately, I've hit a snag on what I think is a very basic issue.
In my pipeline, I'd like to run various moving averages on the Previous Day's data.
I've got the EMA 5-day as:
EMA5 = ExponentialWeightedMovingAverage(inputs=[USEquityPricing.close],window_length=5, decay_rate=.94, mask=base_universe)
Now I'd like to also have the Previous Day's EMA 5-day... I've tried a few different things, but can't seem to figure it out.
First I tried a few versions of the following, adjusting the "[-1]" around for different:
prevEMA5 = ExponentialWeightedMovingAverage(inputs=[USEquityPricing.close[-1],window_length=5, decay_rate=.94, mask=base_universe)
This was clearly wrong. So then I tried making a custom factor...
class PrevEMA(ExponentialWeightedMovingAverage):
def compute(self, today, asset_ids, out, data, window_length):
out[:] = ExponentialWeightedMovingAverage(data[:-1], window_length)
And calling it through:
pema5 = PrevEMA(inputs=[USEquityPricing.close], window_length=5)
I'm now getting an error saying that PrevEMA expected a 'decay_rate' parameter. If I add that to the call, then it says it's unexpected. If I add decay_rate into the compute definition, my error is: TypeError: compute() takes exactly 7 arguments (6 given)
I think it's possible to do what I'm attempting, I just don't know the way to go about it. If somebody could kindly help a rookie out, I think I'll be able to run with it and adapt to my needs down the road. Thanks!