In the next iteration I am relying on get_open_orders() to tell me of any orders that are out still open so I do not order too many securities. The question is, how long does the order keep open if it's not fulfilled? In the test run, it creates one order that just stays in the active list never going away.
# Order object returned by get_open_orders():
{20061: [Event({
'status': 0,
'created': datetime.datetime(2002, 12, 12, 0, 0, tzinfo=<UTC>),
'limit_reached': False,
'stop': None,
'stop_reached': False,
'amount': 15,
'limit': None,
'sid': 20061,
'dt': datetime.datetime(2002, 12, 12, 0, 0, tzinfo=<UTC>),
'id': '47d2f10b113c46fea125f20e604bb164',
'filled': 0
})]}
Filled is 0, presumably this order is not filled. But it should not stay active forever. It is an open order, thus it should be filled or rejected/expired.
On most exchanges all orders expire at the end of the day, to the best of my knowledge. If one wants to have a multiple day order, broker simply re-enters the same order before the market opens the next day. As far as the exchange is concerned, the order entered on one day is fulfilled, rejected or expired on that same day. I may be wrong about this but that was my expectation. If indeed an order can stay open over multiple days, I should adjust my algorithm to cancel orders not fulfilled, so they do not linger for days or years.