updated requested changes in PR #6545
This commit is contained in:
parent
6eb2e51bfc
commit
14c8c6ad87
@ -482,14 +482,11 @@ class FreqtradeBot(LoggingMixin):
|
||||
|
||||
if stake_amount is not None and stake_amount < 0.0:
|
||||
# We should decrease our position
|
||||
# Strategy should return value as Decimal.
|
||||
# Strategy should return value as Decimal for accuracy.
|
||||
amount = abs(float(Decimal(stake_amount) / Decimal(current_exit_rate)))
|
||||
if trade.amount - amount < min_stake_amount:
|
||||
logger.info('Remaining amount would be too small')
|
||||
return
|
||||
if amount > trade.amount:
|
||||
logger.info(f"Amount is higher than available. {amount} > {trade.amount}")
|
||||
return
|
||||
self.execute_trade_exit(trade, current_exit_rate, sell_reason=SellCheckTuple(
|
||||
sell_type=SellType.CUSTOM_SELL), sub_trade_amt=amount)
|
||||
|
||||
|
@ -514,8 +514,7 @@ class LocalTrade():
|
||||
raise ValueError(f'Unknown order type: {order.order_type}')
|
||||
Trade.commit()
|
||||
|
||||
def process_sell_sub_trade(self, order: Order, is_closed: bool = True,
|
||||
is_non_bt: bool = True) -> None:
|
||||
def process_sell_sub_trade(self, order: Order, is_closed: bool = True) -> None:
|
||||
sell_amount = order.safe_amount_after_fee
|
||||
sell_rate = order.safe_price
|
||||
sell_stake_amount = sell_rate * sell_amount * (1 - self.fee_close)
|
||||
@ -707,7 +706,7 @@ class LocalTrade():
|
||||
:param is_open: Only search for open orders?
|
||||
:return: latest Order object if it exists, else None
|
||||
"""
|
||||
orders = [o for o in self.orders if o.filled or o.ft_is_open]
|
||||
orders = self.orders
|
||||
if order_side:
|
||||
orders = [o for o in orders if o.ft_order_side == order_side]
|
||||
if is_open is not None:
|
||||
|
Loading…
Reference in New Issue
Block a user