Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Selling more shares than I hold

Hi,
I'm new to this and I've been having trouble with a code I have been writing. It seems to be selling more shares than I hold. I have def initialize(context): set_long_only() and order_target_percent set to 0 but it will occasionally split a sell order and sell a partial amount and then a second sell order will fill for the original amount of shares bought/held. I'm trying to not short but it seems like every test I run it's shorting. How can I avoid this? Is there something I'm missing?