Skip to content

Commit

Permalink
Random
Browse files Browse the repository at this point in the history
  • Loading branch information
donewiththedollar committed Apr 17, 2024
1 parent db94bf5 commit 9c93596
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions directionalscalper/core/strategies/bybit/bybit_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def __init__(self, exchange, config, manager, symbols_allowed=None):
self.filled_order_levels = {}
self.filled_levels = {}
self.active_grids = set()
self.position_inactive_threshold = 120
self.no_entry_signal_threshold = 120
self.order_inactive_threshold = 120
self.position_inactive_threshold = 300
self.no_entry_signal_threshold = 300
self.order_inactive_threshold = 300
pass

TAKER_FEE_RATE = 0.00055
Expand Down
9 changes: 7 additions & 2 deletions multi_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,12 @@ def update_active_threads(open_position_symbols, args, manager, symbols_allowed)
def manage_rotator_symbols(rotator_symbols, args, manager, symbols_allowed):
global active_symbols
needed_slots = symbols_allowed - len(active_symbols)
for symbol in rotator_symbols:

# Convert set to list and shuffle for random selection
random_rotator_symbols = list(rotator_symbols)
random.shuffle(random_rotator_symbols)

for symbol in random_rotator_symbols:
if needed_slots <= 0:
break
if symbol not in active_symbols and (symbol not in threads or not threads[symbol][0].is_alive()):
Expand All @@ -422,7 +427,7 @@ def manage_rotator_symbols(rotator_symbols, args, manager, symbols_allowed):
needed_slots -= 1
logging.info(f"Added new thread for rotator symbol: {symbol}")
manage_excess_threads(symbols_allowed)

def manage_excess_threads(symbols_allowed):
global active_symbols
while len(active_symbols) > symbols_allowed:
Expand Down

0 comments on commit 9c93596

Please sign in to comment.