Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Need help un-deprecating an algo

Looking for a hand on removing the deprecated functions from this code

3 responses

Hey William,

Looks like I got it to work by changing the following lines in the rebalance section, note that for this you will need to "import talib" at the top of your code.

    for s in context.assetclasses:  
        history = data.history(s, 'price',150,'1d')  
        MA = talib.SMA(history,timeperiod=100)  
        if data.current(s, 'price') > MA[-1]:  
            buylist.append(s)  

Hope this helps and good luck!

That worked great, thanks!

William,

There is anoter more native solution without talib:

    for s in context.assetclasses:  
        if data.current(s, 'price') > data.history(s, 'price',100,'1d').mean():  
            buylist.append(s)