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

Hi guys. If there a simple way to pull in multiple stocks? This is what i currently have, but if I wanted to make a Stock1 and Stock2, is that easy?


def initialize(context):

    context.stock = sid(41969)  


def handle_data(context, data):

    stock = context.stock  
1 response

Instead of using the "sid" method you can perhaps use the "symbols" method which can take multiple arguments and returns a list of security objects. See the help docs https://www.quantopian.com/help#api-symbols.

Good luck.