Merge branch 'develop' into pr/Axel-CH/8779
This commit is contained in:
+11
-12
@@ -1598,13 +1598,13 @@ def test_create_stoploss_order_insufficient_funds(
|
|||||||
assert mock_insuf.call_count == 1
|
assert mock_insuf.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("is_short,bid,ask,stop_price,amt,hang_price", [
|
@pytest.mark.parametrize("is_short,bid,ask,stop_price,hang_price", [
|
||||||
(False, [4.38, 4.16], [4.4, 4.17], ['2.0805', 4.4 * 0.95], 27.39726027, 3),
|
(False, [4.38, 4.16], [4.4, 4.17], ['2.0805', 4.4 * 0.95], 3),
|
||||||
(True, [1.09, 1.21], [1.1, 1.22], ['2.321', 1.09 * 1.05], 27.27272727, 1.5),
|
(True, [1.09, 1.21], [1.1, 1.22], ['2.321', 1.09 * 1.05], 1.5),
|
||||||
])
|
])
|
||||||
@pytest.mark.usefixtures("init_persistence")
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
def test_handle_stoploss_on_exchange_trailing(
|
def test_handle_stoploss_on_exchange_trailing(
|
||||||
mocker, default_conf_usdt, fee, is_short, bid, ask, limit_order, stop_price, amt, hang_price
|
mocker, default_conf_usdt, fee, is_short, bid, ask, limit_order, stop_price, hang_price
|
||||||
) -> None:
|
) -> None:
|
||||||
# When trailing stoploss is set
|
# When trailing stoploss is set
|
||||||
enter_order = limit_order[entry_side(is_short)]
|
enter_order = limit_order[entry_side(is_short)]
|
||||||
@@ -1619,8 +1619,8 @@ def test_handle_stoploss_on_exchange_trailing(
|
|||||||
'last': 2.19,
|
'last': 2.19,
|
||||||
}),
|
}),
|
||||||
create_order=MagicMock(side_effect=[
|
create_order=MagicMock(side_effect=[
|
||||||
{'id': enter_order['id']},
|
enter_order,
|
||||||
{'id': exit_order['id']},
|
exit_order,
|
||||||
]),
|
]),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
)
|
)
|
||||||
@@ -1715,8 +1715,7 @@ def test_handle_stoploss_on_exchange_trailing(
|
|||||||
|
|
||||||
cancel_order_mock.assert_called_once_with('100', 'ETH/USDT')
|
cancel_order_mock.assert_called_once_with('100', 'ETH/USDT')
|
||||||
stoploss_order_mock.assert_called_once_with(
|
stoploss_order_mock.assert_called_once_with(
|
||||||
# TODO: Why is 30 correct here, and had to be "amt" before??
|
amount=30,
|
||||||
amount=pytest.approx(30),
|
|
||||||
pair='ETH/USDT',
|
pair='ETH/USDT',
|
||||||
order_types=freqtrade.strategy.order_types,
|
order_types=freqtrade.strategy.order_types,
|
||||||
stop_price=stop_price[1],
|
stop_price=stop_price[1],
|
||||||
@@ -1983,7 +1982,7 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, limit_orde
|
|||||||
|
|
||||||
enter_order = limit_order['buy']
|
enter_order = limit_order['buy']
|
||||||
exit_order = limit_order['sell']
|
exit_order = limit_order['sell']
|
||||||
|
enter_order['average'] = 2.19
|
||||||
# When trailing stoploss is set
|
# When trailing stoploss is set
|
||||||
stoploss = MagicMock(return_value={'id': '13434334', 'status': 'open'})
|
stoploss = MagicMock(return_value={'id': '13434334', 'status': 'open'})
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
@@ -2000,8 +1999,8 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, limit_orde
|
|||||||
'last': 2.19
|
'last': 2.19
|
||||||
}),
|
}),
|
||||||
create_order=MagicMock(side_effect=[
|
create_order=MagicMock(side_effect=[
|
||||||
{'id': enter_order['id']},
|
enter_order,
|
||||||
{'id': exit_order['id']},
|
exit_order,
|
||||||
]),
|
]),
|
||||||
get_fee=fee,
|
get_fee=fee,
|
||||||
create_stoploss=stoploss,
|
create_stoploss=stoploss,
|
||||||
@@ -2096,7 +2095,7 @@ def test_tsl_on_exchange_compatible_with_edge(mocker, edge_conf, fee, limit_orde
|
|||||||
assert trade.stop_loss == 4.4 * 0.99
|
assert trade.stop_loss == 4.4 * 0.99
|
||||||
cancel_order_mock.assert_called_once_with('100', 'NEO/BTC')
|
cancel_order_mock.assert_called_once_with('100', 'NEO/BTC')
|
||||||
stoploss_order_mock.assert_called_once_with(
|
stoploss_order_mock.assert_called_once_with(
|
||||||
amount=pytest.approx(11.41438356),
|
amount=30,
|
||||||
pair='NEO/BTC',
|
pair='NEO/BTC',
|
||||||
order_types=freqtrade.strategy.order_types,
|
order_types=freqtrade.strategy.order_types,
|
||||||
stop_price=4.4 * 0.99,
|
stop_price=4.4 * 0.99,
|
||||||
|
|||||||
Reference in New Issue
Block a user