update cron job
This commit is contained in:
parent
766699bb3c
commit
eb023e4d91
@ -11,9 +11,9 @@ import os
|
|||||||
|
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
api_key = os.getenv('INTRINIO_API_KEY')
|
API_KEY = os.getenv('INTRINIO_API_KEY')
|
||||||
|
|
||||||
intrinio.ApiClient().set_api_key(api_key)
|
intrinio.ApiClient().set_api_key(API_KEY)
|
||||||
intrinio.ApiClient().allow_retries(True)
|
intrinio.ApiClient().allow_retries(True)
|
||||||
|
|
||||||
def save_json(data):
|
def save_json(data):
|
||||||
|
|||||||
@ -84,7 +84,7 @@ async def run():
|
|||||||
|
|
||||||
total_symbols = stocks_symbols+etf_symbols
|
total_symbols = stocks_symbols+etf_symbols
|
||||||
|
|
||||||
chunk_size = len(total_symbols) // 70 # Divide the list into N chunks
|
chunk_size = len(total_symbols) // 700 # Divide the list into N chunks
|
||||||
chunks = [total_symbols[i:i + chunk_size] for i in range(0, len(total_symbols), chunk_size)]
|
chunks = [total_symbols[i:i + chunk_size] for i in range(0, len(total_symbols), chunk_size)]
|
||||||
|
|
||||||
most_retail_volume = []
|
most_retail_volume = []
|
||||||
@ -124,7 +124,9 @@ async def run():
|
|||||||
|
|
||||||
#Add stocks for most retail volume
|
#Add stocks for most retail volume
|
||||||
if symbol in stocks_symbols:
|
if symbol in stocks_symbols:
|
||||||
most_retail_volume.append({'symbol': res[-1]['symbol'], 'name': name, 'traded': res[-1]['traded'], 'sentiment': res[-1]['sentiment'], 'retailStrength': retailer_strength})
|
most_retail_volume.append({'symbol': res[-1]['symbol'], 'name': name, 'assetType': 'stocks','traded': res[-1]['traded'], 'sentiment': res[-1]['sentiment'], 'retailStrength': retailer_strength})
|
||||||
|
elif symbol in etf_symbols:
|
||||||
|
most_retail_volume.append({'symbol': res[-1]['symbol'], 'name': name, 'assetType': 'etf', 'traded': res[-1]['traded'], 'sentiment': res[-1]['sentiment'], 'retailStrength': retailer_strength})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
|||||||
@ -1997,14 +1997,14 @@ async def get_earnings_call_transcripts(data:TranscriptData, api_key: str = Secu
|
|||||||
quarter = data['quarter']
|
quarter = data['quarter']
|
||||||
cache_key = f"earnings-call-transcripts-{ticker}-{year}-{quarter}"
|
cache_key = f"earnings-call-transcripts-{ticker}-{year}-{quarter}"
|
||||||
cached_result = redis_client.get(cache_key)
|
cached_result = redis_client.get(cache_key)
|
||||||
print(data)
|
|
||||||
if cached_result:
|
if cached_result:
|
||||||
return orjson.loads(cached_result)
|
return orjson.loads(cached_result)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
url = f"https://financialmodelingprep.com/api/v3/earning_call_transcript/{ticker}?year={year}&quarter={quarter}&apikey={FMP_API_KEY}"
|
url = f"https://financialmodelingprep.com/api/v3/earning_call_transcript/{ticker}?year={year}&quarter={quarter}&apikey={FMP_API_KEY}"
|
||||||
print(url)
|
|
||||||
async with session.get(url) as response:
|
async with session.get(url) as response:
|
||||||
data = (await response.json())[0]
|
data = (await response.json())[0]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user