Skip to content

Commit d4fa155

Browse files
committed
"chore: added new chain rpc endpoints"
1 parent 463bb27 commit d4fa155

File tree

605 files changed

+32725
-26384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

605 files changed

+32725
-26384
lines changed

pyinjective/async_client.py

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,9 @@ async def fetch_spot_orderbook(
613613
pagination=pagination,
614614
)
615615

616+
async def fetch_full_spot_orderbook(self, market_id: str) -> Dict[str, any]:
617+
return await self.chain_exchange_api.fetch_l3_spot_orderbook(market_id=market_id)
618+
616619
async def fetch_trader_spot_orders(
617620
self,
618621
market_id: str,
@@ -693,6 +696,12 @@ async def fetch_derivative_orderbook(
693696
pagination=pagination,
694697
)
695698

699+
async def fetch_full_derivative_orderbook(
700+
self,
701+
market_id: str,
702+
) -> Dict[str, Any]:
703+
return await self.chain_exchange_api.fetch_l3_derivative_orderbook(market_id=market_id)
704+
696705
async def fetch_trader_derivative_orders(
697706
self,
698707
market_id: str,
@@ -1038,49 +1047,8 @@ async def abci_query(
10381047
# OracleRPC
10391048
# InsuranceRPC
10401049
# SpotRPC
1041-
async def fetch_spot_market(self, market_id: str) -> Dict[str, Any]:
1042-
return await self.chain_exchange_api.fetch_market(market_id=market_id)
10431050

1044-
async def fetch_spot_markets(
1045-
self,
1046-
market_statuses: Optional[List[str]] = None,
1047-
base_denom: Optional[str] = None,
1048-
quote_denom: Optional[str] = None,
1049-
) -> Dict[str, Any]:
1050-
return await self.chain_exchange_api.fetch_markets(
1051-
market_statuses=market_statuses, base_denom=base_denom, quote_denom=quote_denom
1052-
)
1053-
1054-
async def fetch_spot_orderbook(self, market_id: str) -> Dict[str, Any]:
1055-
return await self.chain_exchange_api.fetch_orderbook_v2(market_id=market_id)
1056-
1057-
# DerivativeRPC
1058-
####MASSIVE TODO : NEED TO WRITE A LIQUIDABLE POSITIONS WATCHER#######
1059-
# async def get_derivative_liquidable_positions(self, **kwargs):
1060-
# """
1061-
# This method is deprecated and will be removed soon. Please use `fetch_derivative_liquidable_positions` instead
1062-
# """
1063-
# warn(
1064-
# "This method is deprecated. Use fetch_derivative_liquidable_positions instead",
1065-
# DeprecationWarning,
1066-
# stacklevel=2,
1067-
# )
1068-
# req = derivative_exchange_rpc_pb.LiquidablePositionsRequest(
1069-
# market_id=kwargs.get("market_id"),
1070-
# skip=kwargs.get("skip"),
1071-
# limit=kwargs.get("limit"),
1072-
# )
1073-
# return await self.stubDerivativeExchange.LiquidablePositions(req)
1074-
1075-
# async def fetch_derivative_liquidable_positions(
1076-
# self,
1077-
# market_id: Optional[str] = None,
1078-
# pagination: Optional[PaginationOption] = None,
1079-
# ) -> Dict[str, Any]:
1080-
# return await self.exchange_derivative_api.fetch_liquidable_positions(
1081-
# market_id=market_id,
1082-
# pagination=pagination,
1083-
# )
1051+
# TODO (Hrishikesh) : add liquidable positions
10841052
# PortfolioRPC
10851053
async def chain_stream(
10861054
self,

pyinjective/client/chain/grpc/chain_grpc_exchange_api.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ async def fetch_spot_market(self, market_id: str) -> Dict[str, Any]:
118118

119119
return response
120120

121+
async def fetch_l3_spot_orderbook(self, market_id: str) -> Dict[str, Any]:
122+
request = exchange_query_pb.QueryFullSpotOrderbookRequest(market_id=market_id)
123+
response = await self._execute_call(call=self._stub.L3SpotOrderBook, request=request)
124+
return response
125+
121126
async def fetch_full_spot_markets(
122127
self,
123128
status: Optional[str] = None,
@@ -275,6 +280,11 @@ async def fetch_derivative_orderbook(
275280

276281
return response
277282

283+
async def fetch_l3_derivative_orderbook(self, market_id: str) -> Dict[str, Any]:
284+
request = exchange_query_pb.QueryFullDerivativeOrderbookRequest(market_id=market_id)
285+
response = await self._execute_call(call=self._stub.L3DerivativeOrderBook, request=request)
286+
return response
287+
278288
async def fetch_trader_derivative_orders(
279289
self,
280290
market_id: str,

pyinjective/composer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def spot_order(
300300
trigger_price=chain_trigger_price,
301301
)
302302

303+
# TODO (Hrishikesh): I noticed that this is very inconsistent
303304
def calculate_margin(
304305
self, quantity: Decimal, price: Decimal, leverage: Decimal, is_reduce_only: bool = False
305306
) -> Decimal:

pyinjective/proto/amino/amino_pb2.py

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
22
"""Client and server classes corresponding to protobuf-defined services."""
33
import grpc
4-

pyinjective/proto/capability/v1/capability_pb2.py

Lines changed: 21 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
22
"""Client and server classes corresponding to protobuf-defined services."""
33
import grpc
4-

pyinjective/proto/capability/v1/genesis_pb2.py

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
22
"""Client and server classes corresponding to protobuf-defined services."""
33
import grpc
4-

0 commit comments

Comments
 (0)