Skip to content

Instantly share code, notes, and snippets.

@KolevDarko
Created June 16, 2017 08:26
Show Gist options
  • Save KolevDarko/7fc279bc47d1e0b352b6599a3e83ae80 to your computer and use it in GitHub Desktop.
Save KolevDarko/7fc279bc47d1e0b352b6599a3e83ae80 to your computer and use it in GitHub Desktop.
if __name__ == '__main__':
my_exchange = input("Your exchange:")
starting_price = input("Bitcoin starting price:")
amount = input("Bitcoin amount:")
currency = input("Your currency (default USD):")
check_every = input("Check every (seconds):")
threshold = input("Choose to be notified when a certain limit is reached\n1) Percent limit: \n2) Amount limit: \n ")
limit_type = None
limit = 0
if threshold == '1':
limit_type = 'percent'
limit = input("Percent:")
elif threshold == '2':
limit_type = 'amount'
limit = input("Amount:")
if not currency:
currency = 'USD'
notifications = input("Choose desktop notifications: \n0) No\n1) Mac\n2) Linux\n")
while True:
result = main(my_exchange, float(starting_price), float(amount), currency, limit_type, float(limit))
if result:
if notifications == '1':
content = 'display notification "{result}" with title "Bitcoin Profits" '.format(result=result)
subprocess.run(['/usr/bin/osascript', '-e', content])
elif notifications == '2':
subprocess.run(['notify-send', 'Bitcoin Profits', result])
else:
print(result)
break
time.sleep(int(check_every))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment