diff --git a/core/lib/market.py b/core/lib/market.py index bafc4a2..658e17d 100644 --- a/core/lib/market.py +++ b/core/lib/market.py @@ -253,14 +253,15 @@ def get_price_bound(direction, strategy, price, current_price): current_price_slippage = D(current_price) * D(price_slippage_as_ratio) log.debug(f"Maximum deviation from current price: {current_price_slippage}") - # Subtract slippage for buys, since we lose money if the price goes down + # Price bound is the worst price we are willing to pay for the trade + # For buys, a higher price is worse if direction == "buy": - price_bound = D(current_price) - D(price_slippage) - - # Add slippage for sells, since we lose money if the price goes up - elif direction == "sell": price_bound = D(current_price) + D(price_slippage) + # For sells, a lower price is worse + elif direction == "sell": + price_bound = D(current_price) - D(price_slippage) + log.debug(f"Price bound: {price_bound}") return price_bound