Skip to content
This repository has been archived by the owner on Jan 20, 2020. It is now read-only.

Bug: Market order submission not returning 'Insufficient funds' error #199

Closed
fujiapple852 opened this issue Mar 28, 2018 · 3 comments
Closed

Comments

@fujiapple852
Copy link

Hi,

As with my previous bug report this appear to be an exchange side bug rather than a bug with this client library (which I do not use) and so if there is a more appropriate place to report this please let me know.

The issue

Submitting market orders whilst not having sufficient funds does not always result in an 'Insufficient funds' error response.

The precise circumstances under which this occurs is not completely clear, from experimentation it appears to occur for 'buy' market orders but not for 'sell' market orders.

I also observe that when this problem occurs we are sent a 'received' message for the order however the 'size' field is 0.

In summary:

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

See also this bug report for another example of this issue occurring when using market orders with 'size' but not occurring when using 'funds'.

Note this issue was observed on the 'sandbox' environment, I have not attempted to reproduce it on the live trading system.

If needed I can produce a minimal reproducible example to demonstrate the bug.

Thanks,

Fuji Apple

@sfkiwi
Copy link

sfkiwi commented Mar 28, 2018

Out of curiosity how does your order look like? Are you using size or funds field for you market buy order. I ask because limit buy, sell and market sell orders all use size whereas market buy orders use funds field in the order message.

I just tested on the live exchange and placing a market order with zero USD available balance fails to place when specifying the order as funds: $100 but succeeds as a $0 market order when specifying the order as size: 0.002. I believe this is because specifically for market buy orders gdax is looking for the funds field and if it doesn't see it is setting to max available balance. I tested this by placing a market buy order for size: 0.1 (around $700) but with only $10 in my USD balance. The order succeeds using the total available balance so basically they are automatically fitting it to your available balance and a $0 balance is included as an acceptable value.

@fujiapple852
Copy link
Author

@sfkiwi - thank you for your reply. Your testing results are inline with what @mfxuus reported in the issue linked above (i.e. works for funds but not always for size).

In my case I am only using size for both buy and sell orders which, as i interpret the documentation, is valid:

market order parameters

size | [optional]* Desired amount in BTC
funds | [optional]* Desired amount of quote currency to use
  • One of size or funds is required.

I could of course calculate the corresponding funds for a given buy order size to workaround the bug (as it happens I have another workaround in place) but I think it would be best for GDax to fix the issue.

As an aside, I notice in the GDax web UI that for buy orders you are only able to specify funds (i.e. USD amount to sell) which I find very non-intuitive - I guess it is considered more user friendly as it is similar to how retail Bureau de Change works which people may be more comfortable with rather than FX markets conventions of buying/selling the FX ticker.

Thanks,

Fuji Apple

@drewrothstein
Copy link

Hi, we are closing out PRs + Issues as this project is being archived.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants