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 url += '&apiKey=' + api_key
response = requests.get(url) response = requests.get(url)
data = response.json() data = response.json()
print(response)
print(data)
stock_info = {} stock_info = {}
@ -120,9 +121,13 @@ def updateCrypto(api_key):
print(data) print(data)
coin_info = {}
for i,d in enumerate(data): #TODO get base from the server 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 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') NY_zone = pytz.timezone('America/New_York')
CET_zone = pytz.timezone('Europe/Berlin') 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.chain_length = 2
options.parallel = 1 options.parallel = 1
options.hardware_mapping = 'adafruit-hat' # If you have an Adafruit HAT: 'adafruit-hat' 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 options.brightness = self.brightness
self.matrix = RGBMatrix(options = options) self.matrix = RGBMatrix(options = options)
print(dir(self.matrix)) print(dir(self.matrix))
@ -931,9 +931,6 @@ class StockTicker():
current = float(coin_info[cb]["current"]) current = float(coin_info[cb]["current"])
change = float(coin_info[cb]["24hr_change"]) change = float(coin_info[cb]["24hr_change"])
percent_change = '%.2f' % abs(change) +'%' percent_change = '%.2f' % abs(change) +'%'