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

Market Precision rounding #239

Open
Triggsy22 opened this issue Jun 16, 2022 · 1 comment
Open

Market Precision rounding #239

Triggsy22 opened this issue Jun 16, 2022 · 1 comment

Comments

@Triggsy22
Copy link

There are some possibilites to get the number of decimal places a market has.
But how do i get the amount of decimal places that are allowed to trade with.

As an example SOL/USD. SOL has 9 decimal places but its just allowe to trade with 1.
So if you try to create an order to buy 0.12345678 SOL, it will be automatically converted to an order to buy just 0.1 SOL.
You get no error or something and you notice it only if you check your order after creating it.

And why is only 1 decimal place allowed? Thats realy strange. On kraken, where my bots currently runnig, are 8 places the maximum.
For me, this is again crucial.

On other Markets it looks the same.

@Triggsy22
Copy link
Author

Ok, i found why serum is not using more decimal precision.
Because its just not possible. Or it would create terrible results.
Some Parts of the orderCreation stuff works with the datatype number. And Number is a float value.
It begins with placeOrder in market.ts and goes down until priceNumberToLots or baseSizeNumberToLots, where it gets converted.

Right now I don't understand serum well enough, so I don't know how much it affects the network.
But i think this is a big Problem.

We all know the Problems of float precisions.
There are some great Librarys out there to deal with this issue, like math.js

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

1 participant