Improve error message, add test for trade_pagination_id validation

This commit is contained in:
Matthias
2024-01-21 14:11:02 +01:00
parent c333c9c5a1
commit 501a9a8c98
2 changed files with 12 additions and 1 deletions

View File

@@ -182,5 +182,5 @@ class Kraken(Exchange):
# If the id is smaller than 19 characters, it's not a valid timestamp. # If the id is smaller than 19 characters, it's not a valid timestamp.
if len(from_id) >= 19: if len(from_id) >= 19:
return True return True
logger.debug("trade-pagination id is not valid. Fallback to timestamp.") logger.debug(f"{pair} - trade-pagination id is not valid. Fallback to timestamp.")
return False return False

View File

@@ -271,3 +271,14 @@ def test_stoploss_adjust_kraken(mocker, default_conf, sl1, sl2, sl3, side):
# diff. order type ... # diff. order type ...
order['type'] = 'limit' order['type'] = 'limit'
assert exchange.stoploss_adjust(sl3, order, side=side) assert exchange.stoploss_adjust(sl3, order, side=side)
@pytest.mark.parametrize('trade_id, expected', [
('1234', False),
('170544369512007228', False),
('1705443695120072285', True),
('170544369512007228555', True),
])
def test__valid_trade_pagination_id_kraken(mocker, default_conf_usdt, trade_id, expected):
exchange = get_patched_exchange(mocker, default_conf_usdt, id='kraken')
assert exchange._valid_trade_pagination_id('XRP/USDT', trade_id) == expected