Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
trading multiple stocks in arrays

So, i've been playing around w/ python and quantopian for about a month. I'm not entirely sure whats going on here, the algo i wrote should be cycling through runs minute by minute and running on each stock in the list, but instead it just invests in one... then never sells despite the gains, i'm not sure what's going on. Its still incomplete btw, i have it set to buy on a certain stocks nosedive and hopefully sell on the gain, which i know about in advance.

Also, i was trying this with the class vars, but that didn't work, and I wasn't able to do any debugging using class functions.

1 response

got it working... apparently python hates it when you say variable = existing array, my solution was to just set context.buyingnow = np.zeroes(len(context.stock) ) for everything that needed an array