I have been playing around with David Edward's Kalman Pairs algorithm (https://www.quantopian.com/posts/quantopian-lecture-series-this-time-youre-more-wrong), and it is really well written. However, I am completely confounded when I try to update "history" to "data.history":
def update(self): prices = np.log(history(bar_count=1, frequency='1m', field='price')) self.X.update(prices) self.Y.update(prices) self.kf.update(self.means_frame().iloc[-1])
I understand how to update from "history" to data.history, but what has me confused is that data.history takes an asset/asset list as an input/argument and history does not. When I try to use self._x or a combination of self._y and self._x, the algorithm ceases to trade, and I don't understand how it should be updated to input the necessary pair. I've also tried to use data.current, since it seems like that would logically work (since it is just updating the price from one minute ago).
Would anyone be able to point me in the right direction (take pity on me) and help me understand how to update this to make it work?