fixed decimal point issues

This commit is contained in:
Neythen Treloar
2022-02-22 20:10:42 +00:00
parent 52aef39e6f
commit 8753fdd454
3 changed files with 30 additions and 29 deletions

View File

@@ -71,7 +71,7 @@ def updateStocks(api_key):
stock_info = {}
for stock in data:
stock_info[stock['symbol']] = {'current': stock['price'], 'opening': float(stock['price']) - float(stock['change_since'])}
stock_info[stock['symbol']] = {'current': stock['price'], 'change': stock['change_since'], 'percent_change':stock['percent']}
print(stock_info)
all_stocks_settings['symbols'] = stock_info
@@ -127,7 +127,7 @@ def updateCrypto(api_key):
symbol = d['symbol']
base = d['currency']
coin_info[symbol.upper() + ',' + base.upper()] = {'current': d['price'], '24hr_change': d['percent_over_24hr']}
coin_info[symbol.upper() + ',' + base.upper()] = {'current': d['price'], '24hr_change': d['price_over_24hr'], 'percent_change': d['percent_over_24hr']}
all_crypto_settings['symbols'] = coin_info
@@ -175,12 +175,12 @@ def updateForex(api_key):
print(data)
c_dict = {}
for d in data:
c_dict[d['uid'].replace('/',',')] = {'current': d['rate'], '24hr_change': d['rate_over_24hr']}
c_dict[d['uid'].replace('/',',')] = {'current': d['rate'], '24hr_change': d['rate_over_24hr'], 'percent_change':d['percent_over_24hr']}
@@ -572,6 +572,7 @@ if __name__ == '__main__':
api_keys = f.readlines()
api_key = api_keys[0].strip()
try:
weather_key = api_keys[1].strip()
except Exception as e: