Closed Despair2000 closed 4 years ago
I am pretty sure this is actually the IB API. I had fixed a very similar bug in their old ver API. Maybe made its way back in the new +9.73
I’ll try to have a look soon.
Thanks
On Dec 3, 2019, at 6:15 AM, Despair2000 notifications@github.com wrote:
I have a problem with my application and I'm not sure if it might be caused by a bug in IB4m.
I have subscribed to the execDetails-events to listen for executed trades. This works fine but when a trade is executed with partial fills I'm receiving duplicate events. Not every time but most often, one or more partial fills are reported twice (or even more often, I saw the same event being reported up to 4 times). Of course I assumed at first that there is a bug in my code counting the same event twice but this is not the case, the events really have different execIds! I asked about this in the twsapi forum but nobody seemed to have the same problem so I was wondering if this maybe could be caused by IB4m. These duplicate trades also do not show up in the TWS. I have taken screenshots to make this more easy to see.
TWS: https://user-images.githubusercontent.com/38463411/70045849-1e574d80-15c5-11ea-8e64-86ffe8bed37e.JPG API: https://user-images.githubusercontent.com/38463411/70045954-51014600-15c5-11ea-91a9-6c7ca757eb6b.JPG If you look in the API table, the trade in the 3rd row, 21 shares of JDW are bought at 17:23:15. This trade doesn't exist in the TWS table. However these duplicate execDetails events are not really happening, meaning I end up with the correct number of shares in my portfolio.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/80?email_source=notifications&email_token=ABC2VVG36LLGL6NCKKAECB3QWY5TJA5CNFSM4JUWI4KKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5UJYIQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABC2VVEABY4U4CYHVDF4DXTQWY5TJANCNFSM4JUWI4KA.
@Despair2000 I've reviewed the code in the IB API for decoding execution details and also double checked the IB4m handler. Everything looks good.
I few ideas,
Thanks -abel
Intriguing, I was sure you you would find something.
I have definitely not defined the callback twice. I double checked all code. Besides if I had done so wouldn't it have caused that I receive all events twice? This is not the case.
I will check the hash codes of the events. But I think it must be separate events because they have different execIds. But maybe I lack insight here to make any conclusions.
I'm traveling this week so I will probably not have the possibility to look into this before my return. I will let you know once I have found time to come with more details on the events.
Good point. Checking hash code is really just a sanity check. And if they come out as different then likely TWS related.
Another thought is to try different version(s) of TWS.
On Dec 8, 2019, at 3:07 PM, Despair2000 notifications@github.com wrote:
Intriguing, I was sure you you would find something.
I have definitely not defined the callback twice. I double checked all code. Besides if I had done so wouldn't it have caused that I receive all events twice? This is not the case.
I will check the hash codes of the events. But I think it must be separate events because they have different execIds. But maybe I lack insight here to make any conclusions.
I'm traveling this week so I will probably not have the possibility to look into this before my return. I will let you know once I have found time to come with more details on the events.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
I can live with the problem as long as I find a possibility to identify the "phantom-events" (that have never happened) so I can filter out them. So far every attempt to identify them failed but I had one more idea I didn't try yet. I wonder if the cumQty increases on these events. Maybe it won't (because at the end the cumQty shows the right number). This would be a possibility to differentiate real from phantom.
In the weeks since I reported this problem I have been watching it and tried to make sense of it but so far I couldn't really fix it. This strange phantom-events are send out by the IB API in the live stream while the partial fills are coming in BUT when the trade is finished they disappear! So IB seems to correct the events when the trade is completed. If I request the executionDetails after trade completion all is correct.
However it seems that this is a strange behaviour of the API and not caused by IB4m. I guess I will simply have to find a workaround somehow double checking the events after trade completion.
I have a problem with my application and I'm not sure if it might be caused by a bug in IB4m.
I have subscribed to the execDetails-events to listen for executed trades. This works fine but when a trade is executed with partial fills I'm receiving duplicate events. Not every time but most often, one or more partial fills are reported twice (or even more often, I saw the same event being reported up to 4 times). Of course I assumed at first that there is a bug in my code counting the same event twice but this is not the case, the events really have different execIds! I asked about this in the twsapi forum but nobody seemed to have the same problem so I was wondering if this maybe could be caused by IB4m. These duplicate trades also do not show up in the TWS. I have taken screenshots to make this more easy to see.
TWS:
API:
If you look in the API table, the trade in the 3rd row, 21 shares of JDW are bought at 17:23:15. This trade doesn't exist in the TWS table. However these duplicate execDetails events are not really happening, meaning I end up with the correct number of shares in my portfolio.