mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
updated test cases
This commit is contained in:
parent
92997c85f9
commit
22f7c0fdc6
|
@ -735,14 +735,16 @@ def test_api_profit(botclient, mocker, ticker, fee, markets, is_short):
|
|||
'profit_all_percent_sum': 398.47 if is_short else -398.47,
|
||||
'profit_all_ratio_sum': 3.98465727 if is_short else -3.9846604,
|
||||
'profit_all_percent': 4.36 if is_short else -4.41,
|
||||
'profit_all_ratio': 0.043612222872799825 if is_short else -0.044063014216106644,
|
||||
'profit_all_ratio': 0.043612222872799825 if is_short
|
||||
else -0.044063014216106644,
|
||||
'profit_closed_coin': -0.00673913 if is_short else 0.00073913,
|
||||
'profit_closed_fiat': -83.19455985 if is_short else 9.124559849999999,
|
||||
'profit_closed_ratio_mean': -0.0075 if is_short else 0.0075,
|
||||
'profit_closed_percent_mean': -0.75 if is_short else 0.75,
|
||||
'profit_closed_ratio_sum': -0.015 if is_short else 0.015,
|
||||
'profit_closed_percent_sum': -1.5 if is_short else 1.5,
|
||||
'profit_closed_ratio': -6.739057628404269e-06 if is_short else 7.391275897987988e-07,
|
||||
'profit_closed_ratio': -6.739057628404269e-06 if is_short
|
||||
else 7.391275897987988e-07,
|
||||
'profit_closed_percent': -0.0 if is_short else 0.0,
|
||||
'trade_count': 6,
|
||||
'closed_trade_count': 2,
|
||||
|
@ -896,7 +898,7 @@ def test_api_status(botclient, mocker, ticker, fee, markets, is_short):
|
|||
'fee_open_cost': None,
|
||||
'fee_open_currency': None,
|
||||
'is_open': True,
|
||||
"is_short": is_short,
|
||||
"is_short": is_short,
|
||||
'max_rate': ANY,
|
||||
'min_rate': ANY,
|
||||
'open_order_id': 'dry_run_buy_short_12345' if is_short else 'dry_run_buy_long_12345',
|
||||
|
@ -974,8 +976,8 @@ def test_api_whitelist(botclient):
|
|||
"method": ["StaticPairList"]
|
||||
}
|
||||
|
||||
|
||||
def test_api_forcebuy(botclient, mocker, fee):
|
||||
@pytest.mark.parametrize('is_short', [True, False])
|
||||
def test_api_forcebuy(botclient, mocker, fee, is_short):
|
||||
ftbot, client = botclient
|
||||
|
||||
rc = client_post(client, f"{BASE_URI}/forcebuy",
|
||||
|
@ -1004,6 +1006,7 @@ def test_api_forcebuy(botclient, mocker, fee):
|
|||
open_order_id="123456",
|
||||
open_date=datetime.utcnow(),
|
||||
is_open=False,
|
||||
is_short=is_short,
|
||||
fee_close=fee.return_value,
|
||||
fee_open=fee.return_value,
|
||||
close_rate=0.265441,
|
||||
|
@ -1052,11 +1055,12 @@ def test_api_forcebuy(botclient, mocker, fee):
|
|||
'fee_open_cost': None,
|
||||
'fee_open_currency': None,
|
||||
'is_open': False,
|
||||
'is_short': is_short,
|
||||
'max_rate': None,
|
||||
'min_rate': None,
|
||||
'open_order_id': '123456',
|
||||
'open_rate_requested': None,
|
||||
'open_trade_value': 0.24605460,
|
||||
'open_trade_value': 0.2448274 if is_short else 0.24605460,
|
||||
'sell_reason': None,
|
||||
'sell_order_status': None,
|
||||
'strategy': CURRENT_TEST_STRATEGY,
|
||||
|
|
|
@ -1261,8 +1261,8 @@ def test_edge_enabled(edge_conf, update, mocker) -> None:
|
|||
assert 'Winrate' not in msg_mock.call_args_list[0][0][0]
|
||||
|
||||
|
||||
# TODO-lev: @pytest.mark.parametrize('is_short', [True, False])
|
||||
def test_telegram_trades(mocker, update, default_conf, fee):
|
||||
@pytest.mark.parametrize('is_short', [True, False])
|
||||
def test_telegram_trades(mocker, update, default_conf, fee, is_short):
|
||||
|
||||
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||
|
||||
|
@ -1280,7 +1280,7 @@ def test_telegram_trades(mocker, update, default_conf, fee):
|
|||
assert "<pre>" not in msg_mock.call_args_list[0][0][0]
|
||||
msg_mock.reset_mock()
|
||||
|
||||
create_mock_trades(fee, False)
|
||||
create_mock_trades(fee, is_short)
|
||||
|
||||
context = MagicMock()
|
||||
context.args = [5]
|
||||
|
@ -1290,8 +1290,9 @@ def test_telegram_trades(mocker, update, default_conf, fee):
|
|||
assert "Profit (" in msg_mock.call_args_list[0][0][0]
|
||||
assert "Close Date" in msg_mock.call_args_list[0][0][0]
|
||||
assert "<pre>" in msg_mock.call_args_list[0][0][0]
|
||||
assert bool(re.search(r"just now[ ]*XRP\/BTC \(#3\) 1.00% \(",
|
||||
msg_mock.call_args_list[0][0][0]))
|
||||
regex_pattern = r"just now[ ]*XRP\/BTC \(#3\) -1.00% \(" if is_short else \
|
||||
r"just now[ ]*XRP\/BTC \(#3\) 1.00% \("
|
||||
assert bool(re.search(regex_pattern, msg_mock.call_args_list[0][0][0]))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('is_short', [True, False])
|
||||
|
|
Loading…
Reference in New Issue
Block a user