From 15d725b8653b74e897d3ad74f084f25864d1d047 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 6 Jan 2025 14:09:19 +0100 Subject: [PATCH] update list --- app/cron_dashboard.py | 49 +++++++++++++------------------------------ app/cron_list.py | 22 +++++++++++++------ 2 files changed, 31 insertions(+), 40 deletions(-) diff --git a/app/cron_dashboard.py b/app/cron_dashboard.py index b8e6613..6067408 100644 --- a/app/cron_dashboard.py +++ b/app/cron_dashboard.py @@ -16,11 +16,7 @@ def check_market_hours(): - holidays = [ - "2024-01-01", "2024-01-15", "2024-02-19", "2024-03-29", - "2024-05-27", "2024-06-19", "2024-07-04", "2024-09-02", - "2024-11-28", "2024-12-25" - ] + holidays = ['2025-01-01', '2025-01-09','2025-01-20', '2025-02-17', '2025-04-18', '2025-05-26', '2025-06-19', '2025-07-04', '2025-09-01', '2025-11-27', '2025-12-25'] # Get the current date and time in ET (Eastern Time) et_timezone = pytz.timezone('America/New_York') @@ -402,38 +398,23 @@ async def run(): try: - with open("json/options-flow/feed/data.json", 'r') as file: - options_flow = ujson.load(file) - - # Filter the options_flow to include only items with ticker in total_symbol - options_flow = [item for item in options_flow if item['ticker'] in stock_symbols] - - highest_volume = sorted(options_flow, key=lambda x: int(x['volume']), reverse=True) - highest_volume = [ - {key: item[key] for key in ['cost_basis', 'ticker', 'underlying_type', 'date_expiration', 'put_call', 'volume', 'strike_price']} - for item in highest_volume[0:4] - ] - - highest_premium = sorted(options_flow, key=lambda x: int(x['cost_basis']), reverse=True) - highest_premium = [ - {key: item[key] for key in ['cost_basis', 'ticker', 'underlying_type', 'date_expiration', 'put_call', 'volume', 'strike_price']} - for item in highest_premium[0:4] - ] - - highest_open_interest = sorted(options_flow, key=lambda x: int(x['open_interest']), reverse=True) - highest_open_interest = [ - {key: item[key] for key in ['cost_basis', 'ticker', 'underlying_type', 'date_expiration', 'put_call', 'open_interest', 'strike_price']} - for item in highest_open_interest[0:4] - ] - - options_flow = { + with open("json/stocks-list/list/highest-open-interest-change.json", 'r') as file: + highest_open_interest_change = ujson.load(file)[:3] + + with open("json/stocks-list/list/highest-option-iv-rank.json", 'r') as file: + highest_iv_rank = ujson.load(file)[:3] + + with open("json/stocks-list/list/highest-option-premium.json", 'r') as file: + highest_premium = ujson.load(file)[:3] + optionsData = { 'premium': highest_premium, - 'volume': highest_volume, - 'openInterest': highest_open_interest + 'ivRank': highest_iv_rank, + 'openInterest': highest_open_interest_change } + print(optionsData) except Exception as e: print(e) - options_flow = {} + optionsData = {} market_status = check_market_hours() if market_status == 0: @@ -492,7 +473,7 @@ async def run(): data = { 'marketMovers': market_movers, 'marketStatus': market_status, - 'optionsFlow': options_flow, + 'optionsData': optionsData, 'recentEarnings': recent_earnings, 'upcomingEarnings': upcoming_earnings, 'analystReport': recent_analyst_report, diff --git a/app/cron_list.py b/app/cron_list.py index 3b07690..b5bc0dd 100644 --- a/app/cron_list.py +++ b/app/cron_list.py @@ -692,8 +692,11 @@ async def get_highest_oi_change(): for symbol in symbols: try: # Load quote data from JSON file - change_oi = stock_screener_data_dict[symbol].get('changeOI',0) + iv_rank = stock_screener_data_dict[symbol].get('ivRank',0) + total_prem = stock_screener_data_dict[symbol].get('totalPrem',0) total_oi = stock_screener_data_dict[symbol].get('totalOI',0) + change_oi = stock_screener_data_dict[symbol].get('changeOI',0) + if change_oi > 0 and total_oi > 0: quote_data = await get_quote_data(symbol) # Assign price and volume, and check if they meet the penny stock criteria @@ -710,9 +713,10 @@ async def get_highest_oi_change(): 'name': name, 'price': price, 'changesPercentage': changesPercentage, - 'changeOI': change_oi, + 'ivRank': iv_rank, + 'totalPrem': total_prem, 'totalOI': total_oi, - 'marketCap': market_cap, + 'changeOI': change_oi, }) except: pass @@ -749,8 +753,10 @@ async def get_highest_option_iv_rank(): for symbol in symbols: try: # Load quote data from JSON file - total_oi = stock_screener_data_dict[symbol].get('totalOI',0) iv_rank = stock_screener_data_dict[symbol].get('ivRank',0) + total_prem = stock_screener_data_dict[symbol].get('totalPrem',0) + total_oi = stock_screener_data_dict[symbol].get('totalOI',0) + change_oi = stock_screener_data_dict[symbol].get('changeOI',0) if total_oi > 1E6 and iv_rank > 0: quote_data = await get_quote_data(symbol) @@ -769,8 +775,9 @@ async def get_highest_option_iv_rank(): 'price': price, 'changesPercentage': changesPercentage, 'ivRank': iv_rank, + 'totalPrem': total_prem, 'totalOI': total_oi, - 'marketCap': market_cap, + 'changeOI': change_oi, }) except: pass @@ -800,6 +807,8 @@ async def get_highest_option_premium(): # Load quote data from JSON file iv_rank = stock_screener_data_dict[symbol].get('ivRank',0) total_prem = stock_screener_data_dict[symbol].get('totalPrem',0) + total_oi = stock_screener_data_dict[symbol].get('totalOI',0) + change_oi = stock_screener_data_dict[symbol].get('changeOI',0) if total_prem > 0 and iv_rank > 0: quote_data = await get_quote_data(symbol) @@ -819,7 +828,8 @@ async def get_highest_option_premium(): 'changesPercentage': changesPercentage, 'ivRank': iv_rank, 'totalPrem': total_prem, - 'marketCap': market_cap, + 'totalOI': total_oi, + 'changeOI': change_oi, }) except: pass