bugfixing
This commit is contained in:
parent
d1c7b80aff
commit
42b7118c8e
@ -314,12 +314,26 @@ def recent_earnings():
|
||||
seen_list = []
|
||||
|
||||
with open(f"json/dashboard/data.json", 'rb') as file:
|
||||
res_list = orjson.loads(file.read())['recentEarnings']
|
||||
data = orjson.loads(file.read())['recentEarnings']
|
||||
|
||||
for item in res_list:
|
||||
|
||||
unique_str = f"{item['date']}-{item['symbol']}-{item['revenue']}-{item['eps']}"
|
||||
item['id'] = hashlib.md5(unique_str.encode()).hexdigest()
|
||||
res_list = []
|
||||
for item in data:
|
||||
try:
|
||||
with open(f"json/quote/{item['symbol']}.json","r") as file:
|
||||
quote_data = orjson.loads(file.read())
|
||||
|
||||
item['price'] = round(quote_data.get('price',0),2)
|
||||
item['changesPercentage'] = round(quote_data.get('changesPercentage',0),2)
|
||||
item['marketCap'] = quote_data.get('marketCap',0)
|
||||
item['eps'] = round(quote_data.get('eps',0),2)
|
||||
|
||||
unique_str = f"{item['date']}-{item['symbol']}"
|
||||
item['id'] = hashlib.md5(unique_str.encode()).hexdigest()
|
||||
res_list.append(item)
|
||||
except:
|
||||
pass
|
||||
|
||||
print(res_list)
|
||||
|
||||
|
||||
if res_list:
|
||||
@ -331,7 +345,7 @@ def recent_earnings():
|
||||
|
||||
for item in res_list:
|
||||
try:
|
||||
if item != None and item['id'] not in seen_ids and item['marketCap'] > 100E9:
|
||||
if item != None and item['id'] not in seen_ids and item['marketCap']:
|
||||
symbol = item['symbol']
|
||||
price = item['price']
|
||||
changes_percentage = round(item['changesPercentage'],2)
|
||||
@ -376,7 +390,7 @@ def recent_earnings():
|
||||
"embeds": [embed]
|
||||
}
|
||||
|
||||
response = requests.post(RECENT_EARNINGS_WEBHOOK_URL, json=payload)
|
||||
#response = requests.post(RECENT_EARNINGS_WEBHOOK_URL, json=payload)
|
||||
|
||||
if response.status_code in (200, 204):
|
||||
seen_list.append({'date': item['date'], 'id': item['id'], 'symbol': symbol})
|
||||
@ -395,8 +409,8 @@ def recent_earnings():
|
||||
try:
|
||||
with open("json/discord/recent_earnings.json","wb") as file:
|
||||
file.write(orjson.dumps(seen_list))
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def executive_order_message():
|
||||
|
||||
@ -558,8 +572,8 @@ def analyst_report():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
options_flow()
|
||||
dark_pool_flow()
|
||||
#options_flow()
|
||||
#dark_pool_flow()
|
||||
recent_earnings()
|
||||
executive_order_message()
|
||||
analyst_report()
|
||||
#executive_order_message()
|
||||
#analyst_report()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user