Update telegram message formatting
This commit is contained in:
parent
7d3116f9fb
commit
0db5d9f7fa
@ -233,8 +233,7 @@ class Telegram(RPCHandler):
|
|||||||
is_fill = msg['type'] in [RPCMessageType.ENTRY_FILL]
|
is_fill = msg['type'] in [RPCMessageType.ENTRY_FILL]
|
||||||
emoji = '\N{CHECK MARK}' if is_fill else '\N{LARGE BLUE CIRCLE}'
|
emoji = '\N{CHECK MARK}' if is_fill else '\N{LARGE BLUE CIRCLE}'
|
||||||
|
|
||||||
enter_side = ({'enter': 'Long', 'entered': 'Longed'} if msg['type']
|
enter_side = ({'enter': 'Long', 'entered': 'Longed'} if msg['direction'] == 'Long'
|
||||||
in [RPCMessageType.ENTRY_FILL, RPCMessageType.ENTRY]
|
|
||||||
else {'enter': 'Short', 'entered': 'Shorted'})
|
else {'enter': 'Short', 'entered': 'Shorted'})
|
||||||
message = (
|
message = (
|
||||||
f"{emoji} *{msg['exchange']}:*"
|
f"{emoji} *{msg['exchange']}:*"
|
||||||
|
@ -1787,6 +1787,7 @@ def test_send_msg_buy_notification(default_conf, mocker, caplog, message_type,
|
|||||||
'leverage': leverage,
|
'leverage': leverage,
|
||||||
'limit': 1.099e-05,
|
'limit': 1.099e-05,
|
||||||
'order_type': 'limit',
|
'order_type': 'limit',
|
||||||
|
'direction': enter,
|
||||||
'stake_amount': 0.01465333,
|
'stake_amount': 0.01465333,
|
||||||
'stake_amount_fiat': 0.0,
|
'stake_amount_fiat': 0.0,
|
||||||
'stake_currency': 'BTC',
|
'stake_currency': 'BTC',
|
||||||
@ -1875,9 +1876,9 @@ def test_send_msg_protection_notification(default_conf, mocker, time_machine) ->
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('message_type,entered,enter_signal,leverage', [
|
@pytest.mark.parametrize('message_type,entered,enter_signal,leverage', [
|
||||||
(RPCMessageType.ENTRY_FILL, 'Longed', 'long_signal_01', 1.0),
|
(RPCMessageType.ENTRY_FILL, 'Long', 'long_signal_01', 1.0),
|
||||||
(RPCMessageType.ENTRY_FILL, 'Longed', 'long_signal_02', 2.0),
|
(RPCMessageType.ENTRY_FILL, 'Long', 'long_signal_02', 2.0),
|
||||||
(RPCMessageType.ENTRY_FILL, 'Shorted', 'short_signal_01', 2.0),
|
(RPCMessageType.ENTRY_FILL, 'Short', 'short_signal_01', 2.0),
|
||||||
])
|
])
|
||||||
def test_send_msg_entry_fill_notification(default_conf, mocker, message_type, entered,
|
def test_send_msg_entry_fill_notification(default_conf, mocker, message_type, entered,
|
||||||
enter_signal, leverage) -> None:
|
enter_signal, leverage) -> None:
|
||||||
@ -1893,6 +1894,7 @@ def test_send_msg_entry_fill_notification(default_conf, mocker, message_type, en
|
|||||||
'pair': 'ETH/BTC',
|
'pair': 'ETH/BTC',
|
||||||
'leverage': leverage,
|
'leverage': leverage,
|
||||||
'stake_amount': 0.01465333,
|
'stake_amount': 0.01465333,
|
||||||
|
'direction': entered,
|
||||||
# 'stake_amount_fiat': 0.0,
|
# 'stake_amount_fiat': 0.0,
|
||||||
'stake_currency': 'BTC',
|
'stake_currency': 'BTC',
|
||||||
'fiat_currency': 'USD',
|
'fiat_currency': 'USD',
|
||||||
@ -1902,7 +1904,7 @@ def test_send_msg_entry_fill_notification(default_conf, mocker, message_type, en
|
|||||||
})
|
})
|
||||||
leverage_text = f'*Leverage:* `{leverage}`\n' if leverage != 1.0 else ''
|
leverage_text = f'*Leverage:* `{leverage}`\n' if leverage != 1.0 else ''
|
||||||
assert msg_mock.call_args[0][0] == (
|
assert msg_mock.call_args[0][0] == (
|
||||||
f'\N{CHECK MARK} *Binance:* {entered} ETH/BTC (#1)\n'
|
f'\N{CHECK MARK} *Binance:* {entered}ed ETH/BTC (#1)\n'
|
||||||
f'*Enter Tag:* `{enter_signal}`\n'
|
f'*Enter Tag:* `{enter_signal}`\n'
|
||||||
'*Amount:* `1333.33333333`\n'
|
'*Amount:* `1333.33333333`\n'
|
||||||
f"{leverage_text}"
|
f"{leverage_text}"
|
||||||
@ -2122,6 +2124,7 @@ def test_send_msg_buy_notification_no_fiat(
|
|||||||
'leverage': leverage,
|
'leverage': leverage,
|
||||||
'limit': 1.099e-05,
|
'limit': 1.099e-05,
|
||||||
'order_type': 'limit',
|
'order_type': 'limit',
|
||||||
|
'direction': enter,
|
||||||
'stake_amount': 0.01465333,
|
'stake_amount': 0.01465333,
|
||||||
'stake_amount_fiat': 0.0,
|
'stake_amount_fiat': 0.0,
|
||||||
'stake_currency': 'BTC',
|
'stake_currency': 'BTC',
|
||||||
|
Loading…
Reference in New Issue
Block a user