Hello Quantopians!!
I am creating my first algorithm. It is very simple and revolves around the median. I end up with a run-time error because there are no inputs. There error says: "TermInputsNotSpecified: Median requires inputs, but no inputs list was passed." This occurs in line 43 which is part 2 of what is included below. Any suggestions??
I have attached my algorithm and backtest for further help!
Here is my code (part 1):
create a custom factor for finding the median for the past 15 days
class Median(CustomFactor):
def compute(self, today, assets, out, median):
def get_history(context, data):
prices = data.history(self, fields="price", bar_count=15, frequency="1d")
prices_10_30 = prices.tz_convert('US/Eastern').between_time('10:30', '10:30')
median = prices_10_30.median
out[:] = median
And later on in the code (part 2), I have:
Add the median factor defined to the pipeline
median = Median()
pipe.add(median, 'median')
Thanks for the help!