bugfixing
This commit is contained in:
parent
0132908a61
commit
b8d8779b05
@ -280,7 +280,7 @@ async def get_analyst_report():
|
|||||||
with sqlite3.connect('stocks.db') as con:
|
with sqlite3.connect('stocks.db') as con:
|
||||||
cursor = con.cursor()
|
cursor = con.cursor()
|
||||||
cursor.execute("PRAGMA journal_mode = wal")
|
cursor.execute("PRAGMA journal_mode = wal")
|
||||||
cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE symbol NOT LIKE '%.%' AND symbol NOT LIKE '%-%' AND marketCap > 1e10")
|
cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE symbol NOT LIKE '%.%' AND symbol NOT LIKE '%-%' AND marketCap > 50E9")
|
||||||
symbols = {row[0] for row in cursor.fetchall()} # Use a set for fast lookups
|
symbols = {row[0] for row in cursor.fetchall()} # Use a set for fast lookups
|
||||||
|
|
||||||
# Define the directory path
|
# Define the directory path
|
||||||
@ -315,6 +315,7 @@ async def get_analyst_report():
|
|||||||
# Merge the summary data into the latest data dictionary
|
# Merge the summary data into the latest data dictionary
|
||||||
latest_data.update({
|
latest_data.update({
|
||||||
'symbol': latest_symbol,
|
'symbol': latest_symbol,
|
||||||
|
'numOfAnalyst': summary_data.get('numOfAnalyst'),
|
||||||
'consensusRating': summary_data.get('consensusRating'),
|
'consensusRating': summary_data.get('consensusRating'),
|
||||||
'medianPriceTarget': summary_data.get('medianPriceTarget'),
|
'medianPriceTarget': summary_data.get('medianPriceTarget'),
|
||||||
'avgPriceTarget': summary_data.get('avgPriceTarget'),
|
'avgPriceTarget': summary_data.get('avgPriceTarget'),
|
||||||
@ -344,11 +345,11 @@ async def get_analyst_report():
|
|||||||
#print(f"The latest report for symbol {latest_symbol}:", latest_data)
|
#print(f"The latest report for symbol {latest_symbol}:", latest_data)
|
||||||
|
|
||||||
# Return the latest data found
|
# Return the latest data found
|
||||||
return latest_data if latest_data else []
|
return latest_data if latest_data else {}
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"An error occurred: {e}")
|
print(f"An error occurred: {e}")
|
||||||
return []
|
return {}
|
||||||
|
|
||||||
async def run():
|
async def run():
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user