fixed trailing zeros for crypto

This commit is contained in:
Justin 2023-05-03 12:42:05 +08:00 committed by GitHub
parent 2534f18495
commit 3d7da19b3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1025,8 +1025,17 @@ class StockTicker():
arrow, change = self.getArrow(point_change)
percent_change = '%.2f' % abs(percent_change) + '%'
point_change = str(point_changefinal)
current = str(current_final)
num3 = point_changefinal.split('.')
if len(num3[1]) <= 1:
point_change = '%.2f' % float(point_changefinal)
else:
point_change = str(point_changefinal)
num2 = current_final.split('.')
if len(num2[1]) <= 1:
current = '%.2f' % float(current_final)
else:
current = str(current_final)
if not all_crypto_settings['percent']:
percent_change = False
@ -1189,9 +1198,18 @@ class StockTicker():
# convert percent to points
change = '%.2f' % abs(float(coin_info[cb]['percent_change'])) + '%'
else:
change = str(changefinal)
current = str(current_final)
num3 = changefinal.split('.')
if len(num3[1]) <= 1:
change = '%.2f' % float(changefinal)
else:
change = str(changefinal)
num2 = current_final.split('.')
if len(num2[1]) <= 1:
current = '%.2f' % float(current_final)
else:
current = str(current_final)
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
if all_crypto_settings['logos']:
try: