Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
why can't I place orders in back testing

hello,

my algorithm is supposed to short some 20 stocks, but data.can_trade() returns falls for most of them which belong to Q500US universe. For those that can be traded, I see lots of messages like shown below. How to calculate which trades are sure to succeed in backtesting?

thanks
-kamal
----------2007-01-09 02:30 WARN Your order for -3998 shares of MAD has been partially filled. 673 shares were successfully sold. 3325 shares were not filled by the end of day and were canceled.
2007-01-09 02:30 WARN Your order for -3996 shares of IRCP has been partially filled. 43 shares were successfully sold. 3953 shares were not filled by the end of day and were canceled.
2007-01-16 20:10 do_portfolio_construction:86 INFO shorted stocks=
2007-01-16 20:10 do_portfolio_construction:87 INFO 2
2007-01-17 02:30 WARN Your order for -3884 shares of MAD has been partially filled. 20 shares were successfully sold. 3864 shares were not filled by the end of day and were canceled.
2007-01-17 02:30 WARN Your order for -3965 shares of IRCP has been partially filled. 264 shares were successfully sold. 3701 shares were not filled by the end of day and were canceled.
2007-01-22 20:10 do_portfolio_construction:86 INFO shorted stocks=
2007-01-22 20:10 do_portfolio_construction:87 INFO 2
2007-01-23 02:30 WARN Your order for -3918 shares of MAD has been partially filled. 450 shares were successfully sold. 3468 shares were not filled by the end of day and were canceled.
2007-01-23 02:30 WARN Your order for 264 shares of IRCP failed to fill by the end of day and was canceled.
2007-01-23 02:30 WARN Your order for -3464 shares of IRCP failed to fill by the end of day and was canceled.

1 response

Volume. Your orders are too large to be filled. The backtesting is going to fill your order's not just on price, but on volume action. Try lowering the starting cash, or lower the percentage that any one security would take up of your portfolio.