Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Coercing full fill of orders during a day in backtest

Dear Quantopians

Often doing backtests and using

order_optimal_portfolio(opt.TargetWeights(), [opt.MaxGrossExposure()])  

I notice partial fill of orders, cancellation of unfilled part of orders and a unfilled leftover of order is rolling over to a following day. As a result over time there are many rolling leftover positions which are supposed to be closed long time ago which corrodes results of BT.

How can I coerce 100% full fill of all orders during a day in back-test even though I am aware that it might be not very realistic scenario? I have not found specific threads covering the topic. Thanks in anticipation.

2 responses

@Dmitry,

Try to put this in initialize(context):

set_slippage(slippage.FixedSlippage(spread = 0))  

OK thanks it works