-
Notifications
You must be signed in to change notification settings - Fork 732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coinbase API change #476
Comments
It is even worse than I expected. Now the price in "done" messages seems to not have to match the price of the "open" Here's a real example: The price in the "done" message is different from the "open", which means that the order is not removed from the orderbook correctly and the orderbook gets corrupted. I think this is a problem with coinbase API, but we should be able to deal with it anyway. I asked coinbase for support on this issue. |
Running this code during a few hours will show orders that were opened at one price and done at another price. In self.opens I store the order_id, price as key,vals; update the price whenever there's a change, and then check the price and remove the order_id when the order is done. Am I doing something wrong here?
|
I asked Coinbase and it turns out that this is an expected behavior. So we should adapt the library to deal with this issue too. Right now in the library it is impossible to remove an order from the orderbook if the done order has has a different price from the one in our books. This is the email I got from support: Hello XXXX, Thank you for reaching out. We would like to let you know that difference in price in “open” and “done” is due to the order being modified by customers. Pro/Exchange do support modify orders. For example, we could see in our records that for order_id e6faa188-edd7-4cb7-964a-a539ddefabf0, buy order is modified up from 20102.65 to 20111.53 After modification, the order still rest in the book, there will be a message to say that the order has a new price. However, when modified up, it immediately matches with the other side (published as match) and the order is done (i.e., via matching with the other side, or self trade prevention or if order isn’t in the book any more, then all the public gets this order as done). Please note that when you see a match message, you should minus the size in that match in your book for those particular order ids (i.e., both maker side and taker side) and when you see the done, you should just remove that order in your book and ignore the price field. We hope this helps. We’d be happy to answer any more questions. Regards, |
Many changes in Coinbase's API have been rolled out in the last year.
https://docs.cloud.coinbase.com/exchange/docs/changelog
In particular, this change https://docs.cloud.coinbase.com/exchange/docs/changelog#2022-jun-27 makes the websocket to disconnect, whenever new_price or old_price fields appear.
I fixed this part in my fork, but I didn't submit a PR because of lack of time. It would be great if someone could work on this and check that everything works fine.
segurac@f91977d
Now that I see some activity in the repo I remembered my patches. It could be a good time to create a small community and maintain this awesome library together.
The text was updated successfully, but these errors were encountered: