Skip to content

Commit

Permalink
Handle arguments uniformly (by using context.args)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmatthias committed Sep 2, 2019
1 parent 8cad90f commit 3b15cce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions freqtrade/rpc/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def _forcesell(self, update: Update, context: CallbackContext) -> None:
:return: None
"""

trade_id = update.message.text.replace('/forcesell', '').strip()
trade_id = context.args[0] if len(context.args) > 0 else None
try:
msg = self._rpc_forcesell(trade_id)
self._send_msg('Forcesell Result: `{result}`'.format(**msg))
Expand All @@ -425,9 +425,8 @@ def _forcebuy(self, update: Update, context: CallbackContext) -> None:
:return: None
"""

message = update.message.text.replace('/forcebuy', '').strip().split()
pair = message[0]
price = float(message[1]) if len(message) > 1 else None
pair = context.args[0]
price = float(context.args[1]) if len(context.args) > 1 else None
try:
self._rpc_forcebuy(pair, price)
except RPCException as e:
Expand Down

0 comments on commit 3b15cce

Please sign in to comment.