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

Let's say I had 5000 shares in a low volume stock. The MA cross signaling a sell. The sell order for -10,000 shares is placed but I only manage to sell 3000 during that minute. During the next minute would order_target_value place another sell order for -7000 this time? Or does it take into consideration orders placed but not yet filled?

If it doesn't take non filled orders into consideration how would I go about skipping the order? Get_open_order seems like the obvious criteria, but I am not sure how to utilize it here.

    if mAvg1 > mAvg2 and current_positions <= 0 and exchange_time.hour > 9  
        order_target_value(context.my_stock, 5000)  
        log.info('Buy')  
    elif mAvg1 < mAvg2 and current_positions >= 0 and exchange_time.hour > 9  
        order_target_value(context.my_stock, -5000)  
        log.info('Sell')  
1 response

Do something like

    if not get_open_orders(context.my_stock):  
        if mAvg1 > mAvg2 and current_positions <= 0 and exchange_time.hour > 9  
            order_target_value(context.my_stock, 5000)  
            log.info('Buy')  
        elif mAvg1 < mAvg2 and current_positions >= 0 and exchange_time.hour > 9  
            order_target_value(context.my_stock, -5000)  
            log.info('Sell')