From fada23f80ba6326085ec76b76a58519619520cce Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 9 Aug 2023 16:56:59 +0800 Subject: [PATCH] fixed percent point change bug for getmarketimage --- stockTicker.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index b0ecc0e..81149cf 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -6480,11 +6480,6 @@ class StockTicker(): losers_info = market_settings['losers'] losers_symbols = list(losers_info.keys()) - if not market_settings['percent']: - percent_change = False - if not market_settings['point']: - point_change = False - for category in market_settings['categories']: if category == 'Most Active': most_active = self.openImage('logos/active.png') @@ -6498,6 +6493,10 @@ class StockTicker(): percent_change = '%.2f' % abs(float(info['percent_change'])) + '%' point_change = '%.2f' % abs(change) current = '%.2f' % float(info['current']) #TEXT + if not market_settings['percent']: + percent_change = False + if not market_settings['point']: + point_change = False midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT if market_settings['logos']: try: @@ -6559,6 +6558,10 @@ class StockTicker(): percent_change = '%.2f' % abs(float(info['percent_change'])) + '%' point_change = '%.2f' % abs(change) current = '%.2f' % float(info['current']) #TEXT + if not market_settings['percent']: + percent_change = False + if not market_settings['point']: + point_change = False midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT if market_settings['logos']: try: @@ -6620,6 +6623,10 @@ class StockTicker(): percent_change = '%.2f' % abs(float(info['percent_change'])) + '%' point_change = '%.2f' % abs(change) current = '%.2f' % float(info['current']) #TEXT + if not market_settings['percent']: + percent_change = False + if not market_settings['point']: + point_change = False midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT if market_settings['logos']: try: