Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
help w/ batch transform

Perhaps someone can set me straight. When I run the attached algorithm, I'm only getting data for one of the sids. Seems that I should get both. Instead, the second iteration of the loop just repeats the output of the first iteration:

2012-02-15handle_data:18DEBUG(array([ 127.68, 128.06, 127.79, 128. , 129.16, 129.24, 129.53, 128.95, 129.33, 130.78, 131.48, 131.54, 131.6 , 131.46, 132.57, 131.88, 131.71, 131.36, 131.24, 132.45, 132.67, 134.55, 134.45, 134.78, 135.13, 135.35, 134.37, 135.33, 135.23, 134.56]), 131.74099999999999)  
2012-02-15handle_data:18DEBUG(array([ 127.68, 128.06, 127.79, 128. , 129.16, 129.24, 129.53, 128.95, 129.33, 130.78, 131.48, 131.54, 131.6 , 131.46, 132.57, 131.88, 131.71, 131.36, 131.24, 132.45, 132.67, 134.55, 134.45, 134.78, 135.13, 135.35, 134.37, 135.33, 135.23, 134.56]), 131.74099999999999)  
4 responses

You're actually doing more work than necessary I believe. Rather than pass the"data,stock" into your method using the for loop, just passing "data,context" then datapanel['price'] will return a pandas datapanel with all your stocks - you can then pick and choose if you need a particular one as you've done: datapanel['price'][sid].values.

Thanks Alex...I thought about that...I'll see if I can get it to work (and avoid the loop over sids). Have you tried running the code that I posted? I'll still have the same problem if datapanel['price'][sid].values isn't working properly. --Grant

Alex & all,

I should be all set now. I just return a numpy ndarray of the trailing window of prices (see attached).

Grant

great to see you've found a solution! Sorry - I meant to try to work it out myself too but I guess you beat me to it :)