-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from InjectiveLabs/feat/add_deriv_positions_e…
…xample feat/add_deriv_positions_example
- Loading branch information
Showing
2 changed files
with
31 additions
and
12 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
examples/exchange_client/derivative_exchange_rpc/23_LiquidablePositions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import asyncio | ||
|
||
from google.protobuf import json_format | ||
|
||
from pyinjective.async_client import AsyncClient | ||
from pyinjective.core.network import Network | ||
|
||
|
||
async def main() -> None: | ||
network = Network.testnet() | ||
client = AsyncClient(network) | ||
market_id = "0x17ef48032cb24375ba7c2e39f384e56433bcab20cbee9a7357e4cba2eb00abe6" | ||
skip = 10 | ||
limit = 3 | ||
positions = await client.get_derivative_liquidable_positions( | ||
market_id=market_id, | ||
skip=skip, | ||
limit=limit, | ||
) | ||
print( | ||
json_format.MessageToJson( | ||
message=positions, | ||
including_default_value_fields=True, | ||
preserving_proto_field_name=True, | ||
) | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.get_event_loop().run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters