Hi, following the 02_backtesting_with_zipline.ipynb
Have the custom loader set it up as:
class SignalData(DataSet):
predictions = Column(dtype=float)
domain = US_EQUITIES
signal_loader = {SignalData.predictions: DataFrameLoader(SignalData.predictions,
predictions)}
class MLSignal(CustomFactor):
"""Converting signals to Factor
so we can rank and filter in Pipeline"""
inputs = [SignalData.predictions]
window_length = 1
def compute(self, today, assets, out, preds):
# print(preds) -> [nan, nan....nan, nan],
out[:] = preds
def compute_signals():
signals = MLSignal()
return Pipeline(columns={
'longs' : signals.top(N_LONGS, mask=signals > 0),
'shorts': signals.bottom(N_SHORTS, mask=signals < 0)},
screen=StaticAssets(assets)
)
# Other functions
results = run_algorithm(start=start_date,
end=end_date,
initialize=initialize,
before_trading_start=before_trading_start,
capital_base=1e6,
data_frequency='daily',
bundle='quandl',
custom_loader=signal_loader)
I'm using the zipline-reloaded
The preds passed to MLSignal.compute function are all [nan, nan....nan, nan], therefore none of the longs and shorts were executed.
Also, the predictions generated from load_predictions looks fine. Seems that the custom_loader is not recognized somehow?
Hi, following the 02_backtesting_with_zipline.ipynb
Have the custom loader set it up as:
I'm using the zipline-reloaded The
preds
passed to MLSignal.compute function are all [nan, nan....nan, nan], therefore none of the longs and shorts were executed. Also, thepredictions
generated fromload_predictions
looks fine. Seems that the custom_loader is not recognized somehow?