added display name
This commit is contained in:
parent
a8b079b02c
commit
9a357655f4
@ -1119,9 +1119,7 @@ class StockTicker():
|
|||||||
point_changefinal = '{0:.10f}'.format(point_change2).rstrip("0")
|
point_changefinal = '{0:.10f}'.format(point_change2).rstrip("0")
|
||||||
current_final = '{0:.10f}'.format(current).rstrip("0")
|
current_final = '{0:.10f}'.format(current).rstrip("0")
|
||||||
percent_change = float(coin_info[cb]["percent_change"])
|
percent_change = float(coin_info[cb]["percent_change"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
arrow, change = self.getArrow(point_change)
|
arrow, change = self.getArrow(point_change)
|
||||||
|
|
||||||
percent_change = '%.2f' % abs(percent_change) + '%'
|
percent_change = '%.2f' % abs(percent_change) + '%'
|
||||||
@ -1141,13 +1139,17 @@ class StockTicker():
|
|||||||
percent_change = False
|
percent_change = False
|
||||||
if not all_crypto_settings['point']:
|
if not all_crypto_settings['point']:
|
||||||
point_change = False
|
point_change = False
|
||||||
|
|
||||||
midFrame = self.textToImage(ticker + '(' + base + ')', current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
if names:
|
||||||
|
ticker = coin_info[cb]['name']
|
||||||
|
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
||||||
|
else:
|
||||||
|
midFrame = self.textToImage(ticker + '(' + base + ')', current, arrow, percent_change, point_change) #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'))
|
||||||
stitchedStock = self.stitchImage([logo,midFrame])
|
stitchedStock = self.stitchImage([logo,midFrame])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -2072,14 +2074,12 @@ class StockTicker():
|
|||||||
f = open('csv/stocks_settings.json', 'r')
|
f = open('csv/stocks_settings.json', 'r')
|
||||||
all_stocks_settings = json.load(f)
|
all_stocks_settings = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if all_stocks_settings['title']:
|
if all_stocks_settings['title']:
|
||||||
title_img = self.openImage('feature_titles/stocks.png')
|
title_img = self.openImage('feature_titles/stocks.png')
|
||||||
image_list = [title_img]
|
image_list = [title_img]
|
||||||
image_list.append(self.blank)
|
image_list.append(self.blank)
|
||||||
else:
|
else:
|
||||||
image_list = []
|
image_list = []
|
||||||
|
|
||||||
if all_stocks_settings['chart']:
|
if all_stocks_settings['chart']:
|
||||||
try:
|
try:
|
||||||
f = open('csv/portfolio_settings.json', 'r')
|
f = open('csv/portfolio_settings.json', 'r')
|
||||||
@ -2087,7 +2087,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:
|
||||||
@ -2098,7 +2097,6 @@ class StockTicker():
|
|||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if all_stocks_settings['display_name']:
|
if all_stocks_settings['display_name']:
|
||||||
names = True
|
names = True
|
||||||
@ -2108,19 +2106,20 @@ class StockTicker():
|
|||||||
names = False
|
names = False
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
stock_info = all_stocks_settings['symbols']
|
stock_info = all_stocks_settings['symbols']
|
||||||
symbols = list(stock_info.keys())
|
symbols = list(stock_info.keys())
|
||||||
timenow = datetime.now(ny_zone).replace(tzinfo=None).strftime("%H:%M:%S")
|
timenow = datetime.now(ny_zone).replace(tzinfo=None).strftime("%H:%M:%S")
|
||||||
weekday = datetime.now(ny_zone).replace(tzinfo=None).weekday()
|
weekday = datetime.now(ny_zone).replace(tzinfo=None).weekday()
|
||||||
|
|
||||||
for i, symbol in enumerate(symbols):
|
for i, symbol in enumerate(symbols):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
info = stock_info[symbol]
|
info = stock_info[symbol]
|
||||||
|
|
||||||
change = float(info['change']) #TEXT
|
change = float(info['change']) #TEXT
|
||||||
ticker = symbol #TEXT
|
if names:
|
||||||
|
ticker = info['name'] #TEXT
|
||||||
|
else:
|
||||||
|
ticker = symbol
|
||||||
|
|
||||||
arrow, change = self.getArrow(change)
|
arrow, change = self.getArrow(change)
|
||||||
|
|
||||||
@ -2133,17 +2132,16 @@ class StockTicker():
|
|||||||
percent_change = False
|
percent_change = False
|
||||||
if not all_stocks_settings['point']:
|
if not all_stocks_settings['point']:
|
||||||
point_change = False
|
point_change = False
|
||||||
|
|
||||||
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
||||||
|
|
||||||
if all_stocks_settings['logos']:
|
if all_stocks_settings['logos']:
|
||||||
try:
|
try:
|
||||||
|
ticker = symbol
|
||||||
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 = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
||||||
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
|
||||||
@ -2174,7 +2172,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/6x13.pil")
|
font = ImageFont.load("./fonts/6x13.pil")
|
||||||
@ -2251,7 +2248,6 @@ class StockTicker():
|
|||||||
|
|
||||||
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:
|
||||||
@ -6753,7 +6749,10 @@ 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:
|
||||||
|
ticker = info['name'] #TEXT
|
||||||
|
else:
|
||||||
|
ticker = symbol
|
||||||
arrow, change = self.getArrow(change)
|
arrow, change = self.getArrow(change)
|
||||||
percent_change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
percent_change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
||||||
point_change = '%.2f' % abs(change)
|
point_change = '%.2f' % abs(change)
|
||||||
@ -6765,6 +6764,7 @@ class StockTicker():
|
|||||||
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
||||||
if market_settings['logos']:
|
if market_settings['logos']:
|
||||||
try:
|
try:
|
||||||
|
ticker = symbol
|
||||||
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 = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
||||||
stitchedStock = self.stitchImage([logo,midFrame])
|
stitchedStock = self.stitchImage([logo,midFrame])
|
||||||
@ -6818,7 +6818,10 @@ 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:
|
||||||
|
ticker = info['name'] #TEXT
|
||||||
|
else:
|
||||||
|
ticker = symbol
|
||||||
arrow, change = self.getArrow(change)
|
arrow, change = self.getArrow(change)
|
||||||
percent_change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
percent_change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
||||||
point_change = '%.2f' % abs(change)
|
point_change = '%.2f' % abs(change)
|
||||||
@ -6830,6 +6833,7 @@ class StockTicker():
|
|||||||
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
||||||
if market_settings['logos']:
|
if market_settings['logos']:
|
||||||
try:
|
try:
|
||||||
|
ticker = symbol
|
||||||
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 = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
||||||
stitchedStock = self.stitchImage([logo,midFrame])
|
stitchedStock = self.stitchImage([logo,midFrame])
|
||||||
@ -6883,7 +6887,10 @@ 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:
|
||||||
|
ticker = info['name']
|
||||||
|
else:
|
||||||
|
ticker = symbol #TEXT
|
||||||
arrow, change = self.getArrow(change)
|
arrow, change = self.getArrow(change)
|
||||||
percent_change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
percent_change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
||||||
point_change = '%.2f' % abs(change)
|
point_change = '%.2f' % abs(change)
|
||||||
@ -6895,6 +6902,7 @@ class StockTicker():
|
|||||||
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
midFrame = self.textToImage(ticker, current, arrow, percent_change, point_change) #IMAGE THE TEXT
|
||||||
if market_settings['logos']:
|
if market_settings['logos']:
|
||||||
try:
|
try:
|
||||||
|
ticker = symbol
|
||||||
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 = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
logo = self.openImage(os.path.join(logos_path, ticker + '.png'))
|
||||||
stitchedStock = self.stitchImage([logo,midFrame])
|
stitchedStock = self.stitchImage([logo,midFrame])
|
||||||
|
Loading…
Reference in New Issue
Block a user