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

How can I set a price to sell all shares of one security?

I want to sell all shares of a security when it hits $5 per share.

Would this work?

def initialize(context):  
    context.appl = sid(24)

def handle_data(context, data):  
    sma_now = data.current(context.appl, 'price')  
    sell_now = 5.00  
    if sma_now > sell_now:  
        order_target_percent(context.appl, 0)