diff --git a/app/cron_congress_trading.py b/app/cron_congress_trading.py index 8c40503..1d12da1 100755 --- a/app/cron_congress_trading.py +++ b/app/cron_congress_trading.py @@ -352,7 +352,7 @@ async def run(): crypto_con.close() total_symbols = crypto_symbols +etf_symbols + stock_symbols - chunk_size = 500 + chunk_size = 100 politician_list = [] except Exception as e: @@ -367,8 +367,8 @@ async def run(): symbols_chunk = total_symbols[i:i + chunk_size] data = await get_congress_data(symbols_chunk,session) politician_list +=data - print('sleeping for 60 sec') - await asyncio.sleep(60) # Wait for 60 seconds between chunks + print('sleeping for 30 sec') + await asyncio.sleep(30) # Wait for 60 seconds between chunks create_politician_db(politician_list, stock_symbols, stock_raw_data, etf_symbols, etf_raw_data, crypto_symbols, crypto_raw_data) diff --git a/app/main.py b/app/main.py index 9e202d9..d893d2f 100755 --- a/app/main.py +++ b/app/main.py @@ -1555,7 +1555,7 @@ async def get_fair_price(data: TickerData, api_key: str = Security(get_api_key)) res = [] redis_client.set(cache_key, orjson.dumps(res)) - redis_client.expire(cache_key, 3600 * 24) # Set cache expiration time to Infinity + redis_client.expire(cache_key, 15*60) # Set cache expiration time to Infinity return res @@ -1993,7 +1993,7 @@ async def get_congress_rss_feed(api_key: str = Security(get_api_key)): res = [] redis_client.set(cache_key, orjson.dumps(res)) - redis_client.expire(cache_key, 60*60) # Set cache expiration time to 1 day + redis_client.expire(cache_key, 60*15) return res @app.get("/analysts-price-targets-rss-feed") diff --git a/app/primary_cron_job.py b/app/primary_cron_job.py index a5048a1..9dacaa4 100755 --- a/app/primary_cron_job.py +++ b/app/primary_cron_job.py @@ -69,6 +69,7 @@ def run_congress_trading(): week = datetime.today().weekday() if week <= 5: run_command(["python3", "cron_congress_trading.py"]) + run_command(["python3", "restart_json.py"]) def run_dividend_list(): week = datetime.today().weekday() @@ -338,7 +339,6 @@ schedule.every().day.at("08:00").do(run_threaded, run_economy_indicator).tag('ec schedule.every().day.at("08:00").do(run_threaded, run_cron_insider_trading).tag('insider_trading_job') schedule.every().day.at("08:30").do(run_threaded, run_dividends).tag('dividends_job') schedule.every().day.at("08:30").do(run_threaded, run_fomc_impact).tag('fomc_impact_job') -schedule.every().day.at("09:00").do(run_threaded, run_congress_trading).tag('congress_job') schedule.every().day.at("10:00").do(run_threaded, run_shareholders).tag('shareholders_job') schedule.every().day.at("10:30").do(run_threaded, run_sec_filings).tag('sec_filings_job') schedule.every().day.at("11:00").do(run_threaded, run_executive).tag('executive_job') @@ -362,6 +362,7 @@ schedule.every().saturday.at("10:00").do(run_threaded, run_price_analysis).tag(' schedule.every(30).minutes.do(run_threaded, run_dividend_list).tag('dividend_list_job') +schedule.every(60).minutes.do(run_threaded, run_congress_trading).tag('congress_job') schedule.every(15).minutes.do(run_threaded, run_cron_market_news).tag('market_news_job') schedule.every(30).minutes.do(run_threaded, run_cron_industry).tag('industry_job')