Hi Brian,
I've finally gotten my live algorithm to open positions, but the stop orders I put in place concurrently to protect them are getting canceled at the end of day.
I realize that zipline cancels orders by design at the end of each day (and this is stated in your usage guide). To get around this, I added an order param {'Tif' : 'GTC} when submitted, which according to the IBKR API docs should keep the order alive until cancelled or expired.
This doesn't seem to work, as the blotter appears to intentionally cancel the open orders (and also generates errors when doing so):
quantrocket_houston_1|172.18.0.8 - - [08/Jan/2021:21:00:11 +0000] "DELETE /blotter/orders?order_ids=6001%3A17 HTTP/1.1" 202 83 "-" "python-urllib3/1.26.2"
quantrocket_houston_1|172.18.0.8 - - [08/Jan/2021:21:00:12 +0000] "DELETE /blotter/orders?order_ids=6001%3A19 HTTP/1.1" 202 83 "-" "python-urllib3/1.26.2"
quantrocket_houston_1|172.18.0.8 - - [08/Jan/2021:21:00:12 +0000] "DELETE /blotter/orders?order_ids=6001%3A21 HTTP/1.1" 202 83 "-" "python-urllib3/1.26.2"
quantrocket_houston_1|172.18.0.8 - - [08/Jan/2021:21:00:12 +0000] "DELETE /blotter/orders?order_ids=6001%3A23 HTTP/1.1" 202 83 "-" "python-urllib3/1.26.2"
quantrocket_flightlog_1|2021-01-08 13:00:13 quantrocket.blotter: WARNING ibg1 client 6001 got IBKR error code 202: Order Canceled - reason:
quantrocket_houston_1|172.18.0.7 - - [08/Jan/2021:21:00:13 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
quantrocket_flightlog_1|2021-01-08 13:00:13 quantrocket.blotter: WARNING ibg1 client 6001 got IBKR error code 202: Order Canceled - reason:
quantrocket_houston_1|172.18.0.7 - - [08/Jan/2021:21:00:13 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
quantrocket_flightlog_1|2021-01-08 13:00:13 quantrocket.blotter: WARNING ibg1 client 6001 got IBKR error code 202: Order Canceled - reason:
quantrocket_houston_1|172.18.0.7 - - [08/Jan/2021:21:00:13 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
quantrocket_flightlog_1|2021-01-08 13:00:13 quantrocket.blotter: WARNING ibg1 client 6001 got IBKR error code 202: Order Canceled - reason:
If this isn't the right way to keep stop orders open overnight, what is?
Thanks,
Paul.