Update docs and tests for new daily command

This commit is contained in:
Matthias 2022-06-11 11:26:49 +02:00
parent 76827b31a9
commit 9ba11f7bcc
3 changed files with 34 additions and 34 deletions

View File

@ -328,11 +328,11 @@ Per default `/daily` will return the 7 last days. The example below if for `/dai
> **Daily Profit over the last 3 days:**
```
Day Profit BTC Profit USD
---------- -------------- ------------
2018-01-03 0.00224175 BTC 29,142 USD
2018-01-02 0.00033131 BTC 4,307 USD
2018-01-01 0.00269130 BTC 34.986 USD
Day (count) USDT USD Profit %
-------------- ------------ ---------- ----------
2022-06-11 (1) -0.746 USDT -0.75 USD -0.08%
2022-06-10 (0) 0 USDT 0.00 USD 0.00%
2022-06-09 (5) 20 USDT 20.10 USD 5.00%
```
### /weekly <n>
@ -342,11 +342,11 @@ from Monday. The example below if for `/weekly 3`:
> **Weekly Profit over the last 3 weeks (starting from Monday):**
```
Monday Profit BTC Profit USD
---------- -------------- ------------
2018-01-03 0.00224175 BTC 29,142 USD
2017-12-27 0.00033131 BTC 4,307 USD
2017-12-20 0.00269130 BTC 34.986 USD
Monday (count) Profit BTC Profit USD Profit %
------------- -------------- ------------ ----------
2018-01-03 (5) 0.00224175 BTC 29,142 USD 4.98%
2017-12-27 (1) 0.00033131 BTC 4,307 USD 0.00%
2017-12-20 (4) 0.00269130 BTC 34.986 USD 5.12%
```
### /monthly <n>
@ -356,11 +356,11 @@ if for `/monthly 3`:
> **Monthly Profit over the last 3 months:**
```
Month Profit BTC Profit USD
---------- -------------- ------------
2018-01 0.00224175 BTC 29,142 USD
2017-12 0.00033131 BTC 4,307 USD
2017-11 0.00269130 BTC 34.986 USD
Month (count) Profit BTC Profit USD Profit %
------------- -------------- ------------ ----------
2018-01 (20) 0.00224175 BTC 29,142 USD 4.98%
2017-12 (5) 0.00033131 BTC 4,307 USD 0.00%
2017-11 (10) 0.00269130 BTC 34.986 USD 5.10%
```
### /whitelist

View File

@ -611,9 +611,9 @@ class Telegram(RPCHandler):
f"{period['rel_profit']:.2%}",
] for period in stats['data']],
headers=[
f"{val.header} (trades)",
f'Prof {stake_cur}',
f'Prof {fiat_disp_cur}',
f"{val.header} (count)",
f'{stake_cur}',
f'{fiat_disp_cur}',
'Profit %',
'Trades',
],

View File

@ -432,9 +432,9 @@ def test_daily_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
assert str(datetime.utcnow().date()) in msg_mock.call_args_list[0][0][0]
assert ' 13.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 15.21 USD' in msg_mock.call_args_list[0][0][0]
assert ' 2 trade' in msg_mock.call_args_list[0][0][0]
assert '13.83 USDT 15.21 USD 2 trades' in msg_mock.call_args_list[0][0][0]
assert ' 0 trade' in msg_mock.call_args_list[0][0][0]
assert '(2)' in msg_mock.call_args_list[0][0][0]
assert '(2) 13.83 USDT 15.21 USD 1.31%' in msg_mock.call_args_list[0][0][0]
assert '(0)' in msg_mock.call_args_list[0][0][0]
# Reset msg_mock
msg_mock.reset_mock()
@ -446,9 +446,9 @@ def test_daily_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
assert str((datetime.utcnow() - timedelta(days=5)).date()) in msg_mock.call_args_list[0][0][0]
assert ' 13.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 15.21 USD' in msg_mock.call_args_list[0][0][0]
assert ' 2 trade' in msg_mock.call_args_list[0][0][0]
assert ' 1 trade' in msg_mock.call_args_list[0][0][0]
assert ' 0 trade' in msg_mock.call_args_list[0][0][0]
assert '(2)' in msg_mock.call_args_list[0][0][0]
assert '(1)' in msg_mock.call_args_list[0][0][0]
assert '(0)' in msg_mock.call_args_list[0][0][0]
# Reset msg_mock
msg_mock.reset_mock()
@ -459,7 +459,7 @@ def test_daily_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
telegram._daily(update=update, context=context)
assert ' 13.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 15.21 USD' in msg_mock.call_args_list[0][0][0]
assert ' 2 trade' in msg_mock.call_args_list[0][0][0]
assert '(2)' in msg_mock.call_args_list[0][0][0]
def test_daily_wrong_input(default_conf, update, ticker, mocker) -> None:
@ -521,8 +521,8 @@ def test_weekly_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
assert str(first_iso_day_of_current_week) in msg_mock.call_args_list[0][0][0]
assert ' 9.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 10.81 USD' in msg_mock.call_args_list[0][0][0]
assert ' 3 trade' in msg_mock.call_args_list[0][0][0]
assert ' 0 trade' in msg_mock.call_args_list[0][0][0]
assert '(3)' in msg_mock.call_args_list[0][0][0]
assert '(0)' in msg_mock.call_args_list[0][0][0]
# Reset msg_mock
msg_mock.reset_mock()
@ -534,8 +534,8 @@ def test_weekly_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
assert 'Weekly' in msg_mock.call_args_list[0][0][0]
assert ' 9.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 10.81 USD' in msg_mock.call_args_list[0][0][0]
assert ' 3 trade' in msg_mock.call_args_list[0][0][0]
assert ' 0 trade' in msg_mock.call_args_list[0][0][0]
assert '(3)' in msg_mock.call_args_list[0][0][0]
assert '(0)' in msg_mock.call_args_list[0][0][0]
# Try invalid data
msg_mock.reset_mock()
@ -589,8 +589,8 @@ def test_monthly_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
assert current_month in msg_mock.call_args_list[0][0][0]
assert ' 9.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 10.81 USD' in msg_mock.call_args_list[0][0][0]
assert ' 3 trade' in msg_mock.call_args_list[0][0][0]
assert ' 0 trade' in msg_mock.call_args_list[0][0][0]
assert '(3)' in msg_mock.call_args_list[0][0][0]
assert '(0)' in msg_mock.call_args_list[0][0][0]
# Reset msg_mock
msg_mock.reset_mock()
@ -603,8 +603,8 @@ def test_monthly_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
assert current_month in msg_mock.call_args_list[0][0][0]
assert ' 9.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 10.81 USD' in msg_mock.call_args_list[0][0][0]
assert ' 3 trade' in msg_mock.call_args_list[0][0][0]
assert ' 0 trade' in msg_mock.call_args_list[0][0][0]
assert '(3)' in msg_mock.call_args_list[0][0][0]
assert '(0)' in msg_mock.call_args_list[0][0][0]
# Reset msg_mock
msg_mock.reset_mock()
@ -617,7 +617,7 @@ def test_monthly_handle(default_conf_usdt, update, ticker, fee, mocker) -> None:
assert 'Monthly Profit over the last 12 months</b>:' in msg_mock.call_args_list[0][0][0]
assert ' 9.83 USDT' in msg_mock.call_args_list[0][0][0]
assert ' 10.81 USD' in msg_mock.call_args_list[0][0][0]
assert ' 3 trade' in msg_mock.call_args_list[0][0][0]
assert '(3)' in msg_mock.call_args_list[0][0][0]
# The one-digit months should contain a zero, Eg: September 2021 = "2021-09"
# Since we loaded the last 12 months, any month should appear