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

GDAX price too precise #427

Closed
anandanand84 opened this issue Oct 31, 2017 · 10 comments
Closed

GDAX price too precise #427

anandanand84 opened this issue Oct 31, 2017 · 10 comments
Assignees

Comments

@anandanand84
Copy link

Below error is thrown as Network error, but actual error should be Invalid Order.

gdax POST https://api.gdax.com/orders 400 Bad Request {"message":"price too precise (309.9557461094684)"} (possible reasons: invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting)"

Also currently there is no way to parse the exchange response, make sure always add the exchange response at first or at last of the message so parsing of the exchange response is possible.

Here https://github.com/ccxt/ccxt/blob/master/ccxt.js#L688 400 is considered Network error which is wrong, 400 is bad request and it can be caused for any type of invalid input.

@kroitor kroitor self-assigned this Oct 31, 2017
@kroitor
Copy link
Member

kroitor commented Oct 31, 2017

Hi, @anandanand84 ! Thank you for opening this issue! I will take a look into it asap.

@kroitor
Copy link
Member

kroitor commented Oct 31, 2017

@anandanand84

Here https://github.com/ccxt/ccxt/blob/master/ccxt.js#L688 400 is considered Network error which is wrong, 400 is bad request and it can be caused for any type of invalid input.

This isn't really wrong, because whenever we encounter 400, it means we had a HTTP error, which is a Network Error, not any other type of logic error. What other type of error would you suggest for HTTP 400?

Also currently there is no way to parse the exchange response, make sure always add the exchange response at first or at last of the message so parsing of the exchange response is possible.

We are currently reworking the error handling system, and it will allow to redefine the error handling for all exchanges.

@kroitor kroitor changed the title Invalid error handling GDAX price too precise Oct 31, 2017
@anandanand84
Copy link
Author

@kroitor Anything above 3XX is errors and 4XX errors are basically client errors and in particular 400 is consider an bad request data from the client and it doesn't necessarily mean it is a network error and it is definitely not caused by the information in possible reasons invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting. I would say 400 is bad request.

@kroitor
Copy link
Member

kroitor commented Oct 31, 2017

@anandanand84

@kroitor Anything above 3XX is errors and 4XX errors are basically client errors and in particular 400 is consider an bad request data from the client and it doesn't necessarily mean it is a network error and it is definitely not caused by the information in possible reasons invalid API keys, bad or old nonce, exchange is down or offline, on maintenance, DDoS protection, rate-limiting. I would say 400 is bad request.

In the terms of the library, there's no Bad Request error, so, of the errors left, we aligned the NetworkError to stand for any error that is related to a bad HTTP status code. In other words, if I asked you, what other type of error should we assign to it, what would you suggest it should be (of currently existing types, without adding a new one)?

@anandanand84
Copy link
Author

InvalidOrder

@kroitor
Copy link
Member

kroitor commented Oct 31, 2017

@anandanand84 InvalidOrder for all 400 codes? Or for GDAX only? 400 may not be related to an order at all.

@anandanand84
Copy link
Author

@kroitor I mean it depends right, if 400 comes from exchange during openOrders request then you cannot say it as InvalidOrder, it is invalidrequest for open orders.

kroitor added a commit that referenced this issue Oct 31, 2017
@anandanand84
Copy link
Author

I would recommend b124f57#diff-9453f5a8dee427abd6a1b4a0aed6a819R458 fix. Because there is a whole bunch of errors here is another one for instance "size must be greater than zero (0.00000000)", May be I am wrong when you ask what 400 corresponds to you in your scenario it should be ExchangeError and let the user handle the exchange error and not InvalidOrder.

kroitor added a commit that referenced this issue Oct 31, 2017
kroitor added a commit that referenced this issue Oct 31, 2017
@kroitor
Copy link
Member

kroitor commented Oct 31, 2017

@anandanand84 the GDAX should now return InvalidOrder for that error starting from 1.9.293.

See: bcaebcd
We have a special method for error handling since recently.

As for the other exchanges and cases – we're still unifying it (in progress). Let us know if you have any other questions or difficulties with it. Thx again for your feedback. Cheers!

@kroitor
Copy link
Member

kroitor commented Oct 31, 2017

@anandanand84 sorry, there's a small problem on Travis uploading to PyPI, it will be there shortly.

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