- process() should output whether the order is market or limit
- if an order is a limit order it should be appended to openOrders list with the relevant variables
- those variables being: postype, num units, target price, limit order date (there may be more)
- before trades are initialised, you should iterate each openOrder and check if its target price is met (condition based on postype)
- if the target is met, use the info from the current data row and the order to append it to openPositions
- the code then continues and runs self.process()
This will lead to more conditionals inside the trade initialisation part of backtest() so you need to think of a cleaner way to do this than the above.
This will lead to more conditionals inside the trade initialisation part of backtest() so you need to think of a cleaner way to do this than the above.