Update database_caller.py

This commit is contained in:
Justin 2023-03-29 17:41:33 +08:00 committed by GitHub
parent f569f9ed1e
commit 62e30970de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,9 +148,14 @@ def updateStocksPrePost(api_key, logf):
'prechange': '%.2f' % stock['preMarketChange'],
'prepercent': '%.2f' % stock['preMarketChangePercent']}
except:
stock_info[stock['symbol']]['Pre-market'] = {'preprice': '%.2f' % stock['regularMarketPrice'],
'prechange': '%.2f' % 0,
'prepercent': '%.2f' % 0}
try:
stock_info[stock['symbol']]['Pre-market'] = {'preprice': '%.2f' % stock['postMarketPrice'],
'prechange': '%.2f' % 0,
'prepercent': '%.2f' % 0}
except:
stock_info[stock['symbol']]['Pre-market'] = {'preprice': '%.2f' % stock['regularMarketPrice'],
'prechange': '%.2f' % 0,
'prepercent': '%.2f' % 0}
try:
stock_info[stock['symbol']]['Post-market'] = {'postprice': '%.2f' % stock['postMarketPrice'],
'postchange': '%.2f' % stock['postMarketChange'],