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

Is there a way to optimize how Quantopian executes trades in the backtest? My algorithm's performance is destroyed by Quantopian always hitting the ask when trying to sell my stocks, which in the real world is minimized by good traders and their algos. Anybody experience the same thing and come up with a solution?

Thanks

2 responses

I think you mean "hitting the bid", but besides, you can set the slippage model to anything you like. If you believe that you can execute with no slippage, then just set_slippage.FixedSlippage(spread=0.00)). Your algorithm won't be eligible for the contest if you tinker with the slippage, of course, but for your own testing, you can make it whatever you want.

You could use limit orders if you are live trading... market orders are pretty bad especially if you're trading less liquid stocks.