@@ -182,6 +182,7 @@ def __init__(self, config: Config, exchange_name: str, account_name: str):
182182 self .exchange = Exchange (self .exchange_name , api_key , secret_key , passphrase )
183183
184184 def run_strategy (self , symbol , strategy_name , config , account_name , symbols_to_trade = None , rotator_symbols_standardized = None ):
185+ logging .info (f"Received rotator symbols in run_strategy for { symbol } : { rotator_symbols_standardized } " )
185186 symbols_allowed = None
186187 for exch in config .exchanges :
187188 #print(f"Checking: {exch.name} vs {self.exchange_name} and {exch.account_name} vs {account_name}")
@@ -352,7 +353,10 @@ def run_bot(symbol, args, manager, account_name, symbols_allowed, rotator_symbol
352353 except Exception as e :
353354 logging .info (f"Exception caught { e } " )
354355
355- market_maker .run_strategy (symbol , args .strategy , config , account_name , symbols_to_trade = symbols_allowed , rotator_symbols_standardized = rotator_symbols_standardized )
356+ logging .info (f"Rotator symbols in run_bot { rotator_symbols_standardized } " )
357+ logging .info (f"Latest rotator symbols in run bot { latest_rotator_symbols } " )
358+
359+ market_maker .run_strategy (symbol , args .strategy , config , account_name , symbols_to_trade = symbols_allowed , rotator_symbols_standardized = latest_rotator_symbols )
356360
357361 quote = "USDT"
358362 current_time = time .time ()
@@ -393,12 +397,17 @@ def bybit_auto_rotation(args, manager, symbols_allowed):
393397 }
394398 logging .info (f"Open position symbols: { open_position_symbols } " )
395399
400+ # Fetch the updated symbols if latest_rotator_symbols is empty
401+ if not latest_rotator_symbols :
402+ latest_rotator_symbols = fetch_updated_symbols (args , manager )
403+
396404 # Periodically fetch and update latest rotation symbols
397405 if current_time - last_rotator_update_time >= 60 :
398406 latest_rotator_symbols = fetch_updated_symbols (args , manager )
399407 last_rotator_update_time = current_time
400- logging .info (f"Latest rotator symbols: { latest_rotator_symbols } " )
401408
409+ logging .info (f"Latest rotator symbols: { latest_rotator_symbols } " )
410+
402411 with thread_management_lock :
403412 # Update active symbols based on thread status
404413 update_active_symbols ()
@@ -425,6 +434,7 @@ def bybit_auto_rotation(args, manager, symbols_allowed):
425434 except Exception as e :
426435 logging .error (f"Exception caught in bybit_auto_rotation: { str (e )} " )
427436
437+
428438def update_active_symbols ():
429439 global active_symbols
430440 active_symbols = {symbol for symbol in active_symbols if symbol in threads and threads [symbol ][0 ].is_alive ()}
@@ -441,7 +451,7 @@ def update_active_threads(open_position_symbols, args, manager, symbols_allowed)
441451
442452
443453def manage_rotator_symbols (rotator_symbols , args , manager , symbols_allowed ):
444- global active_symbols
454+ global active_symbols , latest_rotator_symbols
445455 needed_slots = symbols_allowed - len (active_symbols )
446456
447457 logging .info (f"Starting symbol management. Total slots allowed: { symbols_allowed } . Current active symbols: { len (active_symbols )} " )
0 commit comments