update cron job for congress
This commit is contained in:
parent
5e91bd45a0
commit
93325bca50
@ -352,7 +352,7 @@ async def run():
|
|||||||
crypto_con.close()
|
crypto_con.close()
|
||||||
|
|
||||||
total_symbols = crypto_symbols +etf_symbols + stock_symbols
|
total_symbols = crypto_symbols +etf_symbols + stock_symbols
|
||||||
chunk_size = 500
|
chunk_size = 100
|
||||||
politician_list = []
|
politician_list = []
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -367,8 +367,8 @@ async def run():
|
|||||||
symbols_chunk = total_symbols[i:i + chunk_size]
|
symbols_chunk = total_symbols[i:i + chunk_size]
|
||||||
data = await get_congress_data(symbols_chunk,session)
|
data = await get_congress_data(symbols_chunk,session)
|
||||||
politician_list +=data
|
politician_list +=data
|
||||||
print('sleeping for 60 sec')
|
print('sleeping for 30 sec')
|
||||||
await asyncio.sleep(60) # Wait for 60 seconds between chunks
|
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)
|
create_politician_db(politician_list, stock_symbols, stock_raw_data, etf_symbols, etf_raw_data, crypto_symbols, crypto_raw_data)
|
||||||
|
|||||||
@ -1555,7 +1555,7 @@ async def get_fair_price(data: TickerData, api_key: str = Security(get_api_key))
|
|||||||
res = []
|
res = []
|
||||||
|
|
||||||
redis_client.set(cache_key, orjson.dumps(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
|
return res
|
||||||
|
|
||||||
@ -1993,7 +1993,7 @@ async def get_congress_rss_feed(api_key: str = Security(get_api_key)):
|
|||||||
res = []
|
res = []
|
||||||
|
|
||||||
redis_client.set(cache_key, orjson.dumps(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
|
return res
|
||||||
|
|
||||||
@app.get("/analysts-price-targets-rss-feed")
|
@app.get("/analysts-price-targets-rss-feed")
|
||||||
|
|||||||
@ -69,6 +69,7 @@ def run_congress_trading():
|
|||||||
week = datetime.today().weekday()
|
week = datetime.today().weekday()
|
||||||
if week <= 5:
|
if week <= 5:
|
||||||
run_command(["python3", "cron_congress_trading.py"])
|
run_command(["python3", "cron_congress_trading.py"])
|
||||||
|
run_command(["python3", "restart_json.py"])
|
||||||
|
|
||||||
def run_dividend_list():
|
def run_dividend_list():
|
||||||
week = datetime.today().weekday()
|
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: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_dividends).tag('dividends_job')
|
||||||
schedule.every().day.at("08:30").do(run_threaded, run_fomc_impact).tag('fomc_impact_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: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("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')
|
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(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(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')
|
schedule.every(30).minutes.do(run_threaded, run_cron_industry).tag('industry_job')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user