Skip to content
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

insufficient funds #232

Closed
lploumen opened this issue Jun 13, 2020 · 3 comments
Closed

insufficient funds #232

lploumen opened this issue Jun 13, 2020 · 3 comments

Comments

@lploumen
Copy link

Hi,
I am using the sandbox, I have a account with less than 1BTC. When trying to sell 3 BTC, I do not get any errors and it sell my whole BTC balance. On the website, when trying the same, I get the expected error 'insufficient funds'.
How can I get this error when using the API?
Thank you !

@dougdellolio
Copy link
Owner

dougdellolio commented Jun 14, 2020

Hi @lploumen ,

The sandbox account will use a different balance than your live account. It is typically a very large number. I just tried placing a market order for more than my sandbox account balance and I am receiving the error.

image

Trying to place market order for 221,851 throws this:

image

Let me know if you're still not seeing this.

@lploumen
Copy link
Author

lploumen commented Jun 15, 2020

Hi!
No I don't seem to get same result as you.
I have this balance:
image

Now I try to buy market 4 BTC (which should not be possible) , and I get that in the logs:
image

See the remainingsize...
But I don't get any errors.

And I just re-read the documentation regarding the "Done" event from the websocket 👍
image
It is strange that I have those fields filled.

Best regards,

@dougdellolio
Copy link
Owner

@lploumen it looks like you aren't seeing the exception because you are getting part of your order filled. If you notice the remaining size is ~3.82142768 of the 4 BTC. If you run the place order again, you will get the error because there are truly no funds available.

I am not 100% sure of the logic here because its not documented but I am seeing what you are seeing on "Buy" only orders. However, when placing "Sell" orders it seems to be all or nothing which is what I had tried in my first comment above.

Lastly, I noticed for "Buy" orders, if you set the MarketOrderAmountType to Funds (the optional argument when placing market order), it will not do any partial buys and should fail on the first attempt.

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

No branches or pull requests

2 participants