Update more terminology to forceexit

This commit is contained in:
Matthias
2022-04-10 15:56:29 +02:00
parent 77c840c2a4
commit 68fe7476c9
8 changed files with 26 additions and 26 deletions

View File

@@ -251,7 +251,7 @@ tc15 = BTContainer(data=[
BTrade(exit_reason=ExitType.STOP_LOSS, open_tick=2, close_tick=2)]
)
# Test 16: Buy, hold for 65 min, then forcesell using roi=-1
# Test 16: Buy, hold for 65 min, then forceexit using roi=-1
# Causes negative profit even though sell-reason is ROI.
# stop-loss: 10%, ROI: 10% (should not apply), -100% after 65 minutes (limits trade duration)
tc16 = BTContainer(data=[
@@ -259,14 +259,14 @@ tc16 = BTContainer(data=[
[0, 5000, 5025, 4975, 4987, 6172, 1, 0],
[1, 5000, 5025, 4975, 4987, 6172, 0, 0],
[2, 4987, 5300, 4950, 5050, 6172, 0, 0],
[3, 4975, 5000, 4940, 4962, 6172, 0, 0], # ForceSell on ROI (roi=-1)
[3, 4975, 5000, 4940, 4962, 6172, 0, 0], # Forceexit on ROI (roi=-1)
[4, 4962, 4987, 4950, 4950, 6172, 0, 0],
[5, 4950, 4975, 4925, 4950, 6172, 0, 0]],
stop_loss=-0.10, roi={"0": 0.10, "65": -1}, profit_perc=-0.012,
trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)]
)
# Test 17: Buy, hold for 120 mins, then forcesell using roi=-1
# Test 17: Buy, hold for 120 mins, then forceexit using roi=-1
# Causes negative profit even though sell-reason is ROI.
# stop-loss: 10%, ROI: 10% (should not apply), -100% after 100 minutes (limits trade duration)
# Uses open as sell-rate (special case) - since the roi-time is a multiple of the timeframe.
@@ -275,7 +275,7 @@ tc17 = BTContainer(data=[
[0, 5000, 5025, 4975, 4987, 6172, 1, 0],
[1, 5000, 5025, 4975, 4987, 6172, 0, 0],
[2, 4987, 5300, 4950, 5050, 6172, 0, 0],
[3, 4980, 5000, 4940, 4962, 6172, 0, 0], # ForceSell on ROI (roi=-1)
[3, 4980, 5000, 4940, 4962, 6172, 0, 0], # Forceexit on ROI (roi=-1)
[4, 4962, 4987, 4950, 4950, 6172, 0, 0],
[5, 4950, 4975, 4925, 4950, 6172, 0, 0]],
stop_loss=-0.10, roi={"0": 0.10, "120": -1}, profit_perc=-0.004,

View File

@@ -1182,7 +1182,7 @@ def test_api_force_entry(botclient, mocker, fee, endpoint):
}
def test_api_forcesell(botclient, mocker, ticker, fee, markets):
def test_api_forceexit(botclient, mocker, ticker, fee, markets):
ftbot, client = botclient
mocker.patch.multiple(
'freqtrade.exchange.Exchange',
@@ -1194,15 +1194,15 @@ def test_api_forcesell(botclient, mocker, ticker, fee, markets):
)
patch_get_signal(ftbot)
rc = client_post(client, f"{BASE_URI}/forcesell",
rc = client_post(client, f"{BASE_URI}/forceexit",
data='{"tradeid": "1"}')
assert_response(rc, 502)
assert rc.json() == {"error": "Error querying /api/v1/forcesell: invalid argument"}
assert rc.json() == {"error": "Error querying /api/v1/forceexit: invalid argument"}
Trade.query.session.rollback()
ftbot.enter_positions()
rc = client_post(client, f"{BASE_URI}/forcesell",
rc = client_post(client, f"{BASE_URI}/forceexit",
data='{"tradeid": "1"}')
assert_response(rc)
assert rc.json() == {'result': 'Created sell order for trade 1.'}

View File

@@ -1005,7 +1005,7 @@ def test_reload_config_handle(default_conf, update, mocker) -> None:
assert 'Reloading config' in msg_mock.call_args_list[0][0][0]
def test_telegram_forcesell_handle(default_conf, update, ticker, fee,
def test_telegram_forceexit_handle(default_conf, update, ticker, fee,
ticker_sell_up, mocker) -> None:
mocker.patch('freqtrade.rpc.rpc.CryptoToFiatConverter._find_price', return_value=15000.0)
msg_mock = mocker.patch('freqtrade.rpc.telegram.Telegram.send_msg', MagicMock())
@@ -1033,7 +1033,7 @@ def test_telegram_forcesell_handle(default_conf, update, ticker, fee,
# Increase the price and sell it
mocker.patch('freqtrade.exchange.Exchange.fetch_ticker', ticker_sell_up)
# /forcesell 1
# /forceexit 1
context = MagicMock()
context.args = ["1"]
telegram._force_exit(update=update, context=context)
@@ -1101,7 +1101,7 @@ def test_telegram_force_exit_down_handle(default_conf, update, ticker, fee,
trade = Trade.query.first()
assert trade
# /forcesell 1
# /forceexit 1
context = MagicMock()
context.args = ["1"]
telegram._force_exit(update=update, context=context)
@@ -1137,7 +1137,7 @@ def test_telegram_force_exit_down_handle(default_conf, update, ticker, fee,
} == last_msg
def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None:
def test_forceexit_all_handle(default_conf, update, ticker, fee, mocker) -> None:
patch_exchange(mocker)
mocker.patch('freqtrade.rpc.fiat_convert.CryptoToFiatConverter._find_price',
return_value=15000.0)
@@ -1160,7 +1160,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None
freqtradebot.enter_positions()
msg_mock.reset_mock()
# /forcesell all
# /forceexit all
context = MagicMock()
context.args = ["all"]
telegram._force_exit(update=update, context=context)
@@ -1196,7 +1196,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None
} == msg
def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
def test_forceexit_handle_invalid(default_conf, update, mocker) -> None:
mocker.patch('freqtrade.rpc.fiat_convert.CryptoToFiatConverter._find_price',
return_value=15000.0)
@@ -1205,7 +1205,7 @@ def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
# Trader is not running
freqtradebot.state = State.STOPPED
# /forcesell 1
# /forceexit 1
context = MagicMock()
context.args = ["1"]
telegram._force_exit(update=update, context=context)
@@ -1215,7 +1215,7 @@ def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
# Invalid argument
msg_mock.reset_mock()
freqtradebot.state = State.RUNNING
# /forcesell 123456
# /forceexit 123456
context = MagicMock()
context.args = ["123456"]
telegram._force_exit(update=update, context=context)