-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathaffiliate_endpoints.py
More file actions
37 lines (28 loc) · 1.03 KB
/
affiliate_endpoints.py
File metadata and controls
37 lines (28 loc) · 1.03 KB
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
30
31
32
33
34
35
36
37
import asyncio
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import TESTNET
from tests.conftest import TEST_ADDRESS_3
async def test_affiliate():
indexer = IndexerClient(TESTNET.rest_indexer)
test_address = TEST_ADDRESS_3
try:
response = await indexer.affiliate.get_metadata(test_address)
print(f"Referral code: {response['referralCode']}")
except Exception as e:
print(f"Error: {e}")
try:
response = await indexer.affiliate.get_address("NoisyPlumPOX")
print(f"Address: {response['address']}")
except Exception as e:
print(f"Error: {e}")
try:
response = await indexer.affiliate.get_snapshot()
print(f"snapshot: {response}")
except Exception as e:
print(f"Error: {e}")
try:
response = await indexer.affiliate.get_total_volume(test_address)
print(f"Total volume: {response['totalVolume']}")
except Exception as e:
print(f"Error: {e}")
asyncio.run(test_affiliate())