fixed decimal point issues
This commit is contained in:
parent
8753fdd454
commit
8904b329be
@ -939,6 +939,7 @@ class StockTicker():
|
||||
|
||||
percent_change = str(abs(percent_change))
|
||||
point_change = str(abs(point_change))
|
||||
current = str(current)
|
||||
|
||||
if not all_crypto_settings['percent']:
|
||||
percent_change = False
|
||||
@ -953,8 +954,8 @@ class StockTicker():
|
||||
|
||||
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
||||
stitchedStock = self.stitchImage([logo,midFrame])
|
||||
except:
|
||||
|
||||
except Exception as e:
|
||||
|
||||
stitchedStock = midFrame
|
||||
else:
|
||||
stitchedStock = midFrame
|
||||
@ -964,6 +965,7 @@ class StockTicker():
|
||||
image_list.append(self.blank)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
self.logf.write(str(e))
|
||||
@ -1072,11 +1074,11 @@ class StockTicker():
|
||||
current = float(forex_settings[sb]['current'])
|
||||
change = float(forex_settings[sb]['24hr_change'])
|
||||
|
||||
percent_change = str(abs(forex_settings[sb]['percent_change'])) +'%'
|
||||
percent_change = str(abs(float(forex_settings[sb]['percent_change']))) +'%'
|
||||
|
||||
|
||||
point_change = str(abs(change))
|
||||
|
||||
|
||||
if not all_forex_settings['percent']:
|
||||
percent_change = False
|
||||
if not all_forex_settings['point']:
|
||||
@ -1086,7 +1088,7 @@ class StockTicker():
|
||||
|
||||
|
||||
|
||||
current = '%.3f' % current
|
||||
current = str(current)
|
||||
|
||||
|
||||
midFrame = self.textToImage(base+ '(' + symbol + ')', current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
||||
@ -1115,6 +1117,7 @@ class StockTicker():
|
||||
image_list.append(self.blank)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
self.logf.write(str(e))
|
||||
@ -1163,7 +1166,7 @@ class StockTicker():
|
||||
|
||||
if all_forex_settings["percent"]:
|
||||
# convert percent to points
|
||||
change = abs(forex_settings[sb]['percent_change'])/current * 100
|
||||
change = abs(float(forex_settings[sb]['percent_change']))
|
||||
|
||||
change = str(change) + '%'
|
||||
else:
|
||||
@ -1325,6 +1328,8 @@ class StockTicker():
|
||||
|
||||
if all_stocks_settings["percent"]:
|
||||
change = str(abs(float(info['percent_change']))) + '%'
|
||||
else:
|
||||
change = str(abs(change))
|
||||
|
||||
|
||||
current = str(float(info['current'])) #TEXT
|
||||
@ -1781,7 +1786,7 @@ class StockTicker():
|
||||
img = img.crop((0,0,x_offset ,32))
|
||||
imgs.append(img)
|
||||
except Exception as e:
|
||||
raise e
|
||||
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
self.logf.write(str(e))
|
||||
@ -2750,7 +2755,7 @@ if __name__ == '__main__':
|
||||
|
||||
#stock_ticker.process_msg('-')
|
||||
#stock_ticker.process_msg('W')
|
||||
#stock_ticker.process_msg('A')
|
||||
stock_ticker.process_msg('A')
|
||||
|
||||
|
||||
|
||||
@ -2758,7 +2763,7 @@ if __name__ == '__main__':
|
||||
msg = getInput()
|
||||
stock_ticker.process_msg(msg)
|
||||
except Exception as e:
|
||||
|
||||
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
log.write(str(e))
|
||||
|
Loading…
Reference in New Issue
Block a user