-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathreadonly.py
More file actions
77 lines (58 loc) · 1.6 KB
/
Copy pathreadonly.py
File metadata and controls
77 lines (58 loc) · 1.6 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""Example script demonstrating read-only API calls to Luno."""
import os
import time
from luno_python.client import Client
if __name__ == "__main__":
c = Client(api_key_id=os.getenv("LUNO_API_KEY_ID"), api_key_secret=os.getenv("LUNO_API_KEY_SECRET"))
res = c.get_tickers()
print(res)
time.sleep(0.5)
res = c.get_ticker(pair="XBTZAR")
print(res)
time.sleep(0.5)
res = c.get_order_book(pair="XBTZAR")
print(res)
time.sleep(0.5)
since = int(time.time() * 1000) - 24 * 60 * 59 * 1000
res = c.list_trades(pair="XBTZAR", since=since)
print(res)
time.sleep(0.5)
res = c.get_candles(pair="XBTZAR", since=since, duration=300)
print(res)
time.sleep(0.5)
res = c.get_balances()
print(res)
time.sleep(0.5)
aid = ""
if res["balance"]:
aid = res["balance"][0]["account_id"]
if aid:
res = c.list_transactions(id=aid, min_row=1, max_row=10)
print(res)
time.sleep(0.5)
if aid:
res = c.list_pending_transactions(id=aid)
print(res)
time.sleep(0.5)
res = c.list_orders()
print(res)
time.sleep(0.5)
res = c.list_user_trades(pair="XBTZAR")
print(res)
time.sleep(0.5)
res = c.get_fee_info(pair="XBTZAR")
print(res)
time.sleep(0.5)
res = c.get_funding_address(asset="XBT")
print(res)
time.sleep(0.5)
res = c.list_withdrawals()
print(res)
time.sleep(0.5)
wid = ""
if res["withdrawals"]:
wid = res["withdrawals"][0]["id"]
if wid:
res = c.get_withdrawal(id=wid)
print(res)
time.sleep(0.5)