Skip to content

Commit 87b0af7

Browse files
author
abel
committed
(feat) Added example for liquidable positions request. Also removed sentry nodes from network config
1 parent 0b3b17b commit 87b0af7

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import asyncio
2+
3+
from google.protobuf import json_format
4+
5+
from pyinjective.async_client import AsyncClient
6+
from pyinjective.core.network import Network
7+
8+
9+
async def main() -> None:
10+
network = Network.testnet()
11+
client = AsyncClient(network)
12+
market_id = "0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6"
13+
skip = 10
14+
limit = 3
15+
positions = await client.get_derivative_liquidable_positions(
16+
market_id=market_id,
17+
skip=skip,
18+
limit=limit,
19+
)
20+
print(
21+
json_format.MessageToJson(
22+
message=positions,
23+
including_default_value_fields=True,
24+
preserving_proto_field_name=True,
25+
)
26+
)
27+
28+
29+
if __name__ == "__main__":
30+
asyncio.get_event_loop().run_until_complete(main())

pyinjective/core/network.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,6 @@ def mainnet(cls, node="lb"):
244244
nodes = [
245245
"lb", # us, asia, prod
246246
"lb_k8s",
247-
"sentry0", # ca, prod
248-
"sentry1", # ca, prod
249-
"sentry3", # us, prod
250247
]
251248
if node not in nodes:
252249
raise ValueError("Must be one of {}".format(nodes))
@@ -259,22 +256,14 @@ def mainnet(cls, node="lb"):
259256
grpc_explorer_endpoint = "sentry.explorer.grpc.injective.network:443"
260257
cookie_assistant = BareMetalLoadBalancedCookieAssistant()
261258
use_secure_connection = True
262-
elif node == "lb_k8s":
259+
else:
263260
lcd_endpoint = "https://k8s.global.mainnet.lcd.injective.network:443"
264261
tm_websocket_endpoint = "wss://k8s.global.mainnet.tm.injective.network:443/websocket"
265262
grpc_endpoint = "k8s.global.mainnet.chain.grpc.injective.network:443"
266263
grpc_exchange_endpoint = "k8s.global.mainnet.exchange.grpc.injective.network:443"
267264
grpc_explorer_endpoint = "k8s.global.mainnet.explorer.grpc.injective.network:443"
268265
cookie_assistant = KubernetesLoadBalancedCookieAssistant()
269266
use_secure_connection = True
270-
else:
271-
lcd_endpoint = f"http://{node}.injective.network:10337"
272-
tm_websocket_endpoint = f"ws://{node}.injective.network:26657/websocket"
273-
grpc_endpoint = f"{node}.injective.network:9900"
274-
grpc_exchange_endpoint = f"{node}.injective.network:9910"
275-
grpc_explorer_endpoint = f"{node}.injective.network:9911"
276-
cookie_assistant = DisabledCookieAssistant()
277-
use_secure_connection = False
278267

279268
return cls(
280269
lcd_endpoint=lcd_endpoint,

0 commit comments

Comments
 (0)