Hi @backtrader, over the weekend I got some time to implement what you advised which was to add a custom broker/store. but bit stuck at the moment and have TWO questions.
Q1: So far this is what I have done, and need to know if I am on the right path?
I have ...
- Extended the backtrader IBBroker class with a custom to implementation which makes
reqAllOpenOrderscall via IBStore to load open/active orders (bracket, etc).
- When my application backfill is done, I make a
reqAllOpenOrdersto load all active orders via TWS.
- Once request is done, I get IBPy
ib.ext.Orderinstance passed via
notify_storemethod (within strategy) with active orders (BUT these are obviously
.. I cannot seem to figure out an easier way to instantiate
IBOrder objects based on the
ib.ext.Order data (which consists of lot of
m_ attributes) I get. I mean I can try to map all the
m_ attributes such as
IBOrder) and so on, but I would like to know if there is a better approach or get a sanity check of what I have done before I dig this hole deeper..
Q2: Would it be possible to get an explanation on what variables/attributes within ibstore, broker or basestrategy layers need to be repopulated when a new session is created? for backtrader to seamlessly use the retrieved orders. Since I have only focussed on extending IBBroker and making a
reqAllOpenOrders to load active orders.
Your time is much appreciated.