diff --git a/README.md b/README.md index 60157a25f..679dbcab0 100644 --- a/README.md +++ b/README.md @@ -128,8 +128,8 @@ Telegram is not mandatory. However, this is a great way to control your bot. Mor - `/stopbuy`: Stop entering new trades. - `/status |[table]`: Lists all or specific open trades. - `/profit []`: Lists cumulative profit from all finished trades, over the last n days. -- `/force_exit |all`: Instantly exits the given trade (Ignoring `minimum_roi`). -- `/fe |all`: Alias to `/force_exit` +- `/forceexit |all`: Instantly exits the given trade (Ignoring `minimum_roi`). +- `/fx |all`: Alias to `/forceexit` - `/performance`: Show performance of each finished trade grouped by pair - `/balance`: Show account balance per currency. - `/daily `: Shows profit or loss per day, over the last n days. diff --git a/docs/telegram-usage.md b/docs/telegram-usage.md index 047c21ccf..4e36de1e7 100644 --- a/docs/telegram-usage.md +++ b/docs/telegram-usage.md @@ -171,8 +171,9 @@ official commands. You can ask at any moment for help with `/help`. | `/locks` | Show currently locked pairs. | `/unlock ` | Remove the lock for this pair (or for this lock id). | `/profit []` | Display a summary of your profit/loss from close trades and some stats about your performance, over the last n days (all trades by default) -| `/force_exit ` | Instantly exits the given trade (Ignoring `minimum_roi`). -| `/force_exit all` | Instantly exits all open trades (Ignoring `minimum_roi`). +| `/forceexit ` | Instantly exits the given trade (Ignoring `minimum_roi`). +| `/forceexit all` | Instantly exits all open trades (Ignoring `minimum_roi`). +| `/fx` | alias for `/forceexit` | `/forcelong [rate]` | Instantly buys the given pair. Rate is optional and only applies to limit orders. (`forcebuy_enable` must be set to True) | `/forceshort [rate]` | Instantly shorts the given pair. Rate is optional and only applies to limit orders. This will only work on non-spot markets. (`forcebuy_enable` must be set to True) | `/performance` | Show performance of each finished trade grouped by pair diff --git a/freqtrade/configuration/config_validation.py b/freqtrade/configuration/config_validation.py index 025d7dfa1..6e4a4b0ef 100644 --- a/freqtrade/configuration/config_validation.py +++ b/freqtrade/configuration/config_validation.py @@ -244,7 +244,9 @@ def _validate_time_in_force(conf: Dict[str, Any]) -> None: def _validate_order_types(conf: Dict[str, Any]) -> None: order_types = conf.get('order_types', {}) - if any(x in order_types for x in ['buy', 'sell', 'emergencysell', 'forcebuy', 'forcesell', 'emergencyexit', 'forceexit', 'forceentry']): + old_order_types = ['buy', 'sell', 'emergencysell', 'forcebuy', + 'forcesell', 'emergencyexit', 'forceexit', 'forceentry'] + if any(x in order_types for x in old_order_types): if conf.get('trading_mode', TradingMode.SPOT) != TradingMode.SPOT: raise OperationalException( "Please migrate your order_types settings to use the new wording.") diff --git a/freqtrade/rpc/api_server/api_v1.py b/freqtrade/rpc/api_server/api_v1.py index 8bda34dc6..6628bcdce 100644 --- a/freqtrade/rpc/api_server/api_v1.py +++ b/freqtrade/rpc/api_server/api_v1.py @@ -136,7 +136,7 @@ def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(g # /forcebuy is deprecated with short addition. use Force_entry instead -@router.post('/force_enter', response_model=ForceEnterResponse, tags=['trading']) +@router.post('/forceenter', response_model=ForceEnterResponse, tags=['trading']) @router.post('/forcebuy', response_model=ForceEnterResponse, tags=['trading']) def force_entry(payload: ForceEnterPayload, rpc: RPC = Depends(get_rpc)): ordertype = payload.ordertype.value if payload.ordertype else None @@ -154,7 +154,7 @@ def force_entry(payload: ForceEnterPayload, rpc: RPC = Depends(get_rpc)): {"status": f"Error entering {payload.side} trade for pair {payload.pair}."}) -@router.post('/force_exit', response_model=ResultMsg, tags=['trading']) +@router.post('/forceexit', response_model=ResultMsg, tags=['trading']) @router.post('/forcesell', response_model=ResultMsg, tags=['trading']) def forcesell(payload: ForceExitPayload, rpc: RPC = Depends(get_rpc)): ordertype = payload.ordertype.value if payload.ordertype else None diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 01c841ade..5369843af 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -115,7 +115,7 @@ class Telegram(RPCHandler): r'/stopbuy$', r'/reload_config$', r'/show_config$', r'/logs$', r'/whitelist$', r'/blacklist$', r'/bl_delete$', r'/weekly$', r'/weekly \d+$', r'/monthly$', r'/monthly \d+$', - r'/forcebuy$', r'/forcelong$', r'/forceshort$', r'/force_exit$', + r'/forcebuy$', r'/forcelong$', r'/forceshort$', r'/forceexit$', r'/edge$', r'/health$', r'/help$', r'/version$'] # Create keys for generation valid_keys_print = [k.replace('$', '') for k in valid_keys] @@ -153,7 +153,7 @@ class Telegram(RPCHandler): CommandHandler('balance', self._balance), CommandHandler('start', self._start), CommandHandler('stop', self._stop), - CommandHandler(['forcesell', 'force_exit', 'fe'], self._force_exit), + CommandHandler(['forcesell', 'forceexit', 'fx'], self._force_exit), CommandHandler(['forcebuy', 'forcelong'], partial( self._force_enter, order_side=SignalDirection.LONG)), CommandHandler('forceshort', partial( @@ -1360,13 +1360,13 @@ class Telegram(RPCHandler): :return: None """ force_enter_text = ("*/forcelong []:* `Instantly buys the given pair. " - "Optionally takes a rate at which to buy " - "(only applies to limit orders).` \n" - ) + "Optionally takes a rate at which to buy " + "(only applies to limit orders).` \n" + ) if self._rpc._freqtrade.trading_mode != TradingMode.SPOT: force_enter_text += ("*/forceshort []:* `Instantly shorts the given pair. " - "Optionally takes a rate at which to sell " - "(only applies to limit orders).` \n") + "Optionally takes a rate at which to sell " + "(only applies to limit orders).` \n") message = ( "_BotControl_\n" "------------\n" diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 3f3cc69e2..992e4edf7 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -1075,7 +1075,7 @@ def test_api_whitelist(botclient): @pytest.mark.parametrize('endpoint', [ 'forcebuy', - 'force_enter', + 'forceenter', ]) def test_api_force_entry(botclient, mocker, fee, endpoint): ftbot, client = botclient diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 5c54a2377..f104e7153 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -95,7 +95,7 @@ def test_telegram_init(default_conf, mocker, caplog) -> None: message_str = ("rpc.telegram is listening for following commands: [['status'], ['profit'], " "['balance'], ['start'], ['stop'], " - "['forcesell', 'force_exit', 'fe'], ['forcebuy', 'forcelong'], ['forceshort'], " + "['forcesell', 'forceexit', 'fx'], ['forcebuy', 'forcelong'], ['forceshort'], " "['trades'], ['delete'], ['performance'], " "['buys', 'entries'], ['sells', 'exits'], ['mix_tags'], " "['stats'], ['daily'], ['weekly'], ['monthly'], "