Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Kalman filtering for futures ?

Hello.....new member here and while 30 year veteran of finance, my coding skills are VERY rusty....

I have taken interest in the attached Kalman filter algo...I have added futures symbols in the algo where there were previously stocks. The backtest gives me the error below.......I'm hoping that this is a simple fix, but at this moment, its above my knowledge base. Any help in getting this debugged to run futures would be greatly appreciated.

There was a runtime error.
AttributeError:'zipline.assets.continuous_futures.ContinuousFuture' object has no attribute 'symbol'
Line: 83 inname
return "{}~{}".format(self._y.symbol, self._x.symbol)

The original algo came from cloning the one in this link https://www.quantopian.com/posts/quantopian-lecture-series-kalman-filters but again, the only thing I did was to replace stocks with futures.....

1 response

Hello,

ContinuousFutures don't have a symbol attribute. So just replace

return "{}~{}".format(self._y.symbol, self._x.symbol)

by

return "{}~{}".format(self._y, self._x)

That's all !