diff --git a/stockTicker.py b/stockTicker.py index 1ec8cc5..2fe798f 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -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: