Skip to content

Commit a403d6e

Browse files
committed
feat(exchange): add example for streaming account portfolio API
1 parent cba7505 commit a403d6e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

examples/exchange_client/portfolio_rpc/1_accountPortfolio.py renamed to examples/exchange_client/portfolio_rpc/1_AccountPortfolio.py

File renamed without changes.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import asyncio
2+
import logging
3+
4+
from pyinjective.async_client import AsyncClient
5+
from pyinjective.constant import Network
6+
7+
8+
async def main() -> None:
9+
network = Network.testnet()
10+
client = AsyncClient(network, insecure=False)
11+
account_address = "inj1clw20s2uxeyxtam6f7m84vgae92s9eh7vygagt"
12+
updates = await client.stream_account_portfolio(account_address=account_address)
13+
async for update in updates:
14+
print("Account portfolio Update:\n")
15+
print(update)
16+
17+
18+
if __name__ == '__main__':
19+
logging.basicConfig(level=logging.INFO)
20+
asyncio.get_event_loop().run_until_complete(main())

0 commit comments

Comments
 (0)