-
Notifications
You must be signed in to change notification settings - Fork 131
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
SO: unwanted orders price shifts due to incrementing price #575
Comments
The less asset precision, the bigger price increment error is. |
The problem is that we assume that we get the price we specify. When calculating prices we must do so taking into account the available resolution, and use an actually possible price going forward. See my pr for reference. I'm working on an improved version, but it seems pretty specific to Staggered Orders (with it's order size limits), and maybe not so suitable as a generic function. |
This allows to fix tests failing due to Codaone#575. Note this is not a final fix!
Problem described here Codaone#575 Workaround is to use approx value for spread comparison accepting a slight error.
Problem described here Codaone#575 Workaround is to use approx value for spread comparison accepting a slight error.
Further workaround improvement was 00a920f |
I think this could be closed now as applied workaround eliminated (almost?) all consequences. For later, I would refactor SO to use Decimal amounts on orders calculations and precise prices based on such amounts. Price correction method was proposed in #512, but it's usage requires SO refactor anyway. Also, could be implemented more clean used Decimal and custom |
Sevaral tests were market as xfailed due to imprecise price caclulation, this commit adds pytest.approx() to allow slight error, see Codaone#575
From bitshares/python-bitshares#227 (comment)
In dexbot we're incrementing prices to place staggered orders, this is a test which shows actual order price and initially calculated price are different:
So, we should switch from incrementing prices to incrementing amount only (base or quote) to place staggered orders, and as a consequence we need a method to place orders specifying both base and quote amounts (see the first message)
Another example: test setup failed to place initial orders to close the target spread, see that 1% error:
The text was updated successfully, but these errors were encountered: