danpaquin / coinbasepro-python

The unofficial Python client for the Coinbase Pro API
MIT License
1.82k stars 740 forks source link

invalid order id returned when cancelling #397

Closed phillwilk closed 3 years ago

phillwilk commented 4 years ago

When attempting to cancel a live order on the book the

auth_client.cancel_order(orderid)

returns the following message

{'message': 'Invalid order id'}

this issue also seems to affect the

auth_client.get_order(orderid)

noah222 commented 4 years ago

what kind of order ID are you supplying? where are you getting the order ID that you are sending and is it sent as a string as required?

phillwilk commented 4 years ago

The order ordered is stored following successful placing of an order, this is the return from the initial placement of the order. The orderid is declared as str() on assignment and before use in cancel_order or get_order.

noah222 commented 4 years ago

maybe include a snippet of the code you are working with. It's hard to guess what is happening with this. I have a feeling something is effecting the formatting of the orderID. Show how you are pulling it from the order response and maybe we can figure it out

mcardillo55 commented 3 years ago

Working fine here:

>>> r = c.place_limit_order('BTC-USD', 'buy', '10.00', '100.0')
>>> r
{'id': '3771c79e-9d97-48e4-98dd-1d189cac5640', 'price': '10.00', 'size': '100.0', 'product_id': 'BTC-USD', 'side': 'buy', 'stp': 'cn', 'type': 'limit', 'time_in_force': 'GTC', 'post_only': False, 'created_at': '2020-11-22T09:14:02.864514Z', 'fill_fees': '0', 'filled_size': '0', 'executed_value': '0', 'status': 'pending', 'settled': False}
>>> 
>>> c.cancel_order(r['id'])
'3771c79e-9d97-48e4-98dd-1d189cac5640'

Closing for now. Feel free to reopen with a code snippet.