Skip to content

Commit bd39424

Browse files
committed
Fix 'NoneType' in allocate_asset()
The error occured when bootstrap was turned off but there is no opposite orders. Add check for such situation. Bootstrap should not be turned off if there is no opposite orders.
1 parent 9f5a872 commit bd39424

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dexbot/strategies/staggered_orders.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ def allocate_asset(self, asset, asset_balance):
481481

482482
if (self.bootstrapping and
483483
self.base_balance_history[2] == self.base_balance_history[0] and
484-
self.quote_balance_history[2] == self.quote_balance_history[0]):
484+
self.quote_balance_history[2] == self.quote_balance_history[0] and
485+
opposite_orders):
485486
# Turn off bootstrap mode whether we're didn't allocated assets during previous 3 maintenance
486487
self.log.debug('Turning bootstrapping off: actual_spread > target_spread, we have free '
487488
'balances and cannot allocate them normally 3 times in a row')

0 commit comments

Comments
 (0)