Updating requested changes in PR #6653

This commit is contained in:
மனோஜ்குமார் பழனிச்சாமி 2022-04-08 00:03:54 +05:30
parent 9417bb01dc
commit f7020df097
7 changed files with 19 additions and 16 deletions

View File

@ -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 <trade_id>|[table]`: Lists all or specific open trades.
- `/profit [<n>]`: Lists cumulative profit from all finished trades, over the last n days.
- `/force_exit <trade_id>|all`: Instantly exits the given trade (Ignoring `minimum_roi`).
- `/fe <trade_id>|all`: Alias to `/force_exit`
- `/forceexit <trade_id>|all`: Instantly exits the given trade (Ignoring `minimum_roi`).
- `/fx <trade_id>|all`: Alias to `/forceexit`
- `/performance`: Show performance of each finished trade grouped by pair
- `/balance`: Show account balance per currency.
- `/daily <n>`: Shows profit or loss per day, over the last n days.

View File

@ -171,8 +171,9 @@ official commands. You can ask at any moment for help with `/help`.
| `/locks` | Show currently locked pairs.
| `/unlock <pair or lock_id>` | Remove the lock for this pair (or for this lock id).
| `/profit [<n>]` | 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 <trade_id>` | Instantly exits the given trade (Ignoring `minimum_roi`).
| `/force_exit all` | Instantly exits all open trades (Ignoring `minimum_roi`).
| `/forceexit <trade_id>` | Instantly exits the given trade (Ignoring `minimum_roi`).
| `/forceexit all` | Instantly exits all open trades (Ignoring `minimum_roi`).
| `/fx` | alias for `/forceexit`
| `/forcelong <pair> [rate]` | Instantly buys the given pair. Rate is optional and only applies to limit orders. (`forcebuy_enable` must be set to True)
| `/forceshort <pair> [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

View File

@ -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.")

View File

@ -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

View File

@ -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(

View File

@ -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

View File

@ -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'], "