test: simplify ccxt_order_parse test (but improve it at the same time)

This commit is contained in:
Matthias
2026-03-06 21:07:59 +01:00
parent b283cabbcd
commit b57a7f207e
2 changed files with 46 additions and 48 deletions
+38 -31
View File
@@ -26,6 +26,7 @@ class TestExchangeOnlineSetup(TypedDict):
trades_lookback_hours: int
private_methods: list[str] | None
sample_order: list[dict[str, Any]] | None
sample_order_futures: list[dict[str, Any]] | None
sample_my_trades: list[dict[str, Any]] | None
skip_ws_tests: bool | None
@@ -77,11 +78,12 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "3551312894",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"side": "buy",
"amount": 1.1,
},
},
@@ -107,11 +109,12 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "3551312894",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"side": "buy",
"status": "closed",
"amount": 1.1,
},
},
@@ -148,9 +151,9 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "3551312894",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"amount": 1.1,
@@ -203,12 +206,12 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"price": 15.5,
"status": "open",
"amount": 1.1,
"id": "63d6742d0adc5570001d2bbf7",
"timestamp": None,
"datetime": None,
"price": None,
"status": None,
"amount": None,
},
}, # create order
{
@@ -247,11 +250,11 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "63d6742d0adc5570001d2bbf7",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"status": "closed",
"amount": 1.1,
},
},
@@ -304,11 +307,12 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "276266139423",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"average": 15.5,
"status": "closed",
"amount": 1.1,
},
},
@@ -347,11 +351,11 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "276401180529",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"status": "canceled",
"amount": 1.1,
},
},
@@ -420,10 +424,11 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "1274754916287346280",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"side": "buy",
"status": "open",
"amount": 1.1,
},
@@ -499,18 +504,19 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "1762393630149869568",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"average": 15.5,
"status": "closed",
"amount": 1.1,
},
},
{
"exchange_response": {
"symbol": "SOL-USDT",
"orderId": "1762393630149869568",
"orderId": "1762393630149869567",
"transactTime": "1674493798550",
"price": "15.5",
"stopPrice": "0",
@@ -525,11 +531,12 @@ EXCHANGES: dict[str, TestExchangeOnlineSetup] = {
"pair": "SOL/USDT",
"expected": {
"symbol": "SOL/USDT",
"orderId": "3551312894",
"id": "1762393630149869567",
"timestamp": 1674493798550,
"datetime": "2023-03-25T15:49:58.550Z",
"datetime": "2023-01-23T17:09:58.550Z",
"price": 15.5,
"status": "open",
"average": 15.5,
"status": "closed",
"amount": 1.1,
},
},