added try and except for prepost
This commit is contained in:
parent
e26f27eb38
commit
39f0496b92
@ -282,6 +282,7 @@ def updateStocksPrePost(api_key, logf):
|
|||||||
|
|
||||||
if len(prepost_data) > 0:
|
if len(prepost_data) > 0:
|
||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
|
try:
|
||||||
for stock in prepost_data:
|
for stock in prepost_data:
|
||||||
if stock['symbol'] == symbol:
|
if stock['symbol'] == symbol:
|
||||||
stock_info[stock['symbol']] = {"time_now":time_now}
|
stock_info[stock['symbol']] = {"time_now":time_now}
|
||||||
@ -306,7 +307,8 @@ def updateStocksPrePost(api_key, logf):
|
|||||||
stock_info[stock['symbol'].replace('BRK-A', 'BRK.A').replace('BRK-B', 'BRK.B')]['Post-market'] = {'postprice': '%.2f' % stock['regularMarketPrice'],
|
stock_info[stock['symbol'].replace('BRK-A', 'BRK.A').replace('BRK-B', 'BRK.B')]['Post-market'] = {'postprice': '%.2f' % stock['regularMarketPrice'],
|
||||||
'postchange': '%.2f' % 0,
|
'postchange': '%.2f' % 0,
|
||||||
'postpercent': '%.2f' % 0}
|
'postpercent': '%.2f' % 0}
|
||||||
|
except:
|
||||||
|
pass
|
||||||
all_stocks_settings['symbols'] = stock_info
|
all_stocks_settings['symbols'] = stock_info
|
||||||
|
|
||||||
with open('csv/prepost_settings.json', 'w+') as f:
|
with open('csv/prepost_settings.json', 'w+') as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user