new rules
This commit is contained in:
parent
c55bc241ba
commit
7b82287474
@ -143,17 +143,17 @@ async def get_stock_screener(con):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with open(f"json/analyst/summary/{symbol}.json", 'r') as file:
|
with open(f"json/analyst/summary/{symbol}.json", 'r') as file:
|
||||||
rating = orjson.loads(file.read())['consensusRating']
|
res = orjson.loads(file.read())
|
||||||
if rating == 'Sell':
|
item['analystRating'] = res['consensusRating']
|
||||||
item['ratingRecommendation'] = 0
|
except Exception as e:
|
||||||
elif rating == 'Hold':
|
item['analystRating'] = None
|
||||||
item['ratingRecommendation'] = 1
|
|
||||||
elif rating == 'Buy':
|
try:
|
||||||
item['ratingRecommendation'] = 2
|
with open(f"json/fail-to-deliver/companies/{symbol}.json", 'r') as file:
|
||||||
else:
|
res = orjson.loads(file.read())[-1]
|
||||||
item['ratingRecommendation'] = None
|
item['failToDeliver'] = res['failToDeliver']
|
||||||
except:
|
except Exception as e:
|
||||||
item['ratingRecommendation'] = None
|
item['failToDeliver'] = None
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -1226,6 +1226,9 @@ async def save_json_files():
|
|||||||
crypto_cursor.execute("SELECT DISTINCT symbol FROM cryptos")
|
crypto_cursor.execute("SELECT DISTINCT symbol FROM cryptos")
|
||||||
crypto_symbols = [row[0] for row in crypto_cursor.fetchall()]
|
crypto_symbols = [row[0] for row in crypto_cursor.fetchall()]
|
||||||
|
|
||||||
|
stock_screener_data = await get_stock_screener(con)
|
||||||
|
with open(f"json/stock-screener/data.json", 'w') as file:
|
||||||
|
ujson.dump(stock_screener_data, file)
|
||||||
|
|
||||||
earnings_list = await get_earnings_calendar(con,symbols)
|
earnings_list = await get_earnings_calendar(con,symbols)
|
||||||
with open(f"json/earnings-calendar/calendar.json", 'w') as file:
|
with open(f"json/earnings-calendar/calendar.json", 'w') as file:
|
||||||
@ -1301,11 +1304,6 @@ async def save_json_files():
|
|||||||
with open(f"json/stocks-list/sp500_constituent.json", 'w') as file:
|
with open(f"json/stocks-list/sp500_constituent.json", 'w') as file:
|
||||||
ujson.dump(data, file)
|
ujson.dump(data, file)
|
||||||
|
|
||||||
|
|
||||||
stock_screener_data = await get_stock_screener(con)
|
|
||||||
with open(f"json/stock-screener/data.json", 'w') as file:
|
|
||||||
ujson.dump(stock_screener_data, file)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
con.close()
|
con.close()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user