update options flow
This commit is contained in:
parent
e05df545d8
commit
4e0bb15c83
@ -35,7 +35,7 @@ def process_page(page):
|
|||||||
try:
|
try:
|
||||||
data = fin.options_activity(date_from=start_date, date_to=end_date, page=page, pagesize=1000)
|
data = fin.options_activity(date_from=start_date, date_to=end_date, page=page, pagesize=1000)
|
||||||
data = ujson.loads(fin.output(data))['option_activity']
|
data = ujson.loads(fin.output(data))['option_activity']
|
||||||
filtered_data = [{key: value for key, value in item.items() if key in ['ticker','time', 'id','sentiment','underlying_price', 'cost_basis', 'underlying_price','option_activity_type','date', 'date_expiration', 'open_interest','price', 'put_call','strike_price', 'volume']} for item in data]
|
filtered_data = [{key: value for key, value in item.items() if key not in ['description_extended','updated']} for item in data]
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
page_list = []
|
page_list = []
|
||||||
for item in filtered_data:
|
for item in filtered_data:
|
||||||
@ -59,6 +59,8 @@ def process_page(page):
|
|||||||
item['underlying_price'] = round(float(item['underlying_price']), 2)
|
item['underlying_price'] = round(float(item['underlying_price']), 2)
|
||||||
item['type'] = item['option_activity_type'].capitalize()
|
item['type'] = item['option_activity_type'].capitalize()
|
||||||
item['sentiment'] = item['sentiment'].capitalize()
|
item['sentiment'] = item['sentiment'].capitalize()
|
||||||
|
item['executionEstimate'] = item['execution_estimate'].replace('_', ' ').title()
|
||||||
|
item['tradeCount'] = item['trade_count']
|
||||||
|
|
||||||
page_list.append(item)
|
page_list.append(item)
|
||||||
|
|
||||||
|
|||||||
@ -1974,6 +1974,7 @@ async def get_earnings_call_transcripts(data:TranscriptData):
|
|||||||
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)
|
||||||
|
|
||||||
if cached_result:
|
if cached_result:
|
||||||
return ujson.loads(cached_result)
|
return ujson.loads(cached_result)
|
||||||
|
|
||||||
@ -1987,7 +1988,6 @@ async def get_earnings_call_transcripts(data:TranscriptData):
|
|||||||
content = remove_text_before_operator(data['content'])
|
content = remove_text_before_operator(data['content'])
|
||||||
chat = extract_names_and_descriptions(content)
|
chat = extract_names_and_descriptions(content)
|
||||||
res = {'date': data['date'], 'chat': chat}
|
res = {'date': data['date'], 'chat': chat}
|
||||||
|
|
||||||
except:
|
except:
|
||||||
res = {}
|
res = {}
|
||||||
|
|
||||||
|
|||||||
BIN
app/ml_models/__pycache__/fundamental_predictor.cpython-310.pyc
Executable file → Normal file
BIN
app/ml_models/__pycache__/fundamental_predictor.cpython-310.pyc
Executable file → Normal file
Binary file not shown.
BIN
app/ml_models/__pycache__/prophet_model.cpython-310.pyc
Executable file → Normal file
BIN
app/ml_models/__pycache__/prophet_model.cpython-310.pyc
Executable file → Normal file
Binary file not shown.
@ -299,4 +299,4 @@ async def main():
|
|||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
# Run the main function
|
# Run the main function
|
||||||
asyncio.run(main())
|
#asyncio.run(main())
|
||||||
Loading…
x
Reference in New Issue
Block a user