update cron job

This commit is contained in:
MuslemRahimi 2024-12-29 21:55:00 +01:00
parent 6e94223d3b
commit bc61f863da
3 changed files with 5 additions and 4 deletions

View File

@ -93,7 +93,7 @@ def run():
cursor = con.cursor() cursor = con.cursor()
cursor.execute("PRAGMA journal_mode = wal") cursor.execute("PRAGMA journal_mode = wal")
cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE marketCap >= 1E9 AND symbol NOT LIKE '%.%'") cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE symbol NOT LIKE '%.%'")
stocks_symbols = [row[0] for row in cursor.fetchall()] stocks_symbols = [row[0] for row in cursor.fetchall()]
etf_cursor = etf_con.cursor() etf_cursor = etf_con.cursor()
@ -105,6 +105,7 @@ def run():
etf_con.close() etf_con.close()
total_symbols = stocks_symbols+ etf_symbols total_symbols = stocks_symbols+ etf_symbols
total_symbols = ['CCLD']
data = [] data = []
weekdays = get_last_7_weekdays() weekdays = get_last_7_weekdays()
for date in weekdays: for date in weekdays:
@ -114,10 +115,9 @@ def run():
data +=raw_data data +=raw_data
except: except:
pass pass
for symbol in tqdm(total_symbols): for symbol in tqdm(total_symbols):
try: try:
res_list = [item for item in data if isinstance(item, dict) and item.get('ticker', None) == symbol] res_list = [item for item in data if isinstance(item, dict) and item['ticker'] == symbol]
dark_pool_levels = analyze_dark_pool_levels( dark_pool_levels = analyze_dark_pool_levels(
trades=res_list, trades=res_list,
size_threshold=0.8, # Look for levels with volume in top 20% size_threshold=0.8, # Look for levels with volume in top 20%

View File

@ -80,7 +80,7 @@ async def run():
cursor = con.cursor() cursor = con.cursor()
cursor.execute("PRAGMA journal_mode = wal") cursor.execute("PRAGMA journal_mode = wal")
cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE marketCap >= 1E9 AND symbol NOT LIKE '%.%'") cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE symbol NOT LIKE '%.%'")
stocks_symbols = [row[0] for row in cursor.fetchall()] stocks_symbols = [row[0] for row in cursor.fetchall()]
etf_cursor = etf_con.cursor() etf_cursor = etf_con.cursor()

View File

@ -3406,6 +3406,7 @@ async def get_dark_pool(data:TickerData, api_key: str = Security(get_api_key)):
except: except:
res = [] res = []
print(res)
data = orjson.dumps(res) data = orjson.dumps(res)
compressed_data = gzip.compress(data) compressed_data = gzip.compress(data)
redis_client.set(cache_key, compressed_data) redis_client.set(cache_key, compressed_data)