-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Question: Does ccxt round limit orders away from the specified limit price? #6219
Comments
Please, see the answer here:
Let us know if that does not answer the question.
It doesn't necessarily have to be rounded down, depends on what the user wants. We export all the methods for rounding on the user side, if necessary. So, basically, if mathematical rounding does not fit your needs – you can round those values before passing them to ccxt or even override the methods you want. |
Yes, this does answer my question, thus ccxt always rounds to the closest number accepted by the exchange. Of course, ccxt already provide a luxury of features so the following is simply a comment and not a request for a feature: My point with rounding AWAY from the market price for a limit order price is that by definition, a limit order is to accept any price that is NOT WORSE (relative to the order side of course) than the specified price. Thus a strict interpretation of a limit buy order with a price of 1.23456 is to accept 0.5, 1.23 or 1.23456, but NOT 1.234560000001, the same should apply to rounding a limit price imho. I had read similar discussions, but nothing specifically with respects to rounding the price such that it is NOT WORSE with respects to the order side. A similar but simpler concept applies to the order amounts in most cases (except for exchanges that accept All-Or-None orders). By placing a limit order for 5 units, I may have all 5 traded or 4.5 or 0.02 or 0.000001, but NEVER 5.0000000001. Placing a market order is a bit different because I expect to have all 5 traded unless the order book is cleared out and the market is highly illiquid, in that case also, I could have partial executions, but NEVER more than 5 units. Of course, an All-Or-None order presents a dillema of either NOT rounding or rounding to the closest number accepted by the exchange, this depends on the assumptions and models behind the order. I am a bit surprised that everyone is ok with rounding to the closest number accepted by the exchange, but that seems to be the case, so this is just a comment. Keep up the great work! :) |
@gr936 you may also want to check these discussions as well: I think (may be wrong) that the consensus is such that the users will either want floats rounded with math rules for speed or will just want to use decimal strings for precision. We will eventually support both, but for this moment we only support floats. We already have stubs for ROUND_UP and ROUND_DOWN modes of rounding, but those are not fully implemented yet. Hope to get there soon. Thx for your feedback, appreciate it very much! |
I searched through the code and past and current issues and I could not find the answer to this:
Does ccxt round limit order prices away from the specified price based on the side of the order?
For example the price of a buy limit order should only be rounded down as it would be contraditory to the definition of specifying a limit price. Inversely, the price of a sell limit order should always be rounded up.
From what I can see, there is no distict logic for rounding limit orders.
The text was updated successfully, but these errors were encountered: