My order came back saying that I had bought 0 shares. And the quote from the exchange now read “500 shares available at $120.”
Maybe I don't get the full picture, but it sounds like you have to poll via REST API to query the book? Modern exchanges just give you a feed of updates (adds, deletes, trades), so you don't run into situations like this. You can just check the feed to see what happened.
The feed is hooked up via a websocket to the UI, but not persisted anywhere on the client side. From my eye's perspective, the cancel never registered. If I had had wireshark open I would have seen it. (I encourage folks who understand why this is not desirable to build their own trading UIs using our provided e.g. websockets.)
Maybe I don't get the full picture, but it sounds like you have to poll via REST API to query the book? Modern exchanges just give you a feed of updates (adds, deletes, trades), so you don't run into situations like this. You can just check the feed to see what happened.