Blotter.cancel_orders does not cancel inactive orders

Hi,
When orders are not executed due to error, they're still listed by blotter.download_order_statuses (that's fine) but cannot be canceled by blotter.cancel_orders.

But these inactive orders are considered by Zipline strategy (algo.get_open_orders() ) as open making target order position calculation incorrect.

Zipline treats “Inactive” orders as still being open, with the possibility of becoming active again. This interpretation is based on the IBKR API docs. However, the IBKR API seems to contradict the docs, because the API does not send back “inactive” orders when you request all open orders. Based on this evidence, I think it would be more accurate for Zipline to treat inactive orders as cancelled.

We will make this change in the next release. For now, the easiest workaround would be to manually change "Inactive" to "Cancelled" at the database level (please backup the database before making manual edits):

sqlite3 /var/lib/quantrocket/quantrocket.v2.blotter.statuses.sqlite 'UPDATE OrderStatus SET Status = "Cancelled" WHERE Status = "Inactive"'

Inactive orders are treated as cancelled in release 2.7.0: