-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbitcoinAlert.py
More file actions
28 lines (25 loc) · 894 Bytes
/
bitcoinAlert.py
File metadata and controls
28 lines (25 loc) · 894 Bytes
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
import os
import requests
import time
response = requests.get('https://api.nomics.com/v1/currencies/ticker?key=bcbd33571b255a696995dad391a822e6&ids=BTC&interval=1d,30d&convert=USD')
data = response.json()
bit = data[0]['price']
file = "alert.mp3"
os.system("mpg123 " + file)
ask = input('do you want to customize price? (Y/N)')
if str(ask) == "Y":
alert_amount = input('Alert if Bitcoin drops below: ')
alert_amounthigher = input('Alert if Bitcoin increase')
while True:
if alert_amount > bit:
print("price is droped below:" + alert_amount + "price is now :"+ bit)
time.sleep(180)
if alert_amounthigher < bit:
print("price is Increased :" + alert_amounthigher + "price is now :"+ bit)
time.sleep(180)
def PrintPrice(Bitcoin):
return print("Okay - Bitcoin Price is :"+ Bitcoin)
if str(ask) == "N":
while True:
PrintPrice(bit)
time.sleep(180)