From 536f54cfc6ff8d5576921fc5f2d982956b2aa845 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 13 Feb 2022 16:28:49 +0100 Subject: [PATCH] is_short for forceentries --- freqtrade/rpc/rpc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 1c73160a4..3bb7e7a6d 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -769,8 +769,10 @@ class RPC: # check if valid pair # check if pair already has an open pair - trade = Trade.get_trades([Trade.is_open.is_(True), Trade.pair == pair]).first() + trade: Trade = Trade.get_trades([Trade.is_open.is_(True), Trade.pair == pair]).first() + is_short = (order_side == SignalDirection.SHORT) if trade: + is_short = trade.is_short if not self._freqtrade.strategy.position_adjustment_enable: raise RPCException(f'position for {pair} already open - id: {trade.id}') @@ -784,7 +786,7 @@ class RPC: 'forcebuy', self._freqtrade.strategy.order_types['buy']) if self._freqtrade.execute_entry(pair, stake_amount, price, ordertype=order_type, trade=trade, - is_short=(order_side == SignalDirection.SHORT), + is_short=is_short, enter_tag=enter_tag, ): Trade.commit()