Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Only buy orders result in selling

Hi,

I am trying to make an algorithm which buys the lowest priced stocks out of a list ($1000 worth) and holds them. In my full backtest, I see that sometimes my entire position of certain stocks are sold. I cannot figure out why this is happening.

Thanks so much for your help!

Steve

2 responses

The backtester automatically 'sells' ones entire position in a stock when a stock is delisted. The algorithm above has positions of three stocks which are delisted while being held - ALTR, ADT, GAS. Look up the delisting info of each of these and you'll find they match with the times that the holdings are closed out (ie 'sold'). This behavior is pretty much what would happen in real life. Your broker will automatically liquidate those holdings and deposit the resulting cash into your account.

Thank you so much!!!