replace .replace('BRK-A', 'BRK.A').replace('BRK-B', 'BRK.B')

This commit is contained in:
Justin 2023-07-24 17:15:12 +08:00 committed by GitHub
parent 3b1c5a7d55
commit 0ea3abf9d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,7 +215,7 @@ def updateStocks(api_key, logf):
for symbol in symbols:
try:
for stock in data['quoteResponse']['result']:
if stock['symbol'] == symbol:
if stock['symbol'].replace('BRK-A', 'BRK.A').replace('BRK-B', 'BRK.B') == symbol:
stock_info[stock['symbol'].replace('BRK-A', 'BRK.A').replace('BRK-B', 'BRK.B')] = {'current': stock['regularMarketPrice'], 'change': stock['regularMarketChange'], 'percent_change':stock['regularMarketChangePercent']}
except:
pass