bugfixing remove old quotes

This commit is contained in:
MuslemRahimi 2024-09-17 00:17:06 +02:00
parent 652533d73f
commit 4388739a17

View File

@ -102,6 +102,7 @@ async def run():
chunk_size = len(total_symbols) // 10 # Divide the list into 10 chunks chunk_size = len(total_symbols) // 10 # Divide the list into 10 chunks
chunks = [total_symbols[i:i + chunk_size] for i in range(0, len(total_symbols), chunk_size)] chunks = [total_symbols[i:i + chunk_size] for i in range(0, len(total_symbols), chunk_size)]
delete_files_in_directory("json/pre-post-quote")
for chunk in chunks: for chunk in chunks:
if is_market_closed == False: if is_market_closed == False:
latest_quote = await get_quote_of_stocks(chunk) latest_quote = await get_quote_of_stocks(chunk)
@ -111,7 +112,6 @@ async def run():
#print(f"Saved data for {symbol}.") #print(f"Saved data for {symbol}.")
if is_market_closed == True: if is_market_closed == True:
delete_files_in_directory("json/pre-post-quote")
latest_quote = await get_pre_post_quote_of_stocks(chunk) latest_quote = await get_pre_post_quote_of_stocks(chunk)
for item in latest_quote: for item in latest_quote:
symbol = item['symbol'] symbol = item['symbol']