Skip to content

Commit 68972ac

Browse files
aarmoaAbel Armoa
authored andcommitted
(fix) Solved issue preventing executing historical orders request both for spot and derivative markets
1 parent 78b990f commit 68972ac

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
@@ -701,12 +701,15 @@ async def get_spot_orders(self, market_id: str, **kwargs):
701701
)
702702
return await self.stubSpotExchange.Orders(req)
703703

704-
async def get_historical_spot_orders(self, market_id: str, **kwargs):
704+
async def get_historical_spot_orders(self, market_id: Optional[str] = None, **kwargs):
705+
market_ids = kwargs.get("market_ids", [])
706+
if market_id is not None:
707+
market_ids.append(market_id)
705708
req = spot_exchange_rpc_pb.OrdersHistoryRequest(
706-
market_id=market_id,
709+
market_ids=kwargs.get("market_ids", []),
707710
direction=kwargs.get("direction"),
708-
order_types=kwargs.get("order_types"),
709-
execution_types=kwargs.get("execution_types"),
711+
order_types=kwargs.get("order_types", []),
712+
execution_types=kwargs.get("execution_types", []),
710713
subaccount_id=kwargs.get("subaccount_id"),
711714
skip=kwargs.get("skip"),
712715
limit=kwargs.get("limit"),
@@ -861,14 +864,19 @@ async def get_derivative_orders(self, market_id: str, **kwargs):
861864
)
862865
return await self.stubDerivativeExchange.Orders(req)
863866

864-
async def get_historical_derivative_orders(self, market_id: str, **kwargs):
867+
async def get_historical_derivative_orders(self, market_id: Optional[str] = None, **kwargs):
868+
market_ids = kwargs.get("market_ids", [])
869+
if market_id is not None:
870+
market_ids.append(market_id)
871+
order_types = kwargs.get("order_types", [])
872+
order_type = kwargs.get("order_type")
873+
if order_type is not None:
874+
order_types.append(market_id)
865875
req = derivative_exchange_rpc_pb.OrdersHistoryRequest(
866-
market_id=market_id,
867-
market_ids=kwargs.get("market_ids"),
876+
market_ids=market_ids,
868877
direction=kwargs.get("direction"),
869-
order_type=kwargs.get("order_type"),
870-
order_types=kwargs.get("order_types"),
871-
execution_types=kwargs.get("execution_types"),
878+
order_types=order_types,
879+
execution_types=kwargs.get("execution_types", []),
872880
subaccount_id=kwargs.get("subaccount_id"),
873881
is_conditional=kwargs.get("is_conditional"),
874882
skip=kwargs.get("skip"),

0 commit comments

Comments
 (0)