Skip to content

Commit 6b5ee86

Browse files
committed
(fix) Solved issue preventing executing historical orders request both for spot and derivative markets
1 parent 0f23864 commit 6b5ee86

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

pyinjective/async_client.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,15 @@ async def get_spot_orders(self, market_id: str, **kwargs):
660660
)
661661
return await self.stubSpotExchange.Orders(req)
662662

663-
async def get_historical_spot_orders(self, market_id: str, **kwargs):
663+
async def get_historical_spot_orders(self, market_id: Optional[str] = None, **kwargs):
664+
market_ids = kwargs.get("market_ids", [])
665+
if market_id is not None:
666+
market_ids.append(market_id)
664667
req = spot_exchange_rpc_pb.OrdersHistoryRequest(
665-
market_id=market_id,
668+
market_ids=kwargs.get("market_ids", []),
666669
direction=kwargs.get("direction"),
667-
order_types=kwargs.get("order_types"),
668-
execution_types=kwargs.get("execution_types"),
670+
order_types=kwargs.get("order_types", []),
671+
execution_types=kwargs.get("execution_types", []),
669672
subaccount_id=kwargs.get("subaccount_id"),
670673
skip=kwargs.get("skip"),
671674
limit=kwargs.get("limit"),
@@ -820,14 +823,19 @@ async def get_derivative_orders(self, market_id: str, **kwargs):
820823
)
821824
return await self.stubDerivativeExchange.Orders(req)
822825

823-
async def get_historical_derivative_orders(self, market_id: str, **kwargs):
826+
async def get_historical_derivative_orders(self, market_id: Optional[str] = None, **kwargs):
827+
market_ids = kwargs.get("market_ids", [])
828+
if market_id is not None:
829+
market_ids.append(market_id)
830+
order_types = kwargs.get("order_types", [])
831+
order_type = kwargs.get("order_type")
832+
if order_type is not None:
833+
order_types.append(market_id)
824834
req = derivative_exchange_rpc_pb.OrdersHistoryRequest(
825-
market_id=market_id,
826-
market_ids=kwargs.get("market_ids"),
835+
market_ids=market_ids,
827836
direction=kwargs.get("direction"),
828-
order_type=kwargs.get("order_type"),
829-
order_types=kwargs.get("order_types"),
830-
execution_types=kwargs.get("execution_types"),
837+
order_types=order_types,
838+
execution_types=kwargs.get("execution_types", []),
831839
subaccount_id=kwargs.get("subaccount_id"),
832840
is_conditional=kwargs.get("is_conditional"),
833841
skip=kwargs.get("skip"),

0 commit comments

Comments
 (0)