From 14c8c6ad873264c8e365e36a122af5b6e7f57b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Thu, 24 Mar 2022 13:10:08 +0530 Subject: [PATCH] updated requested changes in PR #6545 --- freqtrade/freqtradebot.py | 5 +---- freqtrade/persistence/models.py | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index f4a61bacf..ebfeab95b 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -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) diff --git a/freqtrade/persistence/models.py b/freqtrade/persistence/models.py index 1f1a856ba..ba7222a4c 100644 --- a/freqtrade/persistence/models.py +++ b/freqtrade/persistence/models.py @@ -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: