update cron job
This commit is contained in:
parent
48d99fc644
commit
d4ccc0ab99
@ -71,24 +71,20 @@ def main():
|
|||||||
item['ticker'] = item['ticker'].replace('BRK.A','BRK-A').replace("BRK.B","BRK-B")
|
item['ticker'] = item['ticker'].replace('BRK.A','BRK-A').replace("BRK.B","BRK-B")
|
||||||
symbol = item['ticker']
|
symbol = item['ticker']
|
||||||
if symbol in stock_symbols:
|
if symbol in stock_symbols:
|
||||||
item['assetType'] = "stocks"
|
try:
|
||||||
else:
|
with open(f"json/quote/{symbol}.json") as file:
|
||||||
item['assetType'] = "etf"
|
quote_data = orjson.loads(file.read())
|
||||||
|
|
||||||
try:
|
item['date'] = item['date'].replace('p.m.', 'PM').replace('a.m.', 'AM')
|
||||||
with open(f"json/quote/{symbol}.json") as file:
|
res.append({
|
||||||
quote_data = orjson.loads(file.read())
|
**item,
|
||||||
|
'name': quote_data['name'],
|
||||||
item['date'] = item['date'].replace('p.m.', 'PM').replace('a.m.', 'AM')
|
'price': round(quote_data['price'],2),
|
||||||
res.append({
|
'changesPercentage': round(quote_data['changesPercentage'],2)
|
||||||
**item,
|
})
|
||||||
'name': quote_data['name'],
|
|
||||||
'price': round(quote_data['price'],2),
|
except Exception as e:
|
||||||
'changesPercentage': round(quote_data['changesPercentage'],2)
|
print(f"Error processing {symbol}: {e}")
|
||||||
})
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error processing {symbol}: {e}")
|
|
||||||
|
|
||||||
# Save the JSON data
|
# Save the JSON data
|
||||||
if len(res) > 0:
|
if len(res) > 0:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user