mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
removed side from execute_trade_exit
This commit is contained in:
parent
9046caa27c
commit
928c4edace
|
@ -869,7 +869,7 @@ class FreqtradeBot(LoggingMixin):
|
|||
logger.error(f'Unable to place a stoploss order on exchange. {e}')
|
||||
logger.warning('Exiting the trade forcefully')
|
||||
self.execute_trade_exit(trade, trade.stop_loss, sell_reason=SellCheckTuple(
|
||||
sell_type=SellType.EMERGENCY_SELL), side=trade.exit_side)
|
||||
sell_type=SellType.EMERGENCY_SELL))
|
||||
|
||||
except ExchangeError:
|
||||
trade.stoploss_order_id = None
|
||||
|
@ -996,7 +996,7 @@ class FreqtradeBot(LoggingMixin):
|
|||
|
||||
if should_exit.sell_flag:
|
||||
logger.info(f'Exit for {trade.pair} detected. Reason: {should_exit.sell_type}')
|
||||
self.execute_trade_exit(trade, exit_rate, should_exit, side=trade.exit_side)
|
||||
self.execute_trade_exit(trade, exit_rate, should_exit)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -1227,7 +1227,6 @@ class FreqtradeBot(LoggingMixin):
|
|||
trade: Trade,
|
||||
limit: float,
|
||||
sell_reason: SellCheckTuple, # TODO-lev update to exit_reason
|
||||
side: str
|
||||
) -> bool:
|
||||
"""
|
||||
Executes a trade exit for the given trade and limit
|
||||
|
|
|
@ -574,7 +574,7 @@ class RPC:
|
|||
current_rate = self._freqtrade.exchange.get_rate(
|
||||
trade.pair, refresh=False, side="sell")
|
||||
sell_reason = SellCheckTuple(sell_type=SellType.FORCE_SELL)
|
||||
self._freqtrade.execute_trade_exit(trade, current_rate, sell_reason, side="sell")
|
||||
self._freqtrade.execute_trade_exit(trade, current_rate, sell_reason)
|
||||
# ---- EOF def _exec_forcesell ----
|
||||
|
||||
if self._freqtrade.state != State.RUNNING:
|
||||
|
|
|
@ -2790,7 +2790,7 @@ def test_execute_trade_exit_up(default_conf_usdt, ticker_usdt, fee, ticker_usdt_
|
|||
)
|
||||
# Prevented sell ...
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.ROI))
|
||||
assert rpc_mock.call_count == 0
|
||||
assert freqtrade.strategy.confirm_trade_exit.call_count == 1
|
||||
|
@ -2798,7 +2798,7 @@ def test_execute_trade_exit_up(default_conf_usdt, ticker_usdt, fee, ticker_usdt_
|
|||
# Repatch with true
|
||||
freqtrade.strategy.confirm_trade_exit = MagicMock(return_value=True)
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.ROI))
|
||||
assert freqtrade.strategy.confirm_trade_exit.call_count == 1
|
||||
|
||||
|
@ -2853,7 +2853,7 @@ def test_execute_trade_exit_down(default_conf_usdt, ticker_usdt, fee, ticker_usd
|
|||
fetch_ticker=ticker_usdt_sell_down
|
||||
)
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_down()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_down()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
|
||||
|
||||
assert rpc_mock.call_count == 2
|
||||
|
@ -2917,7 +2917,7 @@ def test_execute_trade_exit_custom_exit_price(default_conf_usdt, ticker_usdt, fe
|
|||
# Set a custom exit price
|
||||
freqtrade.strategy.custom_exit_price = lambda **kwargs: 2.25
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.SELL_SIGNAL))
|
||||
|
||||
# Sell price must be different to default bid price
|
||||
|
@ -2981,7 +2981,7 @@ def test_execute_trade_exit_down_stoploss_on_exchange_dry_run(
|
|||
|
||||
trade.stop_loss = 2.0 * 0.99
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_down()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_down()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
|
||||
|
||||
assert rpc_mock.call_count == 2
|
||||
|
@ -3038,7 +3038,7 @@ def test_execute_trade_exit_sloe_cancel_exception(
|
|||
trade.stoploss_order_id = "abcd"
|
||||
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=1234, side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=1234,
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
|
||||
assert create_order_mock.call_count == 2
|
||||
assert log_has('Could not cancel stoploss order abcd', caplog)
|
||||
|
@ -3091,7 +3091,7 @@ def test_execute_trade_exit_with_stoploss_on_exchange(
|
|||
)
|
||||
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
|
||||
|
||||
trade = Trade.query.first()
|
||||
|
@ -3201,7 +3201,7 @@ def test_execute_trade_exit_market_order(default_conf_usdt, ticker_usdt, fee, is
|
|||
freqtrade.config['order_types']['sell'] = 'market'
|
||||
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.ROI))
|
||||
|
||||
assert not trade.is_open
|
||||
|
@ -3263,7 +3263,7 @@ def test_execute_trade_exit_insufficient_funds_error(default_conf_usdt, ticker_u
|
|||
sell_reason = SellCheckTuple(sell_type=SellType.ROI)
|
||||
# TODO-lev: side="buy"
|
||||
assert not freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'],
|
||||
sell_reason=sell_reason, side="sell")
|
||||
sell_reason=sell_reason)
|
||||
assert mock_insuf.call_count == 1
|
||||
|
||||
|
||||
|
@ -3421,7 +3421,7 @@ def test_locked_pairs(default_conf_usdt, ticker_usdt, fee,
|
|||
)
|
||||
|
||||
# TODO-lev: side="buy"
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_down()['bid'], side="sell",
|
||||
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_down()['bid'],
|
||||
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
|
||||
trade.close(ticker_usdt_sell_down()['bid'])
|
||||
assert freqtrade.strategy.is_pair_locked(trade.pair)
|
||||
|
|
Loading…
Reference in New Issue
Block a user