Skip to content

Commit 814f8eb

Browse files
committed
additions to trade requests
1 parent 104a18f commit 814f8eb

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

pyinjective/async_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ async def get_spot_orders(self, market_id: str, order_side: str = '', subaccount
240240
req = spot_exchange_rpc_pb.OrdersRequest(market_id=market_id, order_side=order_side, subaccount_id=subaccount_id)
241241
return await self.stubSpotExchange.Orders(req)
242242

243-
async def get_spot_trades(self, market_id: str, execution_side: str = '', direction: str = '', subaccount_id: str = ''):
244-
req = spot_exchange_rpc_pb.TradesRequest(market_id=market_id, execution_side=execution_side, direction=direction, subaccount_id=subaccount_id)
243+
async def get_spot_trades(self, market_id: str, execution_side: str = '', direction: str = '', subaccount_id: str = '', skip: int = 0, limit: int = 0):
244+
req = spot_exchange_rpc_pb.TradesRequest(market_id=market_id, execution_side=execution_side, direction=direction, subaccount_id=subaccount_id, skip=skip, limit=limit)
245245
return await self.stubSpotExchange.Trades(req)
246246

247247
async def stream_spot_orderbook(self, market_id: str):
@@ -257,8 +257,8 @@ async def stream_spot_orders(self, market_id: str, order_side: str = '', subacco
257257
req = spot_exchange_rpc_pb.StreamOrdersRequest(market_id=market_id, order_side=order_side, subaccount_id=subaccount_id)
258258
return self.stubSpotExchange.StreamOrders(req)
259259

260-
async def stream_spot_trades(self, market_id: str, execution_side: str = '', direction: str = '', subaccount_id: str = ''):
261-
req = spot_exchange_rpc_pb.StreamTradesRequest(market_id=market_id, execution_side=execution_side, direction=direction, subaccount_id=subaccount_id)
260+
async def stream_spot_trades(self, market_id: str, execution_side: str = '', direction: str = '', subaccount_id: str = '', skip: int = 0, limit: int = 0):
261+
req = spot_exchange_rpc_pb.StreamTradesRequest(market_id=market_id, execution_side=execution_side, direction=direction, subaccount_id=subaccount_id, skip=skip, limit=limit)
262262
return self.stubSpotExchange.StreamTrades(req)
263263

264264
async def get_spot_subaccount_orders(self, subaccount_id: str, market_id: str = ''):
@@ -291,8 +291,8 @@ async def get_derivative_orders(self, market_id: str, order_side: str = '', suba
291291
req = derivative_exchange_rpc_pb.OrdersRequest(market_id=market_id, order_side=order_side, subaccount_id=subaccount_id)
292292
return await self.stubDerivativeExchange.Orders(req)
293293

294-
async def get_derivative_trades(self, market_id: str, subaccount_id: str = ''):
295-
req = derivative_exchange_rpc_pb.TradesRequest(market_id=market_id, subaccount_id=subaccount_id)
294+
async def get_derivative_trades(self, market_id: str, subaccount_id: str = '', skip: int = 0, limit: int = 0):
295+
req = derivative_exchange_rpc_pb.TradesRequest(market_id=market_id, subaccount_id=subaccount_id, execution_side=execution_side, direction=direction, skip=skip, limit=limit)
296296
return await self.stubDerivativeExchange.Trades(req)
297297

298298
async def stream_derivative_orderbook(self, market_id: str):
@@ -307,8 +307,8 @@ async def stream_derivative_orders(self, market_id: str, order_side: str = '', s
307307
req = derivative_exchange_rpc_pb.StreamOrdersRequest(market_id=market_id, order_side=order_side, subaccount_id=subaccount_id)
308308
return self.stubDerivativeExchange.StreamOrders(req)
309309

310-
async def stream_derivative_trades(self, market_id: str, subaccount_id: str = ''):
311-
req = derivative_exchange_rpc_pb.StreamTradesRequest(market_id=market_id, subaccount_id=subaccount_id)
310+
async def stream_derivative_trades(self, market_id: str, subaccount_id: str = "", execution_side: str = "", direction: str = "", skip: int = 0, limit: int = 0):
311+
req = derivative_exchange_rpc_pb.StreamTradesRequest(market_id=market_id, subaccount_id=subaccount_id, execution_side=execution_side, direction=direction, skip=skip, limit=limit)
312312
return self.stubDerivativeExchange.StreamTrades(req)
313313

314314
async def get_derivative_positions(self, market_id: str, subaccount_id: str = ''):

pyinjective/client.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,16 @@ def get_spot_trades(
312312
execution_side: str = "",
313313
direction: str = "",
314314
subaccount_id: str = "",
315+
skip: int = 0,
316+
limit: int = 0
315317
):
316318
req = spot_exchange_rpc_pb.TradesRequest(
317319
market_id=market_id,
318320
execution_side=execution_side,
319321
direction=direction,
320322
subaccount_id=subaccount_id,
323+
skip=skip,
324+
limit=limit
321325
)
322326
return self.stubSpotExchange.Trades(req)
323327

@@ -343,12 +347,16 @@ def stream_spot_trades(
343347
execution_side: str = "",
344348
direction: str = "",
345349
subaccount_id: str = "",
350+
skip: int = 0,
351+
limit: int = 0
346352
):
347353
req = spot_exchange_rpc_pb.StreamTradesRequest(
348354
market_id=market_id,
349355
execution_side=execution_side,
350356
direction=direction,
351357
subaccount_id=subaccount_id,
358+
skip=skip,
359+
limit=limit
352360
)
353361
return self.stubSpotExchange.StreamTrades(req)
354362

@@ -401,9 +409,9 @@ def get_derivative_orders(
401409
)
402410
return self.stubDerivativeExchange.Orders(req)
403411

404-
def get_derivative_trades(self, market_id: str, subaccount_id: str = ""):
412+
def get_derivative_trades(self, market_id: str, subaccount_id: str = "", execution_side: str = "", direction: str = "", skip: int = 0, limit: int = 0):
405413
req = derivative_exchange_rpc_pb.TradesRequest(
406-
market_id=market_id, subaccount_id=subaccount_id
414+
market_id=market_id, subaccount_id=subaccount_id, execution_side=execution_side, direction=direction, skip=skip, limit=limit
407415
)
408416
return self.stubDerivativeExchange.Trades(req)
409417

@@ -423,9 +431,9 @@ def stream_derivative_orders(
423431
)
424432
return self.stubDerivativeExchange.StreamOrders(req)
425433

426-
def stream_derivative_trades(self, market_id: str, subaccount_id: str = ""):
434+
def stream_derivative_trades(self, market_id: str, subaccount_id: str = "", execution_side: str = "", direction: str = "", skip: int = 0, limit: int = 0):
427435
req = derivative_exchange_rpc_pb.StreamTradesRequest(
428-
market_id=market_id, subaccount_id=subaccount_id
436+
market_id=market_id, subaccount_id=subaccount_id, execution_side=execution_side, direction=direction, skip=skip, limit=limit
429437
)
430438
return self.stubDerivativeExchange.StreamTrades(req)
431439

0 commit comments

Comments
 (0)