Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
WHY DOES THIS HAPPEN - FAILED ORDER

2019-01-02 21:00 WARN Your order for -13120 shares of GSK failed to fill by the end of day and was canceled.

2 responses

any ideas guys

Slippage, lack of liquidity, etc.

To combat this there are a few things you can try.

  1. Reduce the initial capital for your backtest. I believe the default is $10 million which is much too high. Try something smaller like $100K.
  2. Give the order more time to execute. Don't schedule your trade function at the close. Schedule it for 10, 20, even 30 minutes before the close.
  3. Set slippage to 0. Place the following statement in the initialize section.
set_slippage(slippage.FixedSlippage(spread = 0.0))