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

How to add support for decimal numbers? #5

Open
Rafinhi opened this issue Nov 17, 2021 · 1 comment
Open

How to add support for decimal numbers? #5

Rafinhi opened this issue Nov 17, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@Rafinhi
Copy link

Rafinhi commented Nov 17, 2021

Hi, I have replaced the BTCUSD pair with DOTUSD pair, but as DOT trades around 42 USD at this moment it would be kinda cool to see the decimals as well, I tried to modify the code myself but it seems like there is a lot of use of the integers and simply replacing them with float might not be enough. Is there an easy way to make this change?

@Rafinhi
Copy link
Author

Rafinhi commented Nov 17, 2021

Solved it by adding :

"char buf[7];" below of "int lastTimeframe = -1;"

and below of "int price = round(candles[candlesLimit-1].c);" I added: "float FloatPrice = candles[candlesLimit-1].c;"
and then replacing the "//tft.print(formatPrice(price));" with:
gcvt(FloatPrice, 4, buf);
tft.print(buf);

This is a dirty solution as it just keeps all the background calculations and just displays current price with the 2 decimal numbers but its good enough for me :)

@spareleg spareleg added the enhancement New feature or request label Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants