From 6b5ee8603e24f6cc0d671f566cc65a0a90c7bc2a Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 26 May 2023 22:25:29 +0200 Subject: [PATCH 1/2] (fix) Solved issue preventing executing historical orders request both for spot and derivative markets --- pyinjective/async_client.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/pyinjective/async_client.py b/pyinjective/async_client.py index db863ff3..889cd038 100644 --- a/pyinjective/async_client.py +++ b/pyinjective/async_client.py @@ -660,12 +660,15 @@ async def get_spot_orders(self, market_id: str, **kwargs): ) return await self.stubSpotExchange.Orders(req) - async def get_historical_spot_orders(self, market_id: str, **kwargs): + async def get_historical_spot_orders(self, market_id: Optional[str] = None, **kwargs): + market_ids = kwargs.get("market_ids", []) + if market_id is not None: + market_ids.append(market_id) req = spot_exchange_rpc_pb.OrdersHistoryRequest( - market_id=market_id, + market_ids=kwargs.get("market_ids", []), direction=kwargs.get("direction"), - order_types=kwargs.get("order_types"), - execution_types=kwargs.get("execution_types"), + order_types=kwargs.get("order_types", []), + execution_types=kwargs.get("execution_types", []), subaccount_id=kwargs.get("subaccount_id"), skip=kwargs.get("skip"), limit=kwargs.get("limit"), @@ -820,14 +823,19 @@ async def get_derivative_orders(self, market_id: str, **kwargs): ) return await self.stubDerivativeExchange.Orders(req) - async def get_historical_derivative_orders(self, market_id: str, **kwargs): + async def get_historical_derivative_orders(self, market_id: Optional[str] = None, **kwargs): + market_ids = kwargs.get("market_ids", []) + if market_id is not None: + market_ids.append(market_id) + order_types = kwargs.get("order_types", []) + order_type = kwargs.get("order_type") + if order_type is not None: + order_types.append(market_id) req = derivative_exchange_rpc_pb.OrdersHistoryRequest( - market_id=market_id, - market_ids=kwargs.get("market_ids"), + market_ids=market_ids, direction=kwargs.get("direction"), - order_type=kwargs.get("order_type"), - order_types=kwargs.get("order_types"), - execution_types=kwargs.get("execution_types"), + order_types=order_types, + execution_types=kwargs.get("execution_types", []), subaccount_id=kwargs.get("subaccount_id"), is_conditional=kwargs.get("is_conditional"), skip=kwargs.get("skip"), From 8b2c988e420d20295d90a5dba6d542bad926fb20 Mon Sep 17 00:00:00 2001 From: abel Date: Fri, 26 May 2023 22:37:42 +0200 Subject: [PATCH 2/2] (fix) Add bugfix description in the changelog in README file --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 82b55893..77a5252e 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ make tests ### Changelogs **0.6.3**(change before release) * Change logging logic to use different loggers for each module and class +* Solved issue preventing requesting spot and derivative historical orders for more than one market_id * Add `pytest` as a development dependency to implement and run unit tests **0.6.2.7**