2dp for percent change
This commit is contained in:
parent
5cf29c80e4
commit
b896914edf
@ -29,8 +29,8 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py")
|
||||||
api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
#api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py")
|
||||||
time.sleep(3)
|
#time.sleep(3)
|
||||||
|
|
||||||
|
|
||||||
#api_caller.sendline('A')
|
#api_caller.sendline('A')
|
||||||
@ -558,6 +558,7 @@ def save_trade_settings(input_settings):
|
|||||||
filename = input_settings['feature'].lower() + '_settings.json'
|
filename = input_settings['feature'].lower() + '_settings.json'
|
||||||
f = open('csv/' + filename, 'r')
|
f = open('csv/' + filename, 'r')
|
||||||
current_settings = json.load(f)
|
current_settings = json.load(f)
|
||||||
|
print(current_settings)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
current_settings['speed'] = input_settings['speed'].lower()
|
current_settings['speed'] = input_settings['speed'].lower()
|
||||||
|
@ -935,7 +935,7 @@ class StockTicker():
|
|||||||
|
|
||||||
arrow, change = self.getArrow(point_change)
|
arrow, change = self.getArrow(point_change)
|
||||||
|
|
||||||
percent_change = str(abs(percent_change)) + '%'
|
percent_change = '%.2f' % abs(percent_change) + '%'
|
||||||
point_change = str(abs(point_change))
|
point_change = str(abs(point_change))
|
||||||
current = str(current)
|
current = str(current)
|
||||||
|
|
||||||
@ -1010,10 +1010,10 @@ class StockTicker():
|
|||||||
|
|
||||||
if all_crypto_settings["percent"]:
|
if all_crypto_settings["percent"]:
|
||||||
# convert percent to points
|
# convert percent to points
|
||||||
change = str(abs(float(coin_info[cb]['percent_change']))) + '%'
|
change = '%.2f' % abs(float(coin_info[cb]['percent_change'])) + '%'
|
||||||
else:
|
else:
|
||||||
|
|
||||||
change = str(abs(float(change)))
|
change = str(abs(change))
|
||||||
|
|
||||||
current = str(current)
|
current = str(current)
|
||||||
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(ticker + '(' + base + ')', current, change, arrow, font=ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
@ -1072,7 +1072,7 @@ class StockTicker():
|
|||||||
current = float(forex_settings[sb]['current'])
|
current = float(forex_settings[sb]['current'])
|
||||||
change = float(forex_settings[sb]['24hr_change'])
|
change = float(forex_settings[sb]['24hr_change'])
|
||||||
|
|
||||||
percent_change = str(abs(float(forex_settings[sb]['percent_change']))) +'%'
|
percent_change = '%.2f' % abs(float(forex_settings[sb]['percent_change'])) +'%'
|
||||||
|
|
||||||
|
|
||||||
point_change = str(abs(change))
|
point_change = str(abs(change))
|
||||||
@ -1163,12 +1163,14 @@ class StockTicker():
|
|||||||
|
|
||||||
|
|
||||||
if all_forex_settings["percent"]:
|
if all_forex_settings["percent"]:
|
||||||
# convert percent to points
|
|
||||||
change = abs(float(forex_settings[sb]['percent_change']))
|
change = abs(float(forex_settings[sb]['percent_change']))
|
||||||
|
|
||||||
change = str(change) + '%'
|
|
||||||
|
|
||||||
|
change = '%.2f' % change + '%'
|
||||||
else:
|
else:
|
||||||
change = str(change)
|
change = str(abs(change))
|
||||||
current = str(current)
|
current = str(current)
|
||||||
midFrame = self.textToImageProf(symbol + '(' + base + ')', current, change, arrow, font = ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
midFrame = self.textToImageProf(symbol + '(' + base + ')', current, change, arrow, font = ImageFont.load("./fonts/6x10.pil")) #IMAGE THE TEXT
|
||||||
|
|
||||||
@ -1243,11 +1245,11 @@ class StockTicker():
|
|||||||
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 = str(abs(change))
|
||||||
|
|
||||||
print(percent_change, point_change)
|
print(percent_change, point_change)
|
||||||
|
|
||||||
current = '%.2f' % float(info['current']) #TEXT
|
current = str(float(info['current'])) #TEXT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1327,10 +1329,10 @@ class StockTicker():
|
|||||||
if all_stocks_settings["percent"]:
|
if all_stocks_settings["percent"]:
|
||||||
change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
change = '%.2f' % abs(float(info['percent_change'])) + '%'
|
||||||
else:
|
else:
|
||||||
change = '%.2f' % abs(change)
|
change = str(abs(change))
|
||||||
|
|
||||||
|
|
||||||
current = '%.2f' % float(info['current']) #TEXT
|
current = str(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']:
|
||||||
|
@ -3214,6 +3214,16 @@
|
|||||||
value=""
|
value=""
|
||||||
|
|
||||||
id="flexCheckChecked31"
|
id="flexCheckChecked31"
|
||||||
|
|
||||||
|
{%
|
||||||
|
|
||||||
|
if
|
||||||
|
|
||||||
|
news_settings.title%}
|
||||||
|
|
||||||
|
checked
|
||||||
|
|
||||||
|
{%endif%}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user