update sentiment tracker
This commit is contained in:
parent
73ef24a2f0
commit
c7b9187433
@ -33,7 +33,6 @@ async def get_data(session, total_symbols):
|
|||||||
for item in data:
|
for item in data:
|
||||||
symbol = item['symbol']
|
symbol = item['symbol']
|
||||||
item['sentiment'] = round(item['sentiment']*100)
|
item['sentiment'] = round(item['sentiment']*100)
|
||||||
item['lastSentiment'] = round(item['lastSentiment']*100)
|
|
||||||
|
|
||||||
if symbol in total_symbols:
|
if symbol in total_symbols:
|
||||||
try:
|
try:
|
||||||
@ -58,8 +57,13 @@ async def get_data(session, total_symbols):
|
|||||||
print(f"Error fetching data from {source}: {e}")
|
print(f"Error fetching data from {source}: {e}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Convert the result_data dictionary to a list of items
|
# Convert the result_data dictionary to a list of items
|
||||||
final_result = list(result_data.values())
|
final_result = list(result_data.values())
|
||||||
|
final_result = [{k: v for k, v in item.items() if k != 'lastSentiment'} for item in final_result]
|
||||||
|
|
||||||
final_result = sorted(final_result, key=lambda x: x['sentiment'], reverse=True)
|
final_result = sorted(final_result, key=lambda x: x['sentiment'], reverse=True)
|
||||||
|
|
||||||
for index, stock in enumerate(final_result, start=1):
|
for index, stock in enumerate(final_result, start=1):
|
||||||
@ -71,8 +75,6 @@ async def get_data(session, total_symbols):
|
|||||||
await save_json(final_result)
|
await save_json(final_result)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def run():
|
async def run():
|
||||||
con = sqlite3.connect('stocks.db')
|
con = sqlite3.connect('stocks.db')
|
||||||
cursor = con.cursor()
|
cursor = con.cursor()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user