forked from tinymanorg/tinyman-py-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pooling1.py
29 lines (22 loc) · 1.01 KB
/
pooling1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# This sample is provided for demonstration purposes only.
# It is not intended for production use.
# This example does not constitute trading advice.
from tinyman.v1.client import TinymanTestnetClient
# Hardcoding account keys is not a great practice. This is for demonstration purposes only.
# See the README & Docs for alternative signing methods.
account = {
'address': 'ALGORAND_ADDRESS_HERE',
'private_key': 'base64_private_key_here', # Use algosdk.mnemonic.to_private_key(mnemonic) if necessary
}
client = TinymanTestnetClient(user_address=account['address'])
# By default all subsequent operations are on behalf of user_address
# Fetch our two assets of interest
TINYUSDC = client.fetch_asset(21582668)
ALGO = client.fetch_asset(0)
# Fetch the pool we will work with
pool = client.fetch_pool(TINYUSDC, ALGO)
info = pool.fetch_pool_position()
share = info['share'] * 100
print(f'Pool Tokens: {info[pool.liquidity_asset]}')
print(f'Assets: {info[TINYUSDC]}, {info[ALGO]}')
print(f'Share of pool: {share:.3f}%')