forked from grantstephens/pyluno
/
demo.py
executable file
·35 lines (29 loc) · 1.05 KB
/
demo.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
30
31
32
33
34
35
from __future__ import print_function
import os
from pyluno.api import Luno
def runDemo():
user = ''
password = ''
auth = 'BITX_KEY' in os.environ and 'BITX_SECRET' in os.environ
if auth:
user = os.environ['BITX_KEY']
password = os.environ['BITX_SECRET']
else:
print("Note: Couldn't find a BITX_KEY environment variable."
" This means that none of the API queries that"
" require authentication will work."
" Carrying on anyway, but make sure your"
" credentials are available "
" in the BITX_KEY and BITX_SECRET environment variables"
" and run this demo again")
api = Luno(user, password)
print(api.market.get_ticker())
print(api.market.get_all_tickers())
print(api.market.get_order_book(5))
print(api.market.get_trades(10))
if auth:
print(api.account.get_orders())
print(api.withdrawal.get_funding_address('XBT'))
print(api.account.get_balance())
if __name__ == '__main__':
runDemo()