-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbalance_check.py
executable file
·84 lines (59 loc) · 1.84 KB
/
balance_check.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
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
#! /usr/bin/env python
#
# @author junhocho
import sys
from pprint import pprint
from secret import *
from xcoin_api_client import *
from coinone.account import Coinone
from poloniex import *
import logging
logging.getLogger("requests").setLevel(logging.WARNING)
#bithApi = XCoinAPI(BITHUMB_API_KEY, BITHUMB_API_SECRET);
bithApi = None
my = Coinone(COINONE_API_KEY, COINONE_API_SECRET)
polo = Poloniex(POLONIEX_API_KEY, POLONIEX_API_SECRET)
## Bithumb
if bithApi:
rgParams = {
"order_currency" : "BTC",
"payment_currency" : "KRW",
};
bith_balance = {}
coins = ["BTC", "ETH", "ETC", "LTC", "XRP"]
for c in coins:
rgParams = {
"currency" : c};
result = bithApi.xcoinApiCall("/info/balance", rgParams);
#print(result)
bith_balance[c] = result['data']['available_'+c.lower()]
#print("{} :\t {}".format(c, result['data']['available_'+c.lower()]))
bith_balance['KRW'] = result['data']['available_krw']
# Coinone
mybal = my.balance()
coinone_balance = {}
coinone_balance['BTC'] = mybal['btc']['balance']
coinone_balance['ETC']= mybal['etc']['balance']
coinone_balance['ETH']= mybal['eth']['balance']
coinone_balance['KRW']= mybal['krw']['balance']
# Poloniex
polo_balance = polo.returnBalances()
if bithApi:
print("==== Bith Balance ==== ")
for c in bith_balance:
if float(bith_balance[c]) > 0:
print(c, bith_balance[c])
print("==== Coinone Balance ==== ")
for c in coinone_balance:
if float(coinone_balance[c]) > 0:
print(c, coinone_balance[c])
print("==== Polo Balance ==== ")
for c in polo_balance:
if float(polo_balance[c]) > 0:
print(c, polo_balance[c])
#print(balance)
# or
#balance = polo('returnBalances')
#print("I have %s BTC!" % balance['BTC'])
sys.exit(0);
print("==== Polo Balance ==== ")