Skip to content

Commit

Permalink
Fix conditional expressions logic
Browse files Browse the repository at this point in the history
Closes: #567
  • Loading branch information
bitphage committed Apr 22, 2019
1 parent dc1b79d commit 795e32e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dexbot/strategies/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,14 +1156,14 @@ def calc_profit(self):
old_center_price = old_data.center_price
center_price = self.get_market_center_price()

if not (old_center_price or center_price):
if not old_center_price or not center_price:
return profit

# Calculate max theoretical balances based on starting price
old_max_quantity_base = earlier_base + earlier_quote * old_center_price
old_max_quantity_quote = earlier_quote + earlier_base / old_center_price

if not (old_max_quantity_base or old_max_quantity_quote):
if not old_max_quantity_base or not old_max_quantity_quote:
return profit

# Current balances
Expand Down
4 changes: 2 additions & 2 deletions dexbot/strategies/staggered_orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ def maintain_strategy(self, *args, **kwargs):
self.store_profit_estimation_data()

# Calculate minimal orders amounts based on asset precision
if not (self.order_min_base or self.order_min_quote):
if not self.order_min_base or not self.order_min_quote:
self.calculate_min_amounts()

# Calculate asset thresholds once
if not (self.quote_asset_threshold or self.base_asset_threshold):
if not self.quote_asset_threshold or not self.base_asset_threshold:
self.calculate_asset_thresholds()

# Remove orders that exceed boundaries
Expand Down

0 comments on commit 795e32e

Please sign in to comment.