Although there are two orders open,
get_open_orders()
returns one. The following steps and attached code demonstrate the problem:
- Set backtest period from 01 Mar 2018 to 01 Apr 2018.
- We will use SPY. In that time it first goes up about 3.3%, then down to about -5% form start.
- On the first tick after start-up place two limit orders for SPY:
(a) Note the SPY starting price at market open on 02 Jan 2018.
(b) The first order is for a sell at 3% above the starting price.
(c) The second order is for a buy at 3% below the starting price. - The sell order fills on the 12th and the buy order on the 23rd.
You can see this in the backtest where the equity curve is flat at first, then moves about, then flat again. - Note that in the meantime get_open_orders() returns at first one, then zero from the 23rd onwards.
==> This looks like a bug, as there were TWO orders open until the 12th of March.
Or am I missing something??