bugfixing
This commit is contained in:
parent
cf20e3b396
commit
0a2698509a
@ -374,7 +374,7 @@ def run(symbol):
|
|||||||
|
|
||||||
revenue_sources = []
|
revenue_sources = []
|
||||||
geography_sources = []
|
geography_sources = []
|
||||||
filings = Company(symbol).get_filings(form=["10-Q"]).latest(20)
|
filings = Company(symbol).get_filings(form=["10-Q","10-K"]).latest(20)
|
||||||
#print(filings[0].xbrl())
|
#print(filings[0].xbrl())
|
||||||
|
|
||||||
for i in range(0,17):
|
for i in range(0,17):
|
||||||
@ -423,7 +423,7 @@ def run(symbol):
|
|||||||
for old, new in replacements.items():
|
for old, new in replacements.items():
|
||||||
name = name.replace(old, new)
|
name = name.replace(old, new)
|
||||||
# Determine the target list and the name transformation logic
|
# Determine the target list and the name transformation logic
|
||||||
if symbol in ['NFLX','LLY','MSFT','META','NVDA','AAPL','GME']:
|
if symbol in ['SAVE','BA','NFLX','LLY','MSFT','META','NVDA','AAPL','GME']:
|
||||||
column_list = ["srt:ProductOrServiceAxis"]
|
column_list = ["srt:ProductOrServiceAxis"]
|
||||||
else:
|
else:
|
||||||
column_list = ["srt:ProductOrServiceAxis", "us-gaap:StatementBusinessSegmentsAxis"]
|
column_list = ["srt:ProductOrServiceAxis", "us-gaap:StatementBusinessSegmentsAxis"]
|
||||||
@ -448,16 +448,7 @@ def run(symbol):
|
|||||||
ujson.dump(final_dataset, file)
|
ujson.dump(final_dataset, file)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
'''
|
|
||||||
custom_order = {
|
|
||||||
'HardwareAndAccessories': 4,
|
|
||||||
'Software': 3,
|
|
||||||
'Collectibles': 2,
|
|
||||||
}
|
|
||||||
run('GME', custom_order)
|
|
||||||
'''
|
|
||||||
|
|
||||||
for symbol in ['ADBE']: #['NFLX','PLTR','MSFT','META','TSLA','NVDA','AAPL','GME']:
|
for symbol in []: #['SAVE','BA','ADBE','NFLX','PLTR','MSFT','META','TSLA','NVDA','AAPL','GME']:
|
||||||
#for AMD we need 10-K form to get geography revenue
|
#for AMD, SAVE we need 10-K form to get geography revenue
|
||||||
run(symbol)
|
run(symbol)
|
||||||
|
|
||||||
|
|||||||
@ -182,7 +182,12 @@ async def get_upcoming_earnings(session):
|
|||||||
async def get_recent_earnings(session):
|
async def get_recent_earnings(session):
|
||||||
url = "https://api.benzinga.com/api/v2.1/calendar/earnings"
|
url = "https://api.benzinga.com/api/v2.1/calendar/earnings"
|
||||||
res_list = []
|
res_list = []
|
||||||
querystring = {"token": benzinga_api_key,"parameters[date_from]":yesterday,"parameters[date_to]":today,"parameters[date_sort]":"date"}
|
|
||||||
|
importance_list = ["1","2","3","4","5"]
|
||||||
|
res_list = []
|
||||||
|
for importance in importance_list:
|
||||||
|
|
||||||
|
querystring = {"token": benzinga_api_key,"parameters[importance]":importance, "parameters[date_from]":yesterday,"parameters[date_to]":today,"parameters[date_sort]":"date"}
|
||||||
try:
|
try:
|
||||||
async with session.get(url, params=querystring, headers=headers) as response:
|
async with session.get(url, params=querystring, headers=headers) as response:
|
||||||
res = ujson.loads(await response.text())['earnings']
|
res = ujson.loads(await response.text())['earnings']
|
||||||
@ -217,6 +222,7 @@ async def get_recent_earnings(session):
|
|||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
res_list = remove_duplicates(res_list)
|
res_list = remove_duplicates(res_list)
|
||||||
#res_list.sort(key=lambda x: x['marketCap'], reverse=True)
|
#res_list.sort(key=lambda x: x['marketCap'], reverse=True)
|
||||||
res_list.sort(key=lambda x: (-parse_time(x['time']).timestamp(), -x['marketCap']))
|
res_list.sort(key=lambda x: (-parse_time(x['time']).timestamp(), -x['marketCap']))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user