Merge branch 'feat/short' into funding-fee-dry-run

This commit is contained in:
Matthias
2021-11-12 08:06:29 +01:00
committed by GitHub
2 changed files with 23 additions and 20 deletions

View File

@@ -906,7 +906,6 @@ def test_execute_entry_confirm_error(mocker, default_conf_usdt, fee, limit_order
pair = 'ETH/USDT'
freqtrade.strategy.confirm_trade_entry = MagicMock(side_effect=ValueError)
# TODO-lev: KeyError happens on short, why?
assert freqtrade.execute_entry(pair, stake_amount)
limit_order[enter_side(is_short)]['id'] = '222'
@@ -1228,7 +1227,6 @@ def test_create_stoploss_order_insufficient_funds(
def test_handle_stoploss_on_exchange_trailing(
mocker, default_conf_usdt, fee, is_short, bid, ask, limit_order, stop_price, amt, hang_price
) -> None:
# TODO-lev: test for short
# When trailing stoploss is set
enter_order = limit_order[enter_side(is_short)]
exit_order = limit_order[exit_side(is_short)]
@@ -1435,7 +1433,6 @@ def test_handle_stoploss_on_exchange_custom_stop(
enter_order = limit_order[enter_side(is_short)]
exit_order = limit_order[exit_side(is_short)]
# When trailing stoploss is set
# TODO-lev: test for short
stoploss = MagicMock(return_value={'id': 13434334})
patch_RPCManager(mocker)
mocker.patch.multiple(
@@ -2973,9 +2970,11 @@ def test_execute_trade_exit_custom_exit_price(
# 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'],
sell_reason=SellCheckTuple(sell_type=SellType.SELL_SIGNAL))
freqtrade.execute_trade_exit(
trade=trade,
limit=ticker_usdt_sell_up()['ask' if is_short else 'bid'],
sell_reason=SellCheckTuple(sell_type=SellType.SELL_SIGNAL)
)
# Sell price must be different to default bid price
@@ -3098,7 +3097,6 @@ def test_execute_trade_exit_sloe_cancel_exception(
freqtrade.config['dry_run'] = False
trade.stoploss_order_id = "abcd"
# TODO-lev: side="buy"
freqtrade.execute_trade_exit(trade=trade, limit=1234,
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
assert create_order_mock.call_count == 2
@@ -3152,9 +3150,11 @@ def test_execute_trade_exit_with_stoploss_on_exchange(
fetch_ticker=ticker_usdt_sell_up
)
# TODO-lev: side="buy"
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_up()['bid'],
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
freqtrade.execute_trade_exit(
trade=trade,
limit=ticker_usdt_sell_up()['ask' if is_short else 'bid'],
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS)
)
trade = Trade.query.first()
trade.is_short = is_short
@@ -3288,7 +3288,6 @@ def test_execute_trade_exit_market_order(
)
freqtrade.config['order_types']['sell'] = 'market'
# TODO-lev: side="buy"
freqtrade.execute_trade_exit(
trade=trade,
limit=ticker_usdt_sell_up()['ask' if is_short else 'bid'],
@@ -3354,9 +3353,11 @@ 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)
assert not freqtrade.execute_trade_exit(
trade=trade,
limit=ticker_usdt_sell_up()['ask' if is_short else 'bid'],
sell_reason=sell_reason
)
assert mock_insuf.call_count == 1
@@ -3517,9 +3518,11 @@ def test_locked_pairs(default_conf_usdt, ticker_usdt, fee,
fetch_ticker=ticker_usdt_sell_down
)
# TODO-lev: side="buy"
freqtrade.execute_trade_exit(trade=trade, limit=ticker_usdt_sell_down()['bid'],
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
freqtrade.execute_trade_exit(
trade=trade,
limit=ticker_usdt_sell_down()['ask' if is_short else 'bid'],
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS)
)
trade.close(ticker_usdt_sell_down()['bid'])
assert freqtrade.strategy.is_pair_locked(trade.pair)