forked from thiezn/bittrex-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync_example.py
More file actions
executable file
·116 lines (95 loc) · 3.78 KB
/
sync_example.py
File metadata and controls
executable file
·116 lines (95 loc) · 3.78 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python3
from bittrex import BittrexSession
from bittrex.exceptions import RequestError
def main():
session = BittrexSession.load_from_file('configs/bittrex.json')
market_name = 'BTC-LTC'
currency = 'BTC'
uuid = 'dummy'
print('Retrieving markets')
print('==================')
markets = session.get_markets()
print(f'{len(markets)} markets found')
print(f'First response is {markets[0]}\n\n')
print('Retrieving market summaries')
print('===========================')
market_summaries = session.get_market_summaries()
print(f'{len(market_summaries)} markets found')
print(f'First response is: {market_summaries[0]}\n\n')
print(f'Retrieving {market_name} get_market_history')
print('=================================')
market_history = session.get_market_history(market_name)
print(f'{len(market_history)} found')
print(f'First response is: {market_history[0]}\n\n')
print('Retrieving get_currencies')
print('=========================')
currencies = session.get_currencies()
print(f'{len(currencies)} found')
print(f'First response is: {currencies[0]}\n\n')
print(f'Retrieving get_ticker for {market_name}')
print('=========================')
market_ticker = session.get_ticker(market_name)
print(f'Response is: {market_ticker}\n\n')
print('Retrieving get_order_book')
print('=========================')
order_book = session.get_order_book(
market_name,
'buy'
)
print(f'{len(order_book)} found')
print(f'First response is: {order_book[0]}\n\n')
print('Retrieving get_open_orders')
print('==========================')
open_orders = session.get_open_orders()
print(f'{len(open_orders)} found')
if open_orders:
print(f'First response is: {open_orders[0]}')
print('\n\nRetrieving get_order_history')
print('=========================')
order_history = session.get_order_history()
print(f'{len(order_history)} found')
if order_history:
print(f'First response is: {order_history[0]}')
print('\n\nRetrieving get_balances')
print('=========================')
balances = session.get_balances()
print(f'{len(balances)} found')
if balances:
print(f'First response is: {balances[0]}')
print('\n\nRetrieving get_deposit_address')
print('=========================')
deposit_address = session.get_deposit_address(currency)
print(f'Response is: {deposit_address}\n\n')
print('Retrieving get_withdrawal_history')
print('=========================')
withdrawal_history = session.get_withdrawal_history()
print(f'{len(withdrawal_history)} found')
if withdrawal_history:
print(f'First response is: {withdrawal_history[0]}')
print(f'\n\nRetrieving get_order')
print('=========================')
try:
order = session.get_order(uuid)
print(f'Response is: {order}')
except RequestError as e:
print(f'Error retrieving order {uuid}: {e}')
print('\n\nRetrieving get_deposit_history')
print('=========================')
deposit_history = session.get_deposit_history()
print(f'{len(deposit_history)} found')
if deposit_history:
print(f'First response is: {deposit_history[0]}\n\n')
print('\n\nRetrieving get_candles()')
print('=========================')
candles = session.get_candles(market_name, 'five_min')
print(f'{len(candles)} found')
if candles:
print(f'First response is: {candles[0]}\n\n')
print('\n\nRetrieving get_latest_candle()')
print('=========================')
candles = session.get_latest_candle(market_name, 'five_min')
print(f'{len(candles)} found')
if candles:
print(f'First response is: {candles[0]}\n\n')
if __name__ == '__main__':
main()