added display names to prof display
This commit is contained in:
parent
7bd39c58d5
commit
90cf3de2fd
@ -1371,9 +1371,18 @@ class StockTicker():
|
|||||||
else:
|
else:
|
||||||
current = str(current_final)
|
current = str(current_final)
|
||||||
|
|
||||||
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
if names:
|
||||||
|
try:
|
||||||
|
ticker = coin_info[cb]['name'].upper()
|
||||||
|
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
except:
|
||||||
|
ticker, base = cb.split(',')
|
||||||
|
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
else:
|
||||||
|
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
if all_crypto_settings['logos']:
|
if all_crypto_settings['logos']:
|
||||||
try:
|
try:
|
||||||
|
ticker, base = cb.split(',')
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'crypto')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'crypto')
|
||||||
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
||||||
|
|
||||||
@ -2396,7 +2405,6 @@ class StockTicker():
|
|||||||
f.close()
|
f.close()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if all_stocks_settings['prepost']:
|
if all_stocks_settings['prepost']:
|
||||||
try:
|
try:
|
||||||
@ -2426,8 +2434,13 @@ class StockTicker():
|
|||||||
info = stock_info[symbol]
|
info = stock_info[symbol]
|
||||||
|
|
||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
ticker = symbol #TEXT
|
if names:
|
||||||
|
try:
|
||||||
|
ticker = info['name'].upper() #TEXT
|
||||||
|
except:
|
||||||
|
ticker = symbol
|
||||||
|
else:
|
||||||
|
ticker = symbol
|
||||||
arrow, change = self.getArrow(change, professional=True)
|
arrow, change = self.getArrow(change, professional=True)
|
||||||
|
|
||||||
if all_stocks_settings["percent"]:
|
if all_stocks_settings["percent"]:
|
||||||
@ -2435,11 +2448,11 @@ class StockTicker():
|
|||||||
else:
|
else:
|
||||||
change = '%.2f' % abs(change)
|
change = '%.2f' % abs(change)
|
||||||
|
|
||||||
|
|
||||||
current = '%.2f' % float(info['current']) #TEXT
|
current = '%.2f' % float(info['current']) #TEXT
|
||||||
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
|
||||||
if all_stocks_settings['logos']:
|
if all_stocks_settings['logos']:
|
||||||
|
ticker = symbol
|
||||||
try:
|
try:
|
||||||
try: #load the tiny logo
|
try: #load the tiny logo
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
||||||
@ -2457,11 +2470,9 @@ class StockTicker():
|
|||||||
logo = logo.resize((int(width/2), int(height/2)))
|
logo = logo.resize((int(width/2), int(height/2)))
|
||||||
stitchedStock = self.stitchImage([logo,midFrame])
|
stitchedStock = self.stitchImage([logo,midFrame])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
stitchedStock = midFrame
|
stitchedStock = midFrame
|
||||||
else:
|
else:
|
||||||
stitchedStock = midFrame
|
stitchedStock = midFrame
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if all_stocks_settings['lohivol']:
|
if all_stocks_settings['lohivol']:
|
||||||
font = ImageFont.load("./fonts/4x6.pil")
|
font = ImageFont.load("./fonts/4x6.pil")
|
||||||
@ -2487,7 +2498,6 @@ class StockTicker():
|
|||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if all_stocks_settings['prepost']:
|
if all_stocks_settings['prepost']:
|
||||||
font = ImageFont.load("./fonts/5x8.pil")
|
font = ImageFont.load("./fonts/5x8.pil")
|
||||||
@ -2525,7 +2535,6 @@ class StockTicker():
|
|||||||
prepost_img.paste(prechange_img, (preprice_img.size[0] + arrow.size[0] + 2,7))
|
prepost_img.paste(prechange_img, (preprice_img.size[0] + arrow.size[0] + 2,7))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif ((timenow < "04:00:00" or timenow > "16:00:00") and (weekday <= 4)) or (weekday > 4): #postmarket
|
elif ((timenow < "04:00:00" or timenow > "16:00:00") and (weekday <= 4)) or (weekday > 4): #postmarket
|
||||||
try:
|
try:
|
||||||
postprice = '%.2f' % abs(float(prepost_settings[symbol]['Post-market']['postprice']))
|
postprice = '%.2f' % abs(float(prepost_settings[symbol]['Post-market']['postprice']))
|
||||||
@ -2559,10 +2568,8 @@ class StockTicker():
|
|||||||
prepost_img.paste(postchange_img, (postprice_img.size[0] + arrow.size[0] + 2,7))
|
prepost_img.paste(postchange_img, (postprice_img.size[0] + arrow.size[0] + 2,7))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if all_stocks_settings['chart'] and (symbol in portfolio_settings): #IF USER INPUTTED PORTFOLIO SETTINGS, DISPLAY PORTFOLIO INFO
|
if all_stocks_settings['chart'] and (symbol in portfolio_settings): #IF USER INPUTTED PORTFOLIO SETTINGS, DISPLAY PORTFOLIO INFO
|
||||||
try:
|
try:
|
||||||
@ -7004,8 +7011,13 @@ class StockTicker():
|
|||||||
try:
|
try:
|
||||||
info = active_info[symbol]
|
info = active_info[symbol]
|
||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
ticker = symbol #TEXT
|
if names:
|
||||||
|
try:
|
||||||
|
ticker = info['name'].upper() #TEXT
|
||||||
|
except:
|
||||||
|
ticker = symbol
|
||||||
|
else:
|
||||||
|
ticker = symbol
|
||||||
arrow, change = self.getArrow(change, professional=True)
|
arrow, change = self.getArrow(change, professional=True)
|
||||||
|
|
||||||
if market_settings["percent"]:
|
if market_settings["percent"]:
|
||||||
@ -7017,16 +7029,13 @@ class StockTicker():
|
|||||||
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
|
||||||
if market_settings['logos']:
|
if market_settings['logos']:
|
||||||
|
ticker = symbol
|
||||||
try:
|
try:
|
||||||
try: #load the tiny logo
|
try: #load the tiny logo
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
||||||
|
|
||||||
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
|
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
|
||||||
|
|
||||||
except: # load the big logo and scale it
|
except: # load the big logo and scale it
|
||||||
|
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'stocks')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'stocks')
|
||||||
|
|
||||||
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
|
logo = Image.open(os.path.join(logos_path, ticker + '.png'))
|
||||||
# half the size of the logo
|
# half the size of the logo
|
||||||
width, height = logo.size
|
width, height = logo.size
|
||||||
@ -7083,7 +7092,13 @@ class StockTicker():
|
|||||||
try:
|
try:
|
||||||
info = losers_info[symbol]
|
info = losers_info[symbol]
|
||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
ticker = symbol #TEXT
|
if names:
|
||||||
|
try:
|
||||||
|
ticker = info['name'].upper() #TEXT
|
||||||
|
except:
|
||||||
|
ticker = symbol
|
||||||
|
else:
|
||||||
|
ticker = symbol
|
||||||
|
|
||||||
arrow, change = self.getArrow(change, professional=True)
|
arrow, change = self.getArrow(change, professional=True)
|
||||||
|
|
||||||
@ -7096,6 +7111,7 @@ class StockTicker():
|
|||||||
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
|
||||||
if market_settings['logos']:
|
if market_settings['logos']:
|
||||||
|
ticker = symbol
|
||||||
try:
|
try:
|
||||||
try: #load the tiny logo
|
try: #load the tiny logo
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
||||||
@ -7161,7 +7177,13 @@ class StockTicker():
|
|||||||
try:
|
try:
|
||||||
info = gainers_info[symbol]
|
info = gainers_info[symbol]
|
||||||
change = float(info['change'])#TEXT
|
change = float(info['change'])#TEXT
|
||||||
ticker = symbol #TEXT
|
if names:
|
||||||
|
try:
|
||||||
|
ticker = info['name'].upper() #TEXT
|
||||||
|
except:
|
||||||
|
ticker = symbol
|
||||||
|
else:
|
||||||
|
ticker = symbol
|
||||||
arrow, change = self.getArrow(change, professional=True)
|
arrow, change = self.getArrow(change, professional=True)
|
||||||
if market_settings["percent"]:
|
if market_settings["percent"]:
|
||||||
change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
||||||
@ -7171,6 +7193,7 @@ class StockTicker():
|
|||||||
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker, current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
|
||||||
if market_settings['logos']:
|
if market_settings['logos']:
|
||||||
|
ticker = symbol
|
||||||
try:
|
try:
|
||||||
try: #load the tiny logo
|
try: #load the tiny logo
|
||||||
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
logos_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logos'), 'tiny_stocks')
|
||||||
|
Loading…
Reference in New Issue
Block a user