crypto added day lo hi

This commit is contained in:
Justin 2023-08-07 18:22:48 +08:00 committed by GitHub
parent b383d6e029
commit d524e0ba32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1075,7 +1075,44 @@ class StockTicker():
stitchedStock = midFrame stitchedStock = midFrame
else: else:
stitchedStock = midFrame stitchedStock = midFrame
try:
if all_crypto_settings['lohivol']:
font = ImageFont.load("./fonts/5x8.pil")
try:
day_low1 = '{0:.10f}'.format(float(coin_info[cb]['day_low'])).rstrip("0")
day_high1 = '{0:.10f}'.format(float(coin_info[cb]['day_high'])).rstrip("0")
day_low2 = day_low1.split('.')
day_high2 = day_high1.split('.')
if len(day_low2[1]) <= 1:
day_low = '%.2f' % float(day_low1)
else:
day_low = day_low1
if len(day_high2[1]) <= 1:
day_high = '%.2f' % float(day_high1)
else:
day_high = day_high1
volume = coin_info[cb]['volume']
daylow_img = self.textImage(day_low, font, r=0, g=255, b=0)
daylow_t_img = self.textImage('Lo', font, r=255, g=255, b=255)
dayhi_img = self.textImage(day_high, font, r=0,g=255,b=0)
dayhi_t_img = self.textImage('Hi', font, r=255,g=255,b=255)
vol_img = self.textImage(volume, font, r=0,g=255,b=0)
vol_t_img = self.textImage('Vol', font, r=255,g=255,b=255)
lohivol_img = Image.new('RGB', (max(daylow_img.size[0] + daylow_t_img.size[0], dayhi_img.size[0] + dayhi_t_img.size[0],
vol_img.size[0] + vol_t_img.size[0]) + 5, 32))
lohivol_img.paste(daylow_t_img, (0, 3))
lohivol_img.paste(daylow_img, (daylow_t_img.size[0],3))
lohivol_img.paste(dayhi_t_img, (0, 12))
lohivol_img.paste(dayhi_img, (dayhi_t_img.size[0], 12))
lohivol_img.paste(vol_t_img, (0, 21))
lohivol_img.paste(vol_img, (vol_t_img.size[0], 21))
except:
pass
except:
pass
try: try:
if all_crypto_settings['chart'] and (cb in portfolio_settings): #IF USER INPUTTED PORTFOLIO SETTINGS, DISPLAY PORTFOLIO INFO if all_crypto_settings['chart'] and (cb in portfolio_settings): #IF USER INPUTTED PORTFOLIO SETTINGS, DISPLAY PORTFOLIO INFO
try: try:
@ -1164,6 +1201,14 @@ class StockTicker():
pass pass
image_list.append(stitchedStock) image_list.append(stitchedStock)
try:
if all_crypto_settings['lohivol']:
try:
image_list.append(lohivol_img)
except:
pass
except:
pass
try: try:
if all_crypto_settings['chart'] and (cb in portfolio_settings): if all_crypto_settings['chart'] and (cb in portfolio_settings):
try: try: