Open spazmodius opened 3 years ago
they should add a sequence # in these messages and make sure to order by seqno in the outgoing stream. I suspect they are using an unordered collection somewhere in their code.
I don't rely on cum_qty, rather accumulate fills I see. Of course if there is a bug where some fills are not reported, would be a problem.
I suspect it is ordered lexically by id
, which is only approximately chronological.
PS--At one time the id
s were discontinuous at 1pm Eastern each day. Hopefully that has been fixed.
Describe the bug When I fetch FILL activities, partial fills that occur in the same millisecond may be listed out of order, as evident by the
cum_qty
amount.To Reproduce
GET https://api.alpaca.markets/v2/account/activities/FILL?date=2021-01-27
For my account, this returns
As you can see, all these fills were for the same order, and happened within 2 milliseconds. The final fill appears in the middle of the list. The actual order can be unraveled by the cum_qty field.
Expected behavior If there is a ns-resolution timestamp in the back-end, maybe order by that, or by trade sequence, or something deterministic.