beeb / pancaketrade

Limit orders for PancakeSwap
GNU General Public License v3.0
200 stars 91 forks source link

True Decimal Price #4

Open DigiTecK3D opened 3 years ago

DigiTecK3D commented 3 years ago

Hello, Really loving this BOT. First off have to say incredible work and thank you for putting it out there to everyone!

I was curious at the moment the price displays are in scientific notation and was wondering if maybe it could be displayed in the true decimal token value. I can understand that potentially some coins are so low on the decimal it might be hard to read, but at times knowing the USD value to get a better gauge on the price.

Thank you!

beeb commented 3 years ago

Hi, thanks for your kind words!

The current system, as you noticed, will use scientific notation for very small values. This is the default behavior of Python's g operator:

Floating point format. Uses lowercase exponential format if exponent is less than -4 or not less than precision, decimal format otherwise.

I could add a parameter in config file to disable this and use always decimal format, I already implemented a decimal formatting with a given number of significant digit which, if you can believe it, is not a default option in python formatting.

DigiTecK3D commented 3 years ago

That is a great idea to add a config variable to change it, I know the system is set up in such a way to also be visually pleasing those zeros can get crazy.

Something that occurred to me maybe one day but would be more work is to store such variable settings in some sort of settings menu in the bot. But that is getting way ahead of things ๐Ÿ˜„

One thing I did run into when I took the g operator out of the value price to get the decimal to a f operator I noticed the value was not right compared to poocoin charts, but then again I probably wasnโ€™t doing it right.

DigiTecK3D commented 3 years ago

Guess another thing knowing the decimal place number to put on the f operator instead of the g operator is something that needs to be solved. For example I have token that has way more than 18 decimals but on the contract says 9 so unless itโ€™s pushed you only see nothing but zeros.

beeb commented 3 years ago

Indeed, you need to know how many decimal places to use. Check out how I did it here https://github.com/beeb/pancaketrade/blob/76802782241e9a135c17504b780cf03fd08fb323/pancaketrade/conversations/addorder.py#L568

DigiTecK3D commented 3 years ago

Thanks, I will check it out for sure, having to brush up on my python knowledge. Trying out a different layout here to show the prices with bnb on top and USD on the bottom to help with the length. the top token is an example of an ultra-low decimal point placement, I have to set it to .20f to get it to even show. image

DigiTecK3D commented 3 years ago

So I forked the project and did some modes to the status page to clean up the view, including adding multiple 3 charts I visit all the time. maybe this will help here. image

beeb commented 3 years ago

Hey there! Thanks for your involvement. I like the idea of offering multiple chart links. I'm still not totally convinced by the floating point notation but I think making this configurable is the way to go in the end.

Having the chart links and price in dollars on a separate line adds 2 lines compared to the current layout, which makes each message a bit taller and you can see less on a single screen (especially thinking about smartphones here). That's my only concern with this, but maybe it can be tied to the config item, where the price will show on 2 lines only if scientific notation is disabled.

beeb commented 3 years ago

Chart links have been added to the develop branch, thanks for the suggestion

DigiTecK3D commented 3 years ago

๐Ÿ‘ alright that is great to have the charts integrated! And totally I can see what you mean about the extra lines stacking up the token status pages up more. Already having that issue the more tokens I add into the bot. That would be a good compromise to be able to have the option to at least disable scientific notation and view it at floating point decimal if chosen. Thank you!

DigiTecK3D commented 3 years ago

I reworked parts of the bot to be all USD based now so you can input and buy and displays are all in USD decimal and the price comparing is done on the USD value calculated and not purely on the BNB and added demo mode and fixed up quite a bit of the emoji order things to try to pull all of it together, you can check out the changes here https://github.com/DigiTecK3D/pancaketrade/commit/71ab80a09d96bbc623d1433b5173e8b28feb0816

beeb commented 3 years ago

Thanks for this. I have included the emoji additions in the develop branch for now as I think they were indeed missing. I'll work on implementing an option for forcing decimal prices in the near future. The demo mode is interesting but it would benefit from its own issue as its not related to this one.

DigiTecK3D commented 3 years ago

Great! Yeah having an option would be fantastic, and agreed about the demo mode thing, just found myself not wanting to accidentally sell or buy while testing. ๐Ÿ‘