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

Calculate correct amounts and prices for orders #511

Open
MarkoPaasila opened this issue Mar 16, 2019 · 2 comments
Open

Calculate correct amounts and prices for orders #511

MarkoPaasila opened this issue Mar 16, 2019 · 2 comments
Assignees
Labels
[2] Advanced Issue Issue is a technically advanced or complex task. Requires prior knowledge [2] Needs Verification Issue needs verification [3] Type: Enhancement [4] Priority: Low

Comments

@MarkoPaasila
Copy link
Collaborator

DEX orders can be always accurately expressed as fractional numbers, not decimal numbers. Strategies should calculate the exact fractional price and amounts that are actually possible, and use those values in the logic. They can be represented accurately enough using floats, but not every float value is possible. Placing orders that result in something else than expected causes hard to understand situations, and can be hard to debug. I suggest a method that, given a target price and amount, can return the closest actually possible values - which then can be further used in strategie's logic's.

@bitphage
Copy link
Collaborator

bitphage commented Mar 31, 2019

I proposed to have a method in the library to place an order with exact BASE and QUOTE amounts here
bitshares/python-bitshares#227

I think this solution would be cleaner than having special rounding method as in #512, as python-bithsares currently does own rounding in Market.sell() / Market.buy(), which means twice rounding.

@MarkoPaasila
Copy link
Collaborator Author

You still have to figure out what the exact amounts are. #512 gives you a method to find them using the price as decimal/float - like people normally think about prices - and not suffer from rounding. Your proposed method is what 512 was missing to make it perfect. Should I change 512 to also return/accept internal amounts? They are integers of course.

@bitphage bitphage added this to Idea in Ideas and Enhancements via automation Mar 11, 2020
@bitphage bitphage moved this from Idea to Research in Ideas and Enhancements Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[2] Advanced Issue Issue is a technically advanced or complex task. Requires prior knowledge [2] Needs Verification Issue needs verification [3] Type: Enhancement [4] Priority: Low
Projects
Development

No branches or pull requests

3 participants