Back to Community
Help with Deprecation Warnings

Guys,

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?

Joseph

1 response

Here is a working version of the algorithm with some of the things I have tried commented out... It does have a few other changes I've experimented with, but it is specifically the history deprecation warnings that I am stuck on.

Clone Algorithm
0
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 582626c061724410bc480d58
There was a runtime error.