-
Notifications
You must be signed in to change notification settings - Fork 8
/
account_checker.py
30 lines (26 loc) · 1011 Bytes
/
account_checker.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
#!/usr/bin/python2
from coinbase.wallet.client import Client
import json
import creds
import datetime
def logger(date_time, total_euro_value):
f = open("log.csv", "a")
message = "%s,%f\n" %(date_time, total_euro_value)
f.write(message)
f.close()
def main():
current_datetime = datetime.datetime.now()
print "[+] Current Datetime: %s" %(current_datetime)
client = Client(creds.api_key, creds.api_secret)
data = client.get_accounts()
total_euro_value = 0.00
for x in range(0,5):
currency_type = data[x]["balance"]["currency"]
currency_amount = data[x]["balance"]["amount"]
euros_amount = data[x]["native_balance"]["amount"]
print "[+] You have %s %s valued at %s euros" %(currency_amount, currency_type, euros_amount)
total_euro_value = total_euro_value + float(euros_amount)
print "[+] Total euro worth is: %f " %(float(total_euro_value))
logger(current_datetime, total_euro_value)
if __name__ == "__main__":
main()