Skip to content

Commit

Permalink
Fixed messages and readability
Browse files Browse the repository at this point in the history
  • Loading branch information
yazeed committed Feb 11, 2020
1 parent 867b736 commit fc29564
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/webhook-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Sample configuration (tested using IFTTT).
"value3": "{stake_amount:8f} {stake_currency}"
},
"webhookbuycancel": {
"value1": "Cancelling Buy {pair}",
"value1": "Cancelling Open Buy Order for {pair}",
"value2": "limit {limit:8f}",
"value3": "{stake_amount:8f} {stake_currency}"
},
Expand All @@ -26,7 +26,7 @@ Sample configuration (tested using IFTTT).
"value3": "profit: {profit_amount:8f} {stake_currency}"
},
"webhooksellcancel": {
"value1": "Cancelling Sell {pair}",
"value1": "Cancelling Open Sell Order for {pair}",
"value2": "limit {limit:8f}",
"value3": "profit: {profit_amount:8f} {stake_currency}"
},
Expand Down
4 changes: 2 additions & 2 deletions freqtrade/rpc/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def _rpc_status_table(self, stake_currency: str,
profit_str += f" ({fiat_profit:.2f})"
trades_list.append([
trade.id,
trade.pair + ['', '*'][trade.open_order_id is not None
and trade.close_rate_requested is None],
trade.pair + '*' if (trade.open_order_id is not None
and trade.close_rate_requested is None) else '',
shorten_date(arrow.get(trade.open_date).humanize(only_distance=True)),
profit_str
])
Expand Down
4 changes: 2 additions & 2 deletions freqtrade/rpc/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def send_msg(self, msg: Dict[str, Any]) -> None:
message += ")`"

elif msg['type'] == RPCMessageType.BUY_CANCEL_NOTIFICATION:
message = "*{exchange}:* Cancelling Buy {pair}".format(**msg)
message = "*{exchange}:* Cancelling Open Buy Order for {pair}".format(**msg)

elif msg['type'] == RPCMessageType.SELL_NOTIFICATION:
msg['amount'] = round(msg['amount'], 8)
Expand Down Expand Up @@ -172,7 +172,7 @@ def send_msg(self, msg: Dict[str, Any]) -> None:
' / {profit_fiat:.3f} {fiat_currency})`').format(**msg)

elif msg['type'] == RPCMessageType.SELL_CANCEL_NOTIFICATION:
message = "*{exchange}:* Cancelling Sell {pair}".format(**msg)
message = "*{exchange}:* Cancelling Open Sell Order for {pair}".format(**msg)

elif msg['type'] == RPCMessageType.STATUS_NOTIFICATION:
message = '*Status:* `{status}`'.format(**msg)
Expand Down
6 changes: 3 additions & 3 deletions tests/rpc/test_rpc_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ def test_send_msg_buy_cancel_notification(default_conf, mocker) -> None:
'pair': 'ETH/BTC',
})
assert msg_mock.call_args[0][0] \
== ('*Bittrex:* Cancelling Buy ETH/BTC')
== ('*Bittrex:* Cancelling Open Buy Order for ETH/BTC')


def test_send_msg_sell_notification(default_conf, mocker) -> None:
Expand Down Expand Up @@ -1318,7 +1318,7 @@ def test_send_msg_sell_cancel_notification(default_conf, mocker) -> None:
'pair': 'KEY/ETH',
})
assert msg_mock.call_args[0][0] \
== ('*Binance:* Cancelling Sell KEY/ETH')
== ('*Binance:* Cancelling Open Sell Order for KEY/ETH')

msg_mock.reset_mock()
telegram.send_msg({
Expand All @@ -1327,7 +1327,7 @@ def test_send_msg_sell_cancel_notification(default_conf, mocker) -> None:
'pair': 'KEY/ETH',
})
assert msg_mock.call_args[0][0] \
== ('*Binance:* Cancelling Sell KEY/ETH')
== ('*Binance:* Cancelling Open Sell Order for KEY/ETH')
# Reset singleton function to avoid random breaks
telegram._fiat_converter.convert_amount = old_convamount

Expand Down
4 changes: 2 additions & 2 deletions tests/rpc/test_rpc_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_webhook_dict() -> dict:
"value3": "{stake_amount:8f} {stake_currency}"
},
"webhookbuycancel": {
"value1": "Cancelling Buy {pair}",
"value1": "Cancelling Open Buy Order for {pair}",
"value2": "limit {limit:8f}",
"value3": "{stake_amount:8f} {stake_currency}"
},
Expand All @@ -31,7 +31,7 @@ def get_webhook_dict() -> dict:
"value3": "profit: {profit_amount:8f} {stake_currency}"
},
"webhooksellcancel": {
"value1": "Cancelling Sell {pair}",
"value1": "Cancelling Open Sell Order for {pair}",
"value2": "limit {limit:8f}",
"value3": "profit: {profit_amount:8f} {stake_currency}"
},
Expand Down

0 comments on commit fc29564

Please sign in to comment.