|
|
|
@ -253,13 +253,14 @@ 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)
|
|
|
|
|
price_bound = D(current_price) + D(price_slippage)
|
|
|
|
|
|
|
|
|
|
# Add slippage for sells, since we lose money if the price goes up
|
|
|
|
|
# For sells, a lower price is worse
|
|
|
|
|
elif direction == "sell":
|
|
|
|
|
price_bound = D(current_price) + D(price_slippage)
|
|
|
|
|
price_bound = D(current_price) - D(price_slippage)
|
|
|
|
|
|
|
|
|
|
log.debug(f"Price bound: {price_bound}")
|
|
|
|
|
return price_bound
|
|
|
|
|