Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Difference in Buy/Sell price when FixedSlippage(spread=0.0)

Hi community,

Buy and Sell prices seem still to be different even if I turn off the slippage using FixedSlippage(spread=0.0). In particular, there is a spread of 0.06$ between these price values.
Is there any explanation for that?

Thanks,
Mattia

3 responses

The fill price used in buy and sell orders is the close price of the next minute bar. If you need to use the open price of the next bar (so that there is a very little discrepancy with the price you see when creating an order) for testing purpose see here https://www.quantopian.com/posts/trade-at-the-open-slippage-model

Anyway, this is a recurring question (I asked it myself) and I don't know why Q guys don't improve the documentation, explaining this fill price detail.

Thanks Luca for replying. Some things are now more clear.
However, this didn't seem to solve my issue.

Using the slippage model coded here (https://www.quantopian.com/posts/trade-at-the-open-slippage-model), the execution price printed and the actual cost basis of the position are different. For instance,

Opening positon  
2015-09-24process_order:INFO  
Order:BBY open:36.66 close:36.62 exec:36.66 side:-1.0  
2015-09-24close_position:INFO  
Closing position with cost basis: 36.63 and last price: 36.68  
2015-09-24process_order:INFO  
Order:BBY open:36.68 close:36.61 exec:36.68 side:1.0  

where the position was actually closed at 36.71 rather than 36.68.

I figured out I didn't set the commission to zero using set_commission.