From 194d53acf83f30f89e85ee6a52562457871cfbc7 Mon Sep 17 00:00:00 2001 From: David Arena Date: Sat, 12 Apr 2025 16:57:30 +0200 Subject: [PATCH] fix: adding checks for trades and order_by_id --- tests/rpc/test_rpc_apiserver.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 6261f1ae1..901a08c67 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -782,6 +782,18 @@ def test_api_trades(botclient, mocker, fee, markets, is_short): assert rc.json()["trades_count"] == 1 assert rc.json()["total_trades"] == 2 + # Test ascending order (default) + rc = client_get(client, f"{BASE_URI}/trades?order_by_id=true") + assert_response(rc) + assert rc.json()["trades"][0]["trade_id"] == 2 + assert rc.json()["trades"][1]["trade_id"] == 3 + + # Test descending order + rc = client_get(client, f"{BASE_URI}/trades?order_by_id=false") + assert_response(rc) + assert rc.json()["trades"][0]["trade_id"] == 3 + assert rc.json()["trades"][1]["trade_id"] == 2 + @pytest.mark.parametrize("is_short", [True, False]) def test_api_trade_single(botclient, mocker, fee, ticker, markets, is_short):