crypto database update, initial feature settings

This commit is contained in:
Neythen Treloar 2022-02-21 18:33:19 +00:00
parent abf823a2c2
commit b9d4ca9122
4 changed files with 18 additions and 16 deletions

0
csv/system_info.json Normal file → Executable file
View File

View File

@ -65,7 +65,8 @@ def updateStocks(api_key):
url += '&apiKey=' + api_key
response = requests.get(url)
data = response.json()
print(response)
print(data)
stock_info = {}
@ -80,7 +81,7 @@ def updateStocks(api_key):
json.dump(all_stocks_settings, open('csv/stocks_settings.json', 'w+'))
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
logf.write(str(e))
@ -120,9 +121,13 @@ def updateCrypto(api_key):
print(data)
coin_info = {}
for i,d in enumerate(data): #TODO get base from the server
coin_info[symbol_base[i]] = {'current': d['price'], '24hr_change': d['percent_over_24hr']}
symbol = d['symbol']
base = d['currency']
coin_info[symbol.upper() + ',' + base.upper()] = {'current': d['price'], '24hr_change': d['percent_over_24hr']}
all_crypto_settings['symbols'] = coin_info
@ -545,7 +550,7 @@ if __name__ == '__main__':
update_frequencies = {'stocks':1, 'crypto':5, 'forex':60, 'news':120, 'weather': 120, 'sports': 120} #minutes
update_frequencies = {'stocks':1, 'crypto':5, 'forex':60, 'news':120, 'weather': 120, 'sports': 1440} #minutes
NY_zone = pytz.timezone('America/New_York')
CET_zone = pytz.timezone('Europe/Berlin')

File diff suppressed because one or more lines are too long

View File

@ -57,7 +57,7 @@ class StockTicker():
options.chain_length = 2
options.parallel = 1
options.hardware_mapping = 'adafruit-hat' # If you have an Adafruit HAT: 'adafruit-hat'
options.gpio_slowdown = 1
options.gpio_slowdown = 4
options.brightness = self.brightness
self.matrix = RGBMatrix(options = options)
print(dir(self.matrix))
@ -931,9 +931,6 @@ class StockTicker():
current = float(coin_info[cb]["current"])
change = float(coin_info[cb]["24hr_change"])
percent_change = '%.2f' % abs(change) +'%'