update cron job

This commit is contained in:
MuslemRahimi 2024-08-01 12:13:08 +02:00
parent 766699bb3c
commit eb023e4d91
3 changed files with 8 additions and 6 deletions

View File

@ -11,9 +11,9 @@ import os
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)
def save_json(data):

View File

@ -84,7 +84,7 @@ async def run():
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)]
most_retail_volume = []
@ -124,7 +124,9 @@ async def run():
#Add stocks for most retail volume
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:
print(e)

View File

@ -1997,14 +1997,14 @@ async def get_earnings_call_transcripts(data:TranscriptData, api_key: str = Secu
quarter = data['quarter']
cache_key = f"earnings-call-transcripts-{ticker}-{year}-{quarter}"
cached_result = redis_client.get(cache_key)
print(data)
if cached_result:
return orjson.loads(cached_result)
try:
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}"
print(url)
async with session.get(url) as response:
data = (await response.json())[0]