stringify stock numbers
This commit is contained in:
parent
d524e0ba32
commit
2a210cf69f
@ -186,7 +186,7 @@ def updateStocks(api_key, logf):
|
||||
if len(data) > 0:
|
||||
for symbol in symbols:
|
||||
try:
|
||||
stock_info[data[symbol]['quote']['symbol']] = {'current': data[symbol]['quote']['latestPrice'], 'change': data[symbol]['quote']['change'], 'percent_change':data[symbol]['quote']['changePercent'] * 100, 'day_low':data[symbol]['quote']['low'], 'day_high':data[symbol]['quote']['high'], 'volume':human_format(data[symbol]['quote']['latestVolume'])}
|
||||
stock_info[data[symbol]['quote']['symbol']] = {'current': str(data[symbol]['quote']['latestPrice']), 'change': str(data[symbol]['quote']['change']), 'percent_change': str(data[symbol]['quote']['changePercent'] * 100), 'day_low': str(data[symbol]['quote']['low']), 'day_high': str(data[symbol]['quote']['high']), 'volume': str(human_format(data[symbol]['quote']['latestVolume']))}
|
||||
except:
|
||||
pass
|
||||
all_stocks_settings['symbols'] = stock_info
|
||||
@ -225,7 +225,7 @@ def updateStocks(api_key, logf):
|
||||
try:
|
||||
for stock in data['quoteResponse']['result']:
|
||||
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'], 'day_low': stock['regularMarketDayLow'], 'day_high': stock['regularMarketDayHigh'], 'volume': human_format(stock['regularMarketVolume'])}
|
||||
stock_info[stock['symbol'].replace('BRK-A', 'BRK.A').replace('BRK-B', 'BRK.B')] = {'current': str(stock['regularMarketPrice']), 'change': str(stock['regularMarketChange']), 'percent_change': str(stock['regularMarketChangePercent']), 'day_low': str(stock['regularMarketDayLow']), 'day_high': str(stock['regularMarketDayHigh']), 'volume': str(human_format(stock['regularMarketVolume']))}
|
||||
except:
|
||||
pass
|
||||
all_stocks_settings['symbols'] = stock_info
|
||||
|
Loading…
Reference in New Issue
Block a user