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

what am I missing?

  for p in context.portfolio.positions:  
            security_id = sid(p.sid)  
            order_target_percent(security_id, 0)  

won't work and it will say sid needs one parameter?

2 responses

I'm not sure about that error however this might help a little ....
(and since sid is a key at times, I use 'sec', short for security).

    for sec in data:  
        if context.portfolio.positions[sec].cost_basis:  
            for sec in context.portfolio.positions:  
                log.info('Sell ' + str(sec))  
                order_target(sec, 0)  

Thanks, I did something similar, but it was not optimal because I don't use all my sec for all positions
but the problem I had just intrigued me since I was giving one parameter, maybe sid is a IDE macro function not sure