So, in case it is of some interest for people who like me were ignorant about this and are willing to know more : BT cannot filter by ClientID when receiving commissionReport, as IB do not send a ClientID in the commissionReport message.
Feel free to correct me if I am wrong :
- IB do send the ClientID and the OrderId with the openorder callback but not the ExecId (Which is normal as the order may not have been executed)
- IB send the ExecId, the ClientID and the OrderId with the execDetails messages.
- IB do not send the ClientID or OrderId with the commissionReport messages, the only thing that can be linked to an order that is then sent is the ExecId
So a running strategy will receive commissionReport messages for all order executed on TWS : its own orders, orders placed manually and from another clientId, but not the openorder and execDetails messages.
There are 2 exception for this :
- ClientID 0 will receive openorders, execDetails and commissionReports for itself and for orders placed manually
- If a ClientID is set as "Master API client ID" (in Global configuration / API / Settings) it will receive openorder, execDetails and commissionReport for all clients.