danpaquin / coinbasepro-python

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

Market Order with Insufficient Fund [maybe issue on GDAX end?] #280

Closed mfxuus closed 6 years ago

mfxuus commented 6 years ago

When I place a market buy order as such: auth_client.buy(product_id='BTC-USD',size='22',type='market') even with no USD in the account, it responds with:

{'id': 'ea5ba720-99cf-4d49-b1ea-c1cc130bcb46', 'size': '22.00000000', 'product_id': 'BTC-USD', 'side': 'buy', 'stp': 'dc', 'funds': '0.0000014700000000', 'type': 'market', 'post_only': False, 'created_at': '2018-03-27T01:30:17.31735Z', 'fill_fees': '0.0000000000000000', 'filled_size': '0.00000000', 'executed_value': '0.0000000000000000', 'status': 'pending', 'settled': False}

where I am expecting the message

{'message': 'Insufficient funds'}

The response is as expected if I specify the 'funds' variable: auth_client.buy(product_id='BTC-USD',funds='2200',type='market')

Seems to me it's some bug on Gdax's end, but would like to see if anyone has an explanation / I am doing anything wrong here...

Thanks!

fujiapple852 commented 6 years ago

I have observed a similar issue with GDax (sandbox only) and I do not use this library so I think it is safe to say it is a problem at the exchange end.

What I observe is that the the 'received' message ('user' channel) shows the order 'size' as 0 when you place a request without having sufficient funds.

I am only using market orders and never make use of the 'funds' field.

From experimentation it appears to be that if I perform a 'buy' and do not have sufficient funds in the quote ccy then I do not get the 'Insufficient funds' error (but I do get the size-reported-as-zero issue). If I perform a 'sell' and do not have sufficient funds in the base currency then I do get the 'Insufficient funds' error as expected.

In summary:

Sell BTC-USD (with zero BTC) -> 'Insufficient funds' error returned from POST call Buy BTC-USD (with zero USD) -> no error returned from POST call but 'received' shows size as 0

Where is the correct place to report such bugs?

fujiapple852 commented 6 years ago

Raised a bug report in - what appears to be - the official channel to report GDax APi bugs

mcardillo55 commented 6 years ago

This seems to be an issue with the GDAX api. The project that you raised the issue in @fujiapple852 advised to check with GDAX in a support ticket