-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgetMyBalances.py
33 lines (27 loc) · 1.11 KB
/
getMyBalances.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
import json
import yaml
from ctapi import CTAPI
if __name__ == "__main__":
with open("secrets.yml") as f:
secrets = yaml.load(f)
f.close()
# api = CTAPI(secrets['key'], secrets['secret'], debug=True)
api = CTAPI(secrets['key'], secrets['secret'])
balances = api.getBalance()
if balances['result']['success']:
sum = 0
print "+-------+------------+------------+------------+"
print "| SYM | amount | price_fiat | value_fiat |"
print "+-------+------------+------------+------------+"
for b in balances['result']['details']:
details = balances['result']['details'][b]
if float(details['value_fiat']) > 0.01:
sum = sum + float(details['value_fiat'])
print "| %5s | %10.2f | %10.2f | %10.2f |" % (b, float(details['amount']),
float(details['price_fiat']), float(details['value_fiat']) )
print "+-------+------------+------------+------------+"
print ""
print "Sum: %15.2f EUR" % (sum)
print "=" * 24
else:
print "got no balances"