Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to find execution price of sell order

Does anyone know how to find the volume weighted execution price of a sell order? I've seen people use data.current_price but that wouldn't work for partial fills. Ideally, commission would be included too, something like cost_basis but for sell orders.

5 responses

This is a good question, I haven't found a way to know the execution price. You can get the commission cost from the order object though. You can have access to the order object either saving it when calling order_* functions (it's the return value) or calling get_open_order(s) function.

Hi Luca,
Thanks for chiming in. Ya, getting commission is pretty easy. Having it included with execution price was mostly just an extra item that would make things a little easier if built in. Hopefully someone can chime in with a solution to execution price. Maybe that's something that'd have to be a feature request. It would seem strange to me if there wasn't a way already - seems that mean that noone had an (accurate) feedback loop in their algorithms, for returns anyways.

It seems very strange to me too that this information is not available, also it would have made perfect sense to have had the execution price together with commission in the order object. If that's not there I believe there are technical reasons for this.

Ya, the location of execution price/cost basis is strange on the buy side too. To me it seems as though it there should be a position cost basis and an order cost basis - depending on the algorithm either/both could be important.

I agree there's likely a technical reason, although hopefully not something that can't eventually be overcome.

I raised a zipline issue on github. Certainly zipline maintainers will allay our doubts